summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2014-10-28 21:42:25 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-10-28 21:42:26 +0000
commiteac3f36c5d22ca28890fe4258987ded5ac0666dc (patch)
treefb06d642c862c41776ee6605f51be9d644deb93b
parentaac745f29b0e8b18e9f9aff0d122c7d5d82f218a (diff)
parentd88c3cafb439367f2a245b625e0a74bcd785f099 (diff)
downloadframeworks_av-eac3f36c5d22ca28890fe4258987ded5ac0666dc.zip
frameworks_av-eac3f36c5d22ca28890fe4258987ded5ac0666dc.tar.gz
frameworks_av-eac3f36c5d22ca28890fe4258987ded5ac0666dc.tar.bz2
Merge "fix deep buffer logic in NuPlayer." into lmp-mr1-dev
-rw-r--r--media/libmediaplayerservice/nuplayer/NuPlayer.cpp2
-rw-r--r--media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp13
2 files changed, 8 insertions, 7 deletions
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
index a63a940..4a9d790 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp
@@ -1119,7 +1119,7 @@ void NuPlayer::openAudioSink(const sp<AMessage> &format, bool offloadOnly) {
// Current code will just make that we select deep buffer
// with video which should not be a problem as it should
// not prevent from keeping A/V sync.
- if (hasVideo &&
+ if (!hasVideo &&
mSource->getDuration(&durationUs) == OK &&
durationUs
> AUDIO_SINK_MIN_DEEP_BUFFER_DURATION_US) {
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp
index 86ce385..e0c5e18 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp
@@ -1374,8 +1374,9 @@ bool NuPlayer::Renderer::onOpenAudioSink(
return offloadingAudio();
}
ALOGV("openAudioSink: try to open AudioSink in offload mode");
- flags |= AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD;
- flags &= ~AUDIO_OUTPUT_FLAG_DEEP_BUFFER;
+ uint32_t offloadFlags = flags;
+ offloadFlags |= AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD;
+ offloadFlags &= ~AUDIO_OUTPUT_FLAG_DEEP_BUFFER;
audioSinkChanged = true;
mAudioSink->close();
err = mAudioSink->open(
@@ -1386,7 +1387,7 @@ bool NuPlayer::Renderer::onOpenAudioSink(
8 /* bufferCount */,
&NuPlayer::Renderer::AudioSinkCallback,
this,
- (audio_output_flags_t)flags,
+ (audio_output_flags_t)offloadFlags,
&offloadInfo);
if (err == OK) {
@@ -1410,9 +1411,9 @@ bool NuPlayer::Renderer::onOpenAudioSink(
}
}
if (!offloadOnly && !offloadingAudio()) {
- flags &= ~AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD;
ALOGV("openAudioSink: open AudioSink in NON-offload mode");
-
+ uint32_t pcmFlags = flags;
+ pcmFlags &= ~AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD;
audioSinkChanged = true;
mAudioSink->close();
mCurrentOffloadInfo = AUDIO_INFO_INITIALIZER;
@@ -1424,7 +1425,7 @@ bool NuPlayer::Renderer::onOpenAudioSink(
8 /* bufferCount */,
NULL,
NULL,
- (audio_output_flags_t)flags),
+ (audio_output_flags_t)pcmFlags),
(status_t)OK);
mAudioSink->start();
}