NuPlayerRenderer: only query audio sink for position for the first entry.
Bug: 17035257
Change-Id: I472ec4610e1174c59986f42d72fe55f90e93731e
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp
index 3640038..3777f64 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp
@@ -318,6 +318,7 @@
bool hasEOS = false;
size_t sizeCopied = 0;
+ bool firstEntry = true;
while (sizeCopied < size && !mAudioQueue.empty()) {
QueueEntry *entry = &*mAudioQueue.begin();
@@ -328,14 +329,14 @@
break;
}
- if (entry->mOffset == 0) {
+ if (firstEntry && entry->mOffset == 0) {
+ firstEntry = false;
int64_t mediaTimeUs;
CHECK(entry->mBuffer->meta()->findInt64("timeUs", &mediaTimeUs));
ALOGV("rendering audio at media time %.2f secs", mediaTimeUs / 1E6);
if (mFirstAudioTimeUs == -1) {
mFirstAudioTimeUs = mediaTimeUs;
}
- mAnchorTimeMediaUs = mediaTimeUs;
uint32_t numFramesPlayed;
CHECK_EQ(mAudioSink->getPosition(&numFramesPlayed), (status_t)OK);