summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2012-06-11 12:36:38 -0700
committerEric Laurent <elaurent@google.com>2012-06-11 14:32:11 -0700
commit2fc28c81f0659efe02540248ac954cf9412c1071 (patch)
treed54f916df3200e8330868e50616acf60d0ae01de /audio
parent445a292e68dde4b3854dbc42f0df1e0f3f265fc6 (diff)
downloaddevice_samsung_tuna-2fc28c81f0659efe02540248ac954cf9412c1071.zip
device_samsung_tuna-2fc28c81f0659efe02540248ac954cf9412c1071.tar.gz
device_samsung_tuna-2fc28c81f0659efe02540248ac954cf9412c1071.tar.bz2
audio: workaround for hdmi multi channel swap
Workaround for HDMI multi channel channel swap on first playback after opening the output stream: force re-opening the HDMI pcm driver after writing a few periods. Bug 4282214. Change-Id: Ibe1452a8905a27bc3f95564a45cfb9bb490b65ae
Diffstat (limited to 'audio')
-rw-r--r--audio/audio_hw.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/audio/audio_hw.c b/audio/audio_hw.c
index fb5a423..85cfc7b 100644
--- a/audio/audio_hw.c
+++ b/audio/audio_hw.c
@@ -680,6 +680,10 @@ struct tuna_stream_out {
audio_channel_mask_t channel_mask;
audio_channel_mask_t sup_channel_masks[3];
+ /* FIXME: workaround for HDMI multi channel channel swap on first playback after opening
+ * the output stream: force reopening the pcm driver after writing a few periods. */
+ int restart_periods_cnt;
+
struct tuna_audio_device *dev;
};
@@ -2123,6 +2127,11 @@ exit:
usleep(bytes * 1000000 / audio_stream_frame_size(&stream->common) /
out_get_sample_rate_hdmi(&stream->common));
}
+ /* FIXME: workaround for HDMI multi channel channel swap on first playback after opening
+ * the output stream: force reopening the pcm driver after writing a few periods. */
+ if ((out->restart_periods_cnt > 0) &&
+ (--out->restart_periods_cnt == 0))
+ out_standby(&stream->common);
return bytes;
}
@@ -3232,6 +3241,8 @@ static int adev_open_output_stream(struct audio_hw_device *dev,
out->config[PCM_HDMI] = pcm_config_hdmi_multi;
out->config[PCM_HDMI].rate = config->sample_rate;
out->config[PCM_HDMI].channels = popcount(config->channel_mask);
+ /* FIXME: workaround for channel swap on first playback after opening the output */
+ out->restart_periods_cnt = out->config[PCM_HDMI].period_count * 2;
} else if (flags & AUDIO_OUTPUT_FLAG_DEEP_BUFFER) {
ALOGV("adev_open_output_stream() deep buffer");
if (ladev->outputs[OUTPUT_DEEP_BUF] != NULL) {