audio: aux no sound when submix disabled [1/1]
PD#SH-22151
Problem:
aux no sound when submix disabled
Solution:
aux write to alsa directly.
Verify:
yocto
Change-Id: Ia6aac9a918d0688effc1bffc4b844dde7934dfd7
Signed-off-by: wei.du <wei.du@amlogic.com>
diff --git a/audio_hal/audio_hw.c b/audio_hal/audio_hw.c
index 51deb24..e3601ed 100644
--- a/audio_hal/audio_hw.c
+++ b/audio_hal/audio_hw.c
@@ -3608,6 +3608,10 @@
}
}
+ if (adev->hw_mixer.start_buf && out->stream_type == STREAM_MAIN_INPUT) {
+ aml_hw_mixer_deinit(&adev->hw_mixer);
+ }
+
if (stream) {
aml_audio_free(stream);
stream = NULL;
@@ -6865,8 +6869,26 @@
} else {
if (adev->useSubMix) {
bytes_written = out_write_direct_pcm(stream, buffer, bytes);
- } else {
+ } else if (adev->hw_mixer.start_buf) {
bytes_written = aml_hw_mixer_write(&adev->hw_mixer, buffer, bytes);
+ } else {
+ struct audio_buffer pcm_buffer = {0};
+
+ if (aml_out->hal_rate != OUTPUT_ALSA_SAMPLERATE ) {
+ ret = aml_audio_resample_process_wrapper(&aml_out->resample_handle, buffer, bytes, aml_out->hal_rate, aml_out->hal_ch);
+ if (ret != 0) {
+ ALOGE("aml_audio_resample_process_wrapper failed");
+ } else {
+ buffer = aml_out->resample_handle->resample_buffer;
+ bytes_remaining = aml_out->resample_handle->resample_size;
+ }
+ }
+
+ pcm_buffer.buffer = buffer;
+ pcm_buffer.format = AUDIO_FORMAT_PCM_16_BIT;
+ pcm_buffer.channel = 2;
+ pcm_buffer.size = bytes_remaining;
+ aml_audio_pcm_output(&pcm_buffer);
}
/*these data is skip for ms12, we still need calculate it*/
if (eDolbyMS12Lib == adev->dolby_lib_type_last) {