diff --git a/proprietary/drmwvmplugin/lib/libwvdrm.so b/proprietary/drmwvmplugin/lib/libwvdrm.so index 0e18167c..1a493361 100644 Binary files a/proprietary/drmwvmplugin/lib/libwvdrm.so and b/proprietary/drmwvmplugin/lib/libwvdrm.so differ diff --git a/proprietary/samplePlayer/src/com/widevine/demo/ConfigXMLParser.java b/proprietary/samplePlayer/src/com/widevine/demo/ConfigXMLParser.java index f91b575b..8d5c2d90 100644 --- a/proprietary/samplePlayer/src/com/widevine/demo/ConfigXMLParser.java +++ b/proprietary/samplePlayer/src/com/widevine/demo/ConfigXMLParser.java @@ -54,6 +54,7 @@ public class ConfigXMLParser { public void end() { if (currentAssetDescriptor.getUri().indexOf(".wvm") != -1 || currentAssetDescriptor.getUri().indexOf(".ts") != -1 + || currentAssetDescriptor.getUri().indexOf(".m3u8") != -1 || !currentAssetDescriptor.getUri().substring(currentAssetDescriptor .getUri().lastIndexOf("/")).contains(".")) { assetDescriptors.add(currentAssetDescriptor.copy()); diff --git a/proprietary/samplePlayer/src/com/widevine/demo/DownloadActivity.java b/proprietary/samplePlayer/src/com/widevine/demo/DownloadActivity.java index fa18700a..3551b6c4 100644 --- a/proprietary/samplePlayer/src/com/widevine/demo/DownloadActivity.java +++ b/proprietary/samplePlayer/src/com/widevine/demo/DownloadActivity.java @@ -38,7 +38,8 @@ public class DownloadActivity extends AssetActivity { File file = new File(dir.getAbsolutePath() + File.separator + name); if (!file.isDirectory() && !name.equals("curl") - && (name.contains(".wvm") || name.contains(".ts") || name.contains(".mp4") || !name.contains("."))) + && (name.contains(".wvm") || name.contains(".ts") || name.contains(".mp4") || + name.contains(".m3u8") | !name.contains("."))) return true; else return false; diff --git a/proprietary/streamcontrol/lib/libWVStreamControlAPI.so b/proprietary/streamcontrol/lib/libWVStreamControlAPI.so index dd6378a9..2ec7db1f 100644 Binary files a/proprietary/streamcontrol/lib/libWVStreamControlAPI.so and b/proprietary/streamcontrol/lib/libWVStreamControlAPI.so differ diff --git a/proprietary/wvm/WVMExtractorImpl.cpp b/proprietary/wvm/WVMExtractorImpl.cpp index 44cd8bfb..25e44ec6 100644 --- a/proprietary/wvm/WVMExtractorImpl.cpp +++ b/proprietary/wvm/WVMExtractorImpl.cpp @@ -249,6 +249,15 @@ status_t WVMExtractorImpl::readMetaData() videoMetaData->setInt32(kKeyWidth, width); videoMetaData->setInt32(kKeyHeight, height); + if (mIsLiveStream) { + float scaleUsed; + result = WV_Play(mSession, 1.0, &scaleUsed, "npt=now-"); + if (result != WV_Status_OK) { + LOGE("WV_Play for live stream setup failed: %d", result); + return ERROR_IO; + } + } + status_t status; status = readAVCCMetaData(videoMetaData); @@ -259,8 +268,15 @@ status_t WVMExtractorImpl::readMetaData() if (status != OK) return status; - mAudioSource = new WVMMediaSource(mSession, WV_EsSelector_Audio, audioMetaData); - mVideoSource = new WVMMediaSource(mSession, WV_EsSelector_Video, videoMetaData); + if (mIsLiveStream) { + result = WV_Pause(mSession, ""); + if (result != WV_Status_OK) { + LOGE("WV_Pause for live stream setup failed: %d", result); + } + } + + mAudioSource = new WVMMediaSource(mSession, WV_EsSelector_Audio, audioMetaData, mIsLiveStream); + mVideoSource = new WVMMediaSource(mSession, WV_EsSelector_Video, videoMetaData, mIsLiveStream); // Since the WVExtractor goes away soon after this, we delegate ownership of some resources // to the constructed media source @@ -284,7 +300,7 @@ status_t WVMExtractorImpl::readAVCCMetaData(sp videoMetaData) const unsigned char *config; unsigned long size; - int limit = 50; + int limit = 500; do { size_t bytesRead; bool auStart, sync; @@ -301,7 +317,7 @@ status_t WVMExtractorImpl::readAVCCMetaData(sp videoMetaData) result = WV_Info_GetCodecConfig(mSession, WV_CodecConfigType_AVCC, config, size); if (result != WV_Status_OK) - usleep(100); + usleep(10000); } while (result == WV_Status_Warning_Not_Available && limit-- > 0); if (result != WV_Status_OK) { @@ -330,7 +346,7 @@ status_t WVMExtractorImpl::readESDSMetaData(sp audioMetaData) const unsigned char *config; unsigned long size; - int limit = 50; + int limit = 500; do { size_t bytesRead; bool auStart, sync; @@ -347,7 +363,7 @@ status_t WVMExtractorImpl::readESDSMetaData(sp audioMetaData) result = WV_Info_GetCodecConfig(mSession, WV_CodecConfigType_ESDS, config, size); if (result != WV_Status_OK) - usleep(100); + usleep(10000); } while (result == WV_Status_Warning_Not_Available && limit-- > 0); if (result != WV_Status_OK) { diff --git a/proprietary/wvm/WVMMediaSource.cpp b/proprietary/wvm/WVMMediaSource.cpp index c3d05de6..d3b885e5 100644 --- a/proprietary/wvm/WVMMediaSource.cpp +++ b/proprietary/wvm/WVMMediaSource.cpp @@ -36,11 +36,13 @@ static void _cb(int code) status_t WVMMediaSource::sLastError = NO_ERROR; WVMMediaSource::WVMMediaSource(WVSession *session, WVEsSelector esSelector, - const sp &metaData) + const sp &metaData, bool isLive) : mSession(session), mESSelector(esSelector), mTrackMetaData(metaData), mStarted(false), + mIsLiveStream(isLive), + mNewSegment(false), mGroup(NULL), mDts(0), mPts(0) @@ -88,6 +90,7 @@ status_t WVMMediaSource::start(MetaData *) allocBufferGroup(); + mNewSegment = true; mStarted = true; mLogOnce = true; @@ -157,6 +160,15 @@ status_t WVMMediaSource::read(MediaBuffer **buffer, const ReadOptions *options) *buffer = NULL; bool seekNextSync = false; +#if 0 + // The sync bits aren't working right yet on live streams, so need to disable this + // for now. + if (mIsLiveStream && mNewSegment && (mESSelector == WV_EsSelector_Video)) { + seekNextSync = true; + mNewSegment = false; + } +#endif + int64_t seekTimeUs; int retryLimit = 500; // Limit on number of retries before timeout, 10ms per retry @@ -332,9 +344,9 @@ status_t WVMMediaSource::read(MediaBuffer **buffer, const ReadOptions *options) #endif #if 0 - LOGD("[%p] %s set range_length=%d, get range_length=%d kKeyTime=%lld sync=%d\n", mediaBuf, + LOGD("[%p] %s packet length=%d kKeyTime=%lld %s\n", mediaBuf, (mESSelector == WV_EsSelector_Video ? "video" : "audio"), - bytesRead + offset, mediaBuf->range_length(), keyTime, syncFrame); + bytesRead + offset, keyTime, syncFrame ? "sync" : ""); #endif *buffer = mediaBuf; diff --git a/proprietary/wvm/include/WVMMediaSource.h b/proprietary/wvm/include/WVMMediaSource.h index b016f41d..eefac4ae 100644 --- a/proprietary/wvm/include/WVMMediaSource.h +++ b/proprietary/wvm/include/WVMMediaSource.h @@ -33,7 +33,7 @@ class WVMFileSource; class WVMMediaSource : public MediaSource { public: WVMMediaSource(WVSession *session, WVEsSelector esSelector, - const sp &metaData); + const sp &metaData, bool isLive); void delegateFileSource(sp fileSource); void delegateDataSource(sp dataSource); @@ -60,6 +60,8 @@ private: bool mStarted; bool mLogOnce; + bool mIsLiveStream; + bool mNewSegment; MediaBufferGroup *mGroup;