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

* commit '77856588ceebe02b72968c2e157b1c387ac7b6fa':
  Fixed 4515636: Playback stops short of end of video.
This commit is contained in:
Jeff Tinker
2011-06-09 13:42:28 -07:00
committed by Android Git Automerger

View File

@@ -466,6 +466,20 @@ int64_t WVMExtractorImpl::getCachedDurationUs(status_t *finalStatus) {
if (status == WV_Status_OK) { if (status == WV_Status_OK) {
*finalStatus = OK; *finalStatus = OK;
durationUs = 8000000LL * bytesBuffered / encodedRates[currentTrack]; 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) { } else if (status == WV_Status_End_Of_Media) {
*finalStatus = ERROR_END_OF_STREAM; *finalStatus = ERROR_END_OF_STREAM;
} }