Merge "Fixed 4515636: Playback stops short of end of video." into honeycomb-mr2

This commit is contained in:
Jeff Tinker
2011-06-08 18:12:12 -07:00
committed by Android (Google) Code Review

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