diff --git a/proprietary/wvm/WVMMediaSource.cpp b/proprietary/wvm/WVMMediaSource.cpp index 4c93d03d..3c454ed1 100644 --- a/proprietary/wvm/WVMMediaSource.cpp +++ b/proprietary/wvm/WVMMediaSource.cpp @@ -24,6 +24,7 @@ static void _cb(int code) } status_t WVMMediaSource::sLastError = NO_ERROR; +int64_t WVMMediaSource::sLastSeekTimeUs = -1; WVMMediaSource::WVMMediaSource(WVSession *session, WVEsSelector esSelector, const sp &metaData, bool isLive, @@ -36,6 +37,7 @@ WVMMediaSource::WVMMediaSource(WVSession *session, WVEsSelector esSelector, mNewSegment(false), mCryptoInitialized(false), mStripADTS(false), + mCryptoPluginMode(cryptoPluginMode), mGroup(NULL), mKeyTime(0), mDts(0), @@ -243,15 +245,25 @@ status_t WVMMediaSource::read(MediaBuffer **buffer, const ReadOptions *options) // prior to the specified time. seekNextSync = true; } else { - // Let video stream control seek - if (mESSelector == WV_EsSelector_Video) { + // If we are not in Crypto Plugin Mode, let the video stream + // control the seek. + // If we are in Crypto Plugin Mode, obey the first seek we get to a + // given point, then ignore the subsequent one. + if ((!mCryptoPluginMode && mESSelector == WV_EsSelector_Video) || + (mCryptoPluginMode && seekTimeUs != sLastSeekTimeUs)) { float scaleUsed; std::string when = usecToNPT(seekTimeUs) + std::string("-"); + WVStatus result = WV_Play(mSession, 1.0, &scaleUsed, when ); + if (result != WV_Status_OK) { ALOGE("WV_Play returned status %d in WVMMediaSource::read\n", result); return ERROR_IO; } + + sLastSeekTimeUs = seekTimeUs; + } else if (mCryptoPluginMode) { + sLastSeekTimeUs = -1; } } } diff --git a/proprietary/wvm/include/WVMMediaSource.h b/proprietary/wvm/include/WVMMediaSource.h index 5ab34318..66e57ad8 100644 --- a/proprietary/wvm/include/WVMMediaSource.h +++ b/proprietary/wvm/include/WVMMediaSource.h @@ -26,7 +26,8 @@ class WVMFileSource; class WVMMediaSource : public MediaSource { public: WVMMediaSource(WVSession *session, WVEsSelector esSelector, - const sp &metaData, bool isLive, bool cryptoPluginMode); + const sp &metaData, bool isLive, + bool cryptoPluginMode); void delegateFileSource(sp fileSource); void delegateDataSource(sp dataSource); @@ -76,6 +77,7 @@ protected: private: Mutex mLock; + static int64_t sLastSeekTimeUs; WVSession *mSession; WVEsSelector mESSelector; // indicates audio vs. video @@ -88,6 +90,7 @@ private: bool mNewSegment; bool mCryptoInitialized; bool mStripADTS; + bool mCryptoPluginMode; MediaBufferGroup *mGroup;