diff options
author | Rios Kao <rioskao@google.com> | 2019-07-30 15:20:51 -0700 |
---|---|---|
committer | Rios Kao <rioskao@google.com> | 2019-07-31 16:40:00 -0700 |
commit | 97f14122298e02cbce28c4cdabd9f1d613ed9113 (patch) | |
tree | 0ccc926a2c64e3b36050c1ea22971d0e79470c9f | |
parent | 03ff3215a9468ebe03700e6ecc98d9a4ca5e8ed9 (diff) | |
download | android_hardware_knowles_athletico_sound_trigger_hal-97f14122298e02cbce28c4cdabd9f1d613ed9113.tar.gz android_hardware_knowles_athletico_sound_trigger_hal-97f14122298e02cbce28c4cdabd9f1d613ed9113.tar.bz2 android_hardware_knowles_athletico_sound_trigger_hal-97f14122298e02cbce28c4cdabd9f1d613ed9113.zip |
sthal: buffer ref count incorrect cause routing unbalance
note: If the crash happens during handle voice-call case, setup
buffer had some trouble. Then the reference count will be
unbalance. The abnormal audio_route setup would happen and
can't recovery until reboot.
Bug: 138557656
Test: manual simulate the same sequence to verify
Change-Id: I2c35b7a06869a5355bd742da5d53df2e6075d1cd
-rw-r--r-- | sound_trigger_hw_iaxxx.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/sound_trigger_hw_iaxxx.c b/sound_trigger_hw_iaxxx.c index 1d322a2..2f12383 100644 --- a/sound_trigger_hw_iaxxx.c +++ b/sound_trigger_hw_iaxxx.c @@ -819,6 +819,7 @@ static int setup_buffer(struct knowles_sound_trigger_device *stdev, err = setup_howord_buffer(stdev->odsp_hdl); if (err != 0) { + stdev->hotword_buffer_enable--; ALOGE("Failed to create the buffer plugin"); goto exit; } @@ -831,6 +832,7 @@ static int setup_buffer(struct knowles_sound_trigger_device *stdev, err = setup_music_buffer(stdev->odsp_hdl); if (err != 0) { + stdev->music_buffer_enable--; ALOGE("Failed to load music buffer package"); goto exit; } @@ -838,7 +840,10 @@ static int setup_buffer(struct knowles_sound_trigger_device *stdev, } else { if ((check_uuid_equality(model->uuid, stdev->hotword_model_uuid)) || (check_uuid_equality(model->uuid, stdev->wakeup_model_uuid))) { - + if (stdev->hotword_buffer_enable == 0) { + ALOGW("Invalid call for setup buffer"); + goto exit; + } stdev->hotword_buffer_enable--; if (stdev->hotword_buffer_enable != 0) goto exit; @@ -852,7 +857,10 @@ static int setup_buffer(struct knowles_sound_trigger_device *stdev, } else if ((check_uuid_equality(model->uuid, stdev->ambient_model_uuid)) || (check_uuid_equality(model->uuid, stdev->entity_model_uuid))) { - + if (stdev->music_buffer_enable == 0) { + ALOGW("Invalid call for setup buffer"); + goto exit; + } stdev->music_buffer_enable--; if (stdev->music_buffer_enable != 0) goto exit; |