From 2a66207f1136d60857759bccbaa5b7612f7070cf Mon Sep 17 00:00:00 2001 From: Apurupa Pattapu Date: Thu, 4 Dec 2014 16:33:55 -0800 Subject: httplive: Create a copy of last enqueued metadata Create duplicate of metadata in queueAccessUnit so that it is available even after all the buffers are erased from packet source. During a bandwidth switch httplive streaming Source uses last enqueued timestamp as the start time for the new streams, and this switch can occur at a time when all the packets are dequeued from the current packet source. This is one of the scenarios when the last enqueued time was showing a invalid timestamp. Creating a copy will retain the timestamp value until the packet source is active. Bug: 18821145 Change-Id: I4d4ee700705cee58773da4660f8769f56018f9e4 --- media/libstagefright/mpeg2ts/AnotherPacketSource.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'media/libstagefright/mpeg2ts') diff --git a/media/libstagefright/mpeg2ts/AnotherPacketSource.cpp b/media/libstagefright/mpeg2ts/AnotherPacketSource.cpp index c579d4c..0354a2d 100644 --- a/media/libstagefright/mpeg2ts/AnotherPacketSource.cpp +++ b/media/libstagefright/mpeg2ts/AnotherPacketSource.cpp @@ -218,12 +218,12 @@ void AnotherPacketSource::queueAccessUnit(const sp &buffer) { } if (mLatestEnqueuedMeta == NULL) { - mLatestEnqueuedMeta = buffer->meta(); + mLatestEnqueuedMeta = buffer->meta()->dup(); } else { int64_t latestTimeUs = 0; CHECK(mLatestEnqueuedMeta->findInt64("timeUs", &latestTimeUs)); if (lastQueuedTimeUs > latestTimeUs) { - mLatestEnqueuedMeta = buffer->meta(); + mLatestEnqueuedMeta = buffer->meta()->dup(); } } } -- cgit v1.1