diff options
author | Mingming Yin <mingming@codeaurora.org> | 2016-01-22 12:48:44 -0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2016-03-11 03:13:27 -0800 |
commit | fd7607b86e84922517423aa4dd6196c7040e95b2 (patch) | |
tree | 8caa7fc7ecb2d34aadd506b3e9d16cfca30b77b4 | |
parent | 0a79f2c3a0c921cc1597d6113564d277dde40a72 (diff) | |
download | android_hardware_qcom_audio-fd7607b86e84922517423aa4dd6196c7040e95b2.tar.gz android_hardware_qcom_audio-fd7607b86e84922517423aa4dd6196c7040e95b2.tar.bz2 android_hardware_qcom_audio-fd7607b86e84922517423aa4dd6196c7040e95b2.zip |
hal: stop sound trigger buffering during close
If the framework doesn't call read before standby and closes the
record session, sound trigger buffering will not be stopped and
sound trigger hal continue buffering internally. Fix this by
stopping buffering during record session close.
Change-Id: I83941610b3152f26e5ae9c449dbb8f9846b266a2
CRs-fixed: 966060
-rw-r--r-- | hal/audio_extn/soundtrigger.c | 5 | ||||
-rw-r--r-- | hal/audio_hw.c | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/hal/audio_extn/soundtrigger.c b/hal/audio_extn/soundtrigger.c index 3c16c88d..8882b90f 100644 --- a/hal/audio_extn/soundtrigger.c +++ b/hal/audio_extn/soundtrigger.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. +/* Copyright (c) 2013-2014, 2016 The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -174,7 +174,7 @@ void audio_extn_sound_trigger_stop_lab(struct stream_in *in) struct sound_trigger_info *st_ses_info = NULL; audio_event_info_t event; - if (!st_dev || !in) + if (!st_dev || !in || !in->is_st_session_active) return; pthread_mutex_lock(&st_dev->lock); @@ -184,6 +184,7 @@ void audio_extn_sound_trigger_stop_lab(struct stream_in *in) event.u.ses_info = st_ses_info->st_ses; ALOGV("%s: AUDIO_EVENT_STOP_LAB pcm %p", __func__, st_ses_info->st_ses.pcm); st_dev->st_callback(AUDIO_EVENT_STOP_LAB, &event); + in->is_st_session_active = false; } } void audio_extn_sound_trigger_check_and_get_session(struct stream_in *in) diff --git a/hal/audio_hw.c b/hal/audio_hw.c index 7ee27f5d..fc7c84ea 100644 --- a/hal/audio_hw.c +++ b/hal/audio_hw.c @@ -3834,6 +3834,10 @@ static void adev_close_input_stream(struct audio_hw_device *dev, audio_extn_compr_cap_format_supported(in->config.format)) audio_extn_compr_cap_deinit(); + if (in->is_st_session) { + ALOGV("%s: sound trigger pcm stop lab", __func__); + audio_extn_sound_trigger_stop_lab(in); + } free(stream); return; } |