From bc9604da1fde66c94b38039cbaed8b1c8a6aec2e Mon Sep 17 00:00:00 2001 From: Edwin Wong Date: Wed, 8 Jun 2011 18:05:17 -0700 Subject: [PATCH] Fixed 4515636: Playback stops short of end of video. Change-Id: I798fe266fa2fb09ed37e6cb559d87111c9e33639 --- proprietary/wvm/WVMExtractorImpl.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/proprietary/wvm/WVMExtractorImpl.cpp b/proprietary/wvm/WVMExtractorImpl.cpp index 9cdd5aa6..1b640924 100644 --- a/proprietary/wvm/WVMExtractorImpl.cpp +++ b/proprietary/wvm/WVMExtractorImpl.cpp @@ -458,6 +458,20 @@ int64_t WVMExtractorImpl::getCachedDurationUs(status_t *finalStatus) { if (status == WV_Status_OK) { *finalStatus = OK; durationUs = 8000000LL * bytesBuffered / encodedRates[currentTrack]; + + // Fixed 4515636 Playback stops 5-7 seconds before end of video, + // session isn't terminated. Awesome player pauses video if + // duration is less than 2 seconds (see kLowWaterMarkUs in + // AwesomePlayer.cpp); we return END_OF_STREAM when we have 2 + // seconds of data left and let WVMK handles the actual end of media. + std::string szDuration = WV_Info_GetDuration(mSession, "sec"); + std::string szCurrent = WV_Info_GetTime(mSession, "sec"); + + double duration = strtod(szDuration.c_str(), NULL); + double current = strtod(szCurrent.c_str(), NULL); + if ((duration - current) <= 2.00) { + *finalStatus = ERROR_END_OF_STREAM; + } } else if (status == WV_Status_End_Of_Media) { *finalStatus = ERROR_END_OF_STREAM; }