Fixed 4515636: Playback stops short of end of video.

Change-Id: I798fe266fa2fb09ed37e6cb559d87111c9e33639
This commit is contained in:
Edwin Wong
2011-06-08 18:05:17 -07:00
parent c3c294866b
commit bc9604da1f

View File

@@ -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;
}