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 helps in
  • Loading branch information
gkdeepa authored and celadon committed Apr 3, 2024
1 parent b58915b commit 8c59f59
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 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,10 @@ 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);
}
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 8c59f59

Please sign in to comment.