From 7f3bb5ad9dfb30388b69166e58391ff3aa6f00a3 Mon Sep 17 00:00:00 2001 From: Robert Shih Date: Mon, 27 Jul 2015 17:02:53 -0700 Subject: HLS: preserve old format in onChangeConfiguration2 `onChangeConfiguration2` is only called during seek. Bug: 22698650 Change-Id: I715fa51d04d503f49d678eaea08f2b63dce4e01e --- media/libstagefright/httplive/LiveSession.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'media/libstagefright/httplive/LiveSession.cpp') diff --git a/media/libstagefright/httplive/LiveSession.cpp b/media/libstagefright/httplive/LiveSession.cpp index 2fc5135..1557401 100644 --- a/media/libstagefright/httplive/LiveSession.cpp +++ b/media/libstagefright/httplive/LiveSession.cpp @@ -1657,7 +1657,16 @@ void LiveSession::onChangeConfiguration2(const sp &msg) { mLastDequeuedTimeUs = timeUs; for (size_t i = 0; i < mPacketSources.size(); i++) { - mPacketSources.editValueAt(i)->clear(); + sp packetSource = mPacketSources.editValueAt(i); + sp format = packetSource->getFormat(); + packetSource->clear(); + // Set a tentative format here such that HTTPLiveSource will always have + // a format available when NuPlayer queries. Without an available video + // format when setting a surface NuPlayer might disable video decoding + // altogether. The tentative format will be overwritten by the + // authoritative (and possibly same) format once content from the new + // position is dequeued. + packetSource->setFormat(format); } for (size_t i = 0; i < kMaxStreams; ++i) { -- cgit v1.1