Skip to content

Commit

Permalink
Fallback to Dummy when no onboard PCH card
Browse files Browse the repository at this point in the history
When the PCH card is not card 0 and device 0, fallback to dummy
card to avoid sink not ready error at the framework.
This ensures that the dummy card is available and completes the
framework query for sink devices

Tests done:

Audio playback over USB
Audio playback on HDMI

Signed-off-by: Deepa G K <[email protected]>
Tracked-On: OAM-116957
Tracked-On: OAM-116990
  • Loading branch information
gkdeepa authored and celadon committed Apr 8, 2024
1 parent b58915b commit 102f304
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions primary/audio_hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1082,11 +1082,14 @@ static int adev_open_output_stream(struct audio_hw_device *dev,
}
}

ALOGI("PCM playback card selected = %d, \n", adev->card);

if (!params)
return -ENOSYS;
if (!params) {
adev->card = get_pcm_card("Dummy");
params = pcm_params_get(adev->card, PCM_DEVICE, PCM_OUT);
if (!params)
return -ENOSYS;
}

ALOGI("PCM playback card selected = %d, \n", adev->card);
out = (struct stream_out *)calloc(1, sizeof(struct stream_out));
if (!out) {
free(params);
Expand Down Expand Up @@ -1353,7 +1356,12 @@ static int adev_open_input_stream(struct audio_hw_device *dev,
}
}
}

if(!params) {
adev->cardc = get_pcm_card("Dummy");
params = pcm_params_get(adev->cardc, PCM_DEVICE, PCM_IN);
if (!params)
return -ENOSYS;
}
ALOGI("PCM capture card selected = %d, \n", adev->cardc);

in = (struct stream_in *)calloc(1, sizeof(struct stream_in));
Expand Down

0 comments on commit 102f304

Please sign in to comment.