Merge "When Running in MediaCodec Mode, Widevine Freezes If You Rewind" into jb-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
b092b158d2
@@ -2,6 +2,7 @@
|
|||||||
* Copyright (C) 2011 Google, Inc. All Rights Reserved
|
* Copyright (C) 2011 Google, Inc. All Rights Reserved
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
//#define LOG_NDEBUG 0
|
||||||
#define LOG_TAG "WVMMediaSource"
|
#define LOG_TAG "WVMMediaSource"
|
||||||
#include <utils/Log.h>
|
#include <utils/Log.h>
|
||||||
|
|
||||||
@@ -24,6 +25,7 @@ static void _cb(int code)
|
|||||||
}
|
}
|
||||||
|
|
||||||
status_t WVMMediaSource::sLastError = NO_ERROR;
|
status_t WVMMediaSource::sLastError = NO_ERROR;
|
||||||
|
int64_t WVMMediaSource::mLastSeekTimeUs = -1;
|
||||||
|
|
||||||
WVMMediaSource::WVMMediaSource(WVSession *session, WVEsSelector esSelector,
|
WVMMediaSource::WVMMediaSource(WVSession *session, WVEsSelector esSelector,
|
||||||
const sp<MetaData> &metaData, bool isLive,
|
const sp<MetaData> &metaData, bool isLive,
|
||||||
@@ -246,8 +248,10 @@ status_t WVMMediaSource::read(MediaBuffer **buffer, const ReadOptions *options)
|
|||||||
// prior to the specified time.
|
// prior to the specified time.
|
||||||
seekNextSync = true;
|
seekNextSync = true;
|
||||||
} else {
|
} else {
|
||||||
// Let video stream control seek
|
// Whichever stream gets the seek first should do the actual seeking.
|
||||||
if (mESSelector == WV_EsSelector_Video) {
|
// To keep from double-seeking, we share the information about who
|
||||||
|
// has seeked most recently.
|
||||||
|
if (mLastSeekTimeUs != seekTimeUs) {
|
||||||
float scaleUsed;
|
float scaleUsed;
|
||||||
std::string when = usecToNPT(seekTimeUs) + std::string("-");
|
std::string when = usecToNPT(seekTimeUs) + std::string("-");
|
||||||
WVStatus result = WV_Play(mSession, 1.0, &scaleUsed, when );
|
WVStatus result = WV_Play(mSession, 1.0, &scaleUsed, when );
|
||||||
@@ -255,6 +259,11 @@ status_t WVMMediaSource::read(MediaBuffer **buffer, const ReadOptions *options)
|
|||||||
ALOGE("WV_Play returned status %d in WVMMediaSource::read\n", result);
|
ALOGE("WV_Play returned status %d in WVMMediaSource::read\n", result);
|
||||||
return ERROR_IO;
|
return ERROR_IO;
|
||||||
}
|
}
|
||||||
|
mLastSeekTimeUs = seekTimeUs;
|
||||||
|
} else {
|
||||||
|
// Now that both video and audio were seeked, clear the shared
|
||||||
|
// data.
|
||||||
|
mLastSeekTimeUs = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,17 +69,16 @@ public:
|
|||||||
memcpy(mCryptoPluginKey, key, sizeof(mCryptoPluginKey));
|
memcpy(mCryptoPluginKey, key, sizeof(mCryptoPluginKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
|
||||||
DecryptContext mDecryptContext;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~WVMMediaSource();
|
virtual ~WVMMediaSource();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
static int64_t mLastSeekTimeUs;
|
||||||
Mutex mLock;
|
Mutex mLock;
|
||||||
|
|
||||||
WVSession *mSession;
|
WVSession *mSession;
|
||||||
WVEsSelector mESSelector; // indicates audio vs. video
|
WVEsSelector mESSelector; // indicates audio vs. video
|
||||||
|
DecryptContext mDecryptContext;
|
||||||
|
|
||||||
sp<MetaData> mTrackMetaData;
|
sp<MetaData> mTrackMetaData;
|
||||||
|
|
||||||
@@ -94,6 +93,7 @@ private:
|
|||||||
MediaBufferGroup *mGroup;
|
MediaBufferGroup *mGroup;
|
||||||
|
|
||||||
int64_t mKeyTime;
|
int64_t mKeyTime;
|
||||||
|
|
||||||
unsigned long long mDts;
|
unsigned long long mDts;
|
||||||
unsigned long long mPts;
|
unsigned long long mPts;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user