summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorSimon Wilson <simonwilson@google.com>2011-09-07 17:56:21 -0700
committerSimon Wilson <simonwilson@google.com>2011-09-08 17:32:16 -0700
commitdf84bfdd5f778122a8154a9de015911b75a4250c (patch)
treee87eb2d732769d01793397a20d4a9528eb3984fb /audio
parentb48dbbdeab6f28cf99dc25da67e696ac1399c659 (diff)
downloaddevice_samsung_tuna-df84bfdd5f778122a8154a9de015911b75a4250c.zip
device_samsung_tuna-df84bfdd5f778122a8154a9de015911b75a4250c.tar.gz
device_samsung_tuna-df84bfdd5f778122a8154a9de015911b75a4250c.tar.bz2
audio: don't put output in standby when changing route
The OMAP4 ALSA kernel code can now handle output routing changes when the PCM is opened. This avoids pops when closing PCMs to change the route between speaker and headset for example, and makes a noticeable difference when notifications occur when playing music. Change-Id: I957d96fae6764a3049d4f3c00074a9295a18d66d
Diffstat (limited to 'audio')
-rw-r--r--audio/audio_hw.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/audio/audio_hw.c b/audio/audio_hw.c
index 1ecf92a..df90985 100644
--- a/audio/audio_hw.c
+++ b/audio/audio_hw.c
@@ -661,14 +661,7 @@ static void set_input_volumes(struct tuna_audio_device *adev, int main_mic_on,
static void force_all_standby(struct tuna_audio_device *adev)
{
struct tuna_stream_in *in;
- struct tuna_stream_out *out;
- if (adev->active_output) {
- out = adev->active_output;
- pthread_mutex_lock(&out->lock);
- do_output_standby(out);
- pthread_mutex_unlock(&out->lock);
- }
if (adev->active_input) {
in = adev->active_input;
pthread_mutex_lock(&in->lock);
@@ -1146,18 +1139,16 @@ static int out_set_parameters(struct audio_stream *stream, const char *kvpairs)
pthread_mutex_lock(&out->lock);
if ((out->device != val) && (val != 0)) {
out->device = val;
- if (adev->mode == AUDIO_MODE_IN_CALL) {
- adev->devices &= ~AUDIO_DEVICE_OUT_ALL;
- adev->devices |= out->device;
- select_output_device(adev);
- } else if (out == adev->active_output) {
- do_output_standby(out);
+ if (out == adev->active_output) {
/* a change in output device may change the microphone selection */
if (adev->active_input &&
adev->active_input->source == AUDIO_SOURCE_VOICE_COMMUNICATION) {
force_input_standby = true;
}
}
+ adev->devices &= ~AUDIO_DEVICE_OUT_ALL;
+ adev->devices |= out->device;
+ select_output_device(adev);
}
pthread_mutex_unlock(&out->lock);
if (force_input_standby) {
@@ -1956,6 +1947,14 @@ static int adev_open_output_stream(struct audio_hw_device *dev,
out->dev = ladev;
out->standby = 1;
+ /* FIXME: when we support multiple output devices, we will want to
+ * do the following:
+ * adev->devices &= ~AUDIO_DEVICE_OUT_ALL;
+ * adev->devices |= out->device;
+ * select_output_device(adev);
+ * This is because out_set_parameters() with a route is not
+ * guaranteed to be called after an output stream is opened. */
+
*format = out_get_format(&out->stream.common);
*channels = out_get_channels(&out->stream.common);
*sample_rate = out_get_sample_rate(&out->stream.common);