am b83e7ca1: Merge "Fix pause at end of movie." into jb-dev
* commit 'b83e7ca14ab7241c1bbfb50dd6d97edf160f2b74': Fix pause at end of movie.
This commit is contained in:
@@ -98,6 +98,7 @@ WVMExtractorImpl::WVMExtractorImpl(sp<DataSource> dataSource)
|
||||
mUseAdaptiveStreaming(false),
|
||||
mIsLiveStream(false),
|
||||
mSession(NULL),
|
||||
mDuration(0),
|
||||
mSetupStatus(OK)
|
||||
{
|
||||
dataSource->getDrmInfo(sDecryptHandle, &sDrmManagerClient);
|
||||
@@ -272,13 +273,13 @@ status_t WVMExtractorImpl::readMetaData()
|
||||
return ERROR_MALFORMED;
|
||||
}
|
||||
|
||||
int64_t duration = (int64_t)(strtod(durationString.c_str(), NULL) * 1000000);
|
||||
mDuration = (int64_t)(strtod(durationString.c_str(), NULL) * 1000000);
|
||||
|
||||
sp<MetaData> audioMetaData = new MetaData();
|
||||
sp<MetaData> videoMetaData = new MetaData();
|
||||
|
||||
audioMetaData->setInt64(kKeyDuration, duration);
|
||||
videoMetaData->setInt64(kKeyDuration, duration);
|
||||
audioMetaData->setInt64(kKeyDuration, mDuration);
|
||||
videoMetaData->setInt64(kKeyDuration, mDuration);
|
||||
|
||||
audioMetaData->setInt32(kKeyBitRate, audioBitRate);
|
||||
videoMetaData->setInt32(kKeyBitRate, videoBitRate);
|
||||
@@ -505,11 +506,28 @@ int64_t WVMExtractorImpl::getCachedDurationUs(status_t *finalStatus) {
|
||||
} else if (status != WV_Status_OK) {
|
||||
*finalStatus = ERROR_IO;
|
||||
} else {
|
||||
if (mIsLiveStream)
|
||||
*finalStatus = ERROR_END_OF_STREAM;
|
||||
else
|
||||
*finalStatus = OK;
|
||||
durationUs = (uint64_t)(secondsBuffered * 1000000LL);
|
||||
|
||||
if (mIsLiveStream) {
|
||||
*finalStatus = ERROR_END_OF_STREAM;
|
||||
} else {
|
||||
*finalStatus = OK;
|
||||
int64_t current_time = 0; // usec.
|
||||
if (mVideoSource != NULL) {
|
||||
current_time = mVideoSource->getTime();
|
||||
} else {
|
||||
ALOGV("getCachedDurationUs: current_time not yet valid.");
|
||||
}
|
||||
|
||||
// ALOGD("current_time=%.2f, duration %.2f, delta = %.2f, buffered=%.2f",
|
||||
// current_time/1e6, mDuration/1e6,
|
||||
// (mDuration - current_time )/1e6, time_buffered);
|
||||
|
||||
// If we are less than 10 seconds from end, report we are at the end.
|
||||
if (mDuration > 0 && mDuration - current_time < 10000000) {
|
||||
*finalStatus = ERROR_END_OF_STREAM;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Scale the duration to account for Stagefright's conservative buffering.
|
||||
|
||||
Reference in New Issue
Block a user