Squashed commit of the following:
commit f4edf442741886cdbe071e2d15f6e6247269f7c5
Author: Andreas Huber <andih@google.com>
Date: Tue Mar 12 09:09:18 2013 -0700
Pass additional flags to the sink, use TCP by default in wolfiecast mode.
Change-Id: I41e11a2375d4199656e45c4f149d8441d0016092
commit 6302602ed280a38287f507159abfb40a1da38c5a
Author: Andreas Huber <andih@google.com>
Date: Tue Mar 12 08:51:58 2013 -0700
tweaks
Change-Id: Ie29e422d7258be522f4bb1f6c5afcf74c937e547
commit a38a860e4979ba563cadbaafa21b084439449d26
Author: Andreas Huber <andih@google.com>
Date: Mon Mar 11 16:57:43 2013 -0700
Report average lateness all the way from NuPlayerRenderer...
Change-Id: I2e7700703ae656515e44b9c25610d26c75778111
commit a7d49b11675ea88be4029dd8451d1649db94571d
Author: Andreas Huber <andih@google.com>
Date: Mon Mar 11 14:54:19 2013 -0700
Make TimeSyncer smarter, enable TunnelRenderer
Change-Id: I27377a60cd8feb01589da456967fddd34532c20e
commit 0f214c8ef68179f7b61512c37040939554013151
Author: Andreas Huber <andih@google.com>
Date: Thu Mar 7 15:57:56 2013 -0800
convert source timestamps to sink timestamps, report lateness.
Change-Id: I051a60fbbceca2f7b508ae3dac6e01e402bae39e
commit 04a4f8e16bad09157b5615a5fa45310438955832
Author: Andreas Huber <andih@google.com>
Date: Thu Mar 7 09:00:28 2013 -0800
Sync time between sink and source.
Change-Id: Ie8b4d75c957aa48310e7c81d1279761b9f821efe
commit aebe20e6184e3636a99082f8ece08e708015cb8d
Author: Andreas Huber <andih@google.com>
Date: Wed Mar 6 09:03:12 2013 -0800
play with back pressure
Change-Id: I51eb69257e6a79e76f5f9c75ff99d8adbd083947
Change-Id: Ifdf57228667fed7fc71c5090a2c3f7cea1037c5c
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp
index 1ba76a5..404b56f 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp
@@ -31,9 +31,11 @@
NuPlayer::Renderer::Renderer(
const sp<MediaPlayerBase::AudioSink> &sink,
- const sp<AMessage> ¬ify)
+ const sp<AMessage> ¬ify,
+ uint32_t flags)
: mAudioSink(sink),
mNotify(notify),
+ mFlags(flags),
mNumFramesWritten(0),
mDrainAudioQueuePending(false),
mDrainVideoQueuePending(false),
@@ -323,6 +325,11 @@
if (entry.mBuffer == NULL) {
// EOS doesn't carry a timestamp.
delayUs = 0;
+ } else if (mFlags & FLAG_REAL_TIME) {
+ int64_t mediaTimeUs;
+ CHECK(entry.mBuffer->meta()->findInt64("timeUs", &mediaTimeUs));
+
+ delayUs = mediaTimeUs - ALooper::GetNowUs();
} else {
int64_t mediaTimeUs;
CHECK(entry.mBuffer->meta()->findInt64("timeUs", &mediaTimeUs));
@@ -368,12 +375,17 @@
return;
}
- int64_t mediaTimeUs;
- CHECK(entry->mBuffer->meta()->findInt64("timeUs", &mediaTimeUs));
+ int64_t realTimeUs;
+ if (mFlags & FLAG_REAL_TIME) {
+ CHECK(entry->mBuffer->meta()->findInt64("timeUs", &realTimeUs));
+ } else {
+ int64_t mediaTimeUs;
+ CHECK(entry->mBuffer->meta()->findInt64("timeUs", &mediaTimeUs));
- int64_t realTimeUs = mediaTimeUs - mAnchorTimeMediaUs + mAnchorTimeRealUs;
+ realTimeUs = mediaTimeUs - mAnchorTimeMediaUs + mAnchorTimeRealUs;
+ }
+
mVideoLateByUs = ALooper::GetNowUs() - realTimeUs;
-
bool tooLate = (mVideoLateByUs > 40000);
if (tooLate) {