Fix pause at end of movie.
The function WVMExtractorImpl::getCachedDurationUs returns the cached buffer size in microseconds, and sets a status to ERROR_END_OF_STREAM at the end of the movie. The AwesomePlayer will pause if the cache is too small and the status is not EOS. In bug 6277231, the player would pause just before the EOS marker would have been seen by the Widevine library. This change checks the current play time against the total movie duration. If there is less than 10 seconds left in the movie, the EOS flag is set. related-to-bug: 6277231 Change-Id: I8dbf60c82c41df485185f85e72452aab0a6a9686
This commit is contained in:
@@ -36,6 +36,7 @@ WVMMediaSource::WVMMediaSource(WVSession *session, WVEsSelector esSelector,
|
||||
mNewSegment(false),
|
||||
mCryptoInitialized(false),
|
||||
mGroup(NULL),
|
||||
mKeyTime(0),
|
||||
mDts(0),
|
||||
mPts(0)
|
||||
{
|
||||
@@ -263,7 +264,6 @@ status_t WVMMediaSource::read(MediaBuffer **buffer, const ReadOptions *options)
|
||||
size_t bytesRead;
|
||||
bool auStart;
|
||||
size_t offset = 0;
|
||||
int64_t keyTime;
|
||||
|
||||
bool syncFrame;
|
||||
int retryCount = 0;
|
||||
@@ -338,9 +338,9 @@ status_t WVMMediaSource::read(MediaBuffer **buffer, const ReadOptions *options)
|
||||
}
|
||||
|
||||
#define PCR_HZ 90000
|
||||
keyTime = (int64_t)mPts * 1000000 / PCR_HZ;
|
||||
mKeyTime = (int64_t)mPts * 1000000 / PCR_HZ;
|
||||
|
||||
if (seekNextSync && ((keyTime < seekTimeUs) || !syncFrame)) {
|
||||
if (seekNextSync && ((mKeyTime < seekTimeUs) || !syncFrame)) {
|
||||
// drop frames up to next sync if requested
|
||||
usleep(10000);
|
||||
#ifdef REQUIRE_SECURE_BUFFERS
|
||||
@@ -380,7 +380,7 @@ status_t WVMMediaSource::read(MediaBuffer **buffer, const ReadOptions *options)
|
||||
}
|
||||
|
||||
mediaBuf->meta_data()->clear();
|
||||
mediaBuf->meta_data()->setInt64(kKeyTime, keyTime);
|
||||
mediaBuf->meta_data()->setInt64(kKeyTime, mKeyTime);
|
||||
|
||||
mediaBuf->set_range(0, bytesRead + offset);
|
||||
|
||||
@@ -414,7 +414,7 @@ status_t WVMMediaSource::read(MediaBuffer **buffer, const ReadOptions *options)
|
||||
#if 0
|
||||
ALOGD("[%p] %s packet length=%d kKeyTime=%lld %s\n", mediaBuf,
|
||||
(mESSelector == WV_EsSelector_Video ? "video" : "audio"),
|
||||
bytesRead + offset, keyTime, syncFrame ? "sync" : "");
|
||||
bytesRead + offset, mKeyTime, syncFrame ? "sync" : "");
|
||||
#endif
|
||||
|
||||
*buffer = mediaBuf;
|
||||
|
||||
Reference in New Issue
Block a user