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
commitd84a8f8c1b3348372fef2c1da743af0cbaefd2d8 (patch)
treeffeb58c51eb05bf60e35ad379f917f4b7ce6b5b8 /audio
parent5e572914bdaad1c8383cfeb309231233c8a083f5 (diff)
downloaddevice_samsung_tuna-d84a8f8c1b3348372fef2c1da743af0cbaefd2d8.zip
device_samsung_tuna-d84a8f8c1b3348372fef2c1da743af0cbaefd2d8.tar.gz
device_samsung_tuna-d84a8f8c1b3348372fef2c1da743af0cbaefd2d8.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) {