From 895651b07fec30b0f9b0d2499599a179d95c9be4 Mon Sep 17 00:00:00 2001 From: Wei Jia Date: Wed, 10 Dec 2014 17:31:52 -0800 Subject: NuPlayer: send NOT_SEEKABLE media info to client when the source is not seekable. LiveSession: return -1 for duration when it's not available. Bug: 18599325 Change-Id: Iecd040f48750806f98d1799e2aaab2f90c6f3887 --- media/libmediaplayerservice/nuplayer/NuPlayer.cpp | 4 ++++ media/libstagefright/httplive/LiveSession.cpp | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'media') diff --git a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp index d433a4d..82d0d5b 100644 --- a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp +++ b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp @@ -1667,6 +1667,10 @@ void NuPlayer::onSourceNotify(const sp &msg) { sp driver = mDriver.promote(); if (driver != NULL) { + if ((flags & NuPlayer::Source::FLAG_CAN_SEEK) == 0) { + driver->notifyListener( + MEDIA_INFO, MEDIA_INFO_NOT_SEEKABLE, 0); + } driver->notifyFlagsChanged(flags); } diff --git a/media/libstagefright/httplive/LiveSession.cpp b/media/libstagefright/httplive/LiveSession.cpp index 5eb4652..0b18666 100644 --- a/media/libstagefright/httplive/LiveSession.cpp +++ b/media/libstagefright/httplive/LiveSession.cpp @@ -1109,11 +1109,11 @@ status_t LiveSession::onSeek(const sp &msg) { } status_t LiveSession::getDuration(int64_t *durationUs) const { - int64_t maxDurationUs = 0ll; + int64_t maxDurationUs = -1ll; for (size_t i = 0; i < mFetcherInfos.size(); ++i) { int64_t fetcherDurationUs = mFetcherInfos.valueAt(i).mDurationUs; - if (fetcherDurationUs >= 0ll && fetcherDurationUs > maxDurationUs) { + if (fetcherDurationUs > maxDurationUs) { maxDurationUs = fetcherDurationUs; } } -- cgit v1.1