summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2012-06-13 12:29:57 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-06-13 12:29:57 -0700
commit10c8a1ec2aac3b909165d2393548d2c2e230c26a (patch)
tree849a4a8525b33a25c6f5d03e674fa3c163d70bf3
parent3cbd1d47f583805d20dd029b37f1cd42b2603b43 (diff)
parentd84a8f8c1b3348372fef2c1da743af0cbaefd2d8 (diff)
downloaddevice_samsung_tuna-10c8a1ec2aac3b909165d2393548d2c2e230c26a.zip
device_samsung_tuna-10c8a1ec2aac3b909165d2393548d2c2e230c26a.tar.gz
device_samsung_tuna-10c8a1ec2aac3b909165d2393548d2c2e230c26a.tar.bz2
Merge "audio: workaround for hdmi multi channel swap" into jb-dev
-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) {