diff options
Diffstat (limited to 'dom/media')
-rwxr-xr-x[-rw-r--r--] | dom/media/DOMMediaStream.cpp | 5 | ||||
-rw-r--r-- | dom/media/GraphDriver.cpp | 1 | ||||
-rw-r--r-- | dom/media/MediaData.cpp | 2 | ||||
-rw-r--r-- | dom/media/MediaDecoderOwner.h | 2 | ||||
-rw-r--r-- | dom/media/MediaFormatReader.cpp | 12 | ||||
-rw-r--r-- | dom/media/MediaPrefs.h | 4 | ||||
-rw-r--r-- | dom/media/gtest/moz.build | 4 | ||||
-rw-r--r-- | dom/media/mediasource/TrackBuffersManager.cpp | 4 | ||||
-rwxr-xr-x[-rw-r--r--] | dom/media/test/test_background_video_suspend.html | 4 | ||||
-rwxr-xr-x[-rw-r--r--] | dom/media/test/test_streams_element_capture.html | 3 | ||||
-rwxr-xr-x[-rw-r--r--] | dom/media/test/test_streams_element_capture_createObjectURL.html | 3 | ||||
-rwxr-xr-x[-rw-r--r--] | dom/media/webaudio/AudioContext.cpp | 5 |
12 files changed, 33 insertions, 16 deletions
diff --git a/dom/media/DOMMediaStream.cpp b/dom/media/DOMMediaStream.cpp index 6794ee32f..c1d451035 100644..100755 --- a/dom/media/DOMMediaStream.cpp +++ b/dom/media/DOMMediaStream.cpp @@ -9,6 +9,7 @@ #include "nsIScriptError.h" #include "nsIUUIDGenerator.h" #include "nsPIDOMWindow.h" +#include "mozilla/TimerClamping.h" #include "mozilla/dom/MediaStreamBinding.h" #include "mozilla/dom/MediaStreamTrackEvent.h" #include "mozilla/dom/LocalMediaStreamBinding.h" @@ -544,8 +545,8 @@ DOMMediaStream::CurrentTime() if (!mPlaybackStream) { return 0.0; } - return mPlaybackStream-> - StreamTimeToSeconds(mPlaybackStream->GetCurrentTime() - mLogicalStreamStartTime); + return TimerClamping::ReduceSTimeValue(mPlaybackStream-> + StreamTimeToSeconds(mPlaybackStream->GetCurrentTime() - mLogicalStreamStartTime)); } void diff --git a/dom/media/GraphDriver.cpp b/dom/media/GraphDriver.cpp index 9b74bd58c..40e3b72cf 100644 --- a/dom/media/GraphDriver.cpp +++ b/dom/media/GraphDriver.cpp @@ -1055,6 +1055,7 @@ AudioCallbackDriver::StateCallback(cubeb_state aState) { STREAM_LOG(LogLevel::Debug, ("AudioCallbackDriver State: %d", aState)); if (aState == CUBEB_STATE_ERROR && mShouldFallbackIfError) { + mShouldFallbackIfError = false; MonitorAutoLock lock(GraphImpl()->GetMonitor()); // Fall back to a driver using a normal thread. If needed, // the graph will try to re-open an audio stream later. diff --git a/dom/media/MediaData.cpp b/dom/media/MediaData.cpp index 0439a7473..4a52c22ae 100644 --- a/dom/media/MediaData.cpp +++ b/dom/media/MediaData.cpp @@ -90,7 +90,7 @@ ValidatePlane(const VideoData::YCbCrBuffer::Plane& aPlane) return aPlane.mWidth <= PlanarYCbCrImage::MAX_DIMENSION && aPlane.mHeight <= PlanarYCbCrImage::MAX_DIMENSION && aPlane.mWidth * aPlane.mHeight < MAX_VIDEO_WIDTH * MAX_VIDEO_HEIGHT && - aPlane.mStride > 0; + aPlane.mStride > 0 && aPlane.mWidth <= aPlane.mStride; } #ifdef MOZ_WIDGET_GONK diff --git a/dom/media/MediaDecoderOwner.h b/dom/media/MediaDecoderOwner.h index f884686fb..f993b4324 100644 --- a/dom/media/MediaDecoderOwner.h +++ b/dom/media/MediaDecoderOwner.h @@ -143,11 +143,13 @@ public: // reference to the decoder to prevent further calls into the decoder. virtual void NotifyXPCOMShutdown() = 0; +#ifdef MOZ_EME // Dispatches a "encrypted" event to the HTMLMediaElement, with the // provided init data. Actual dispatch may be delayed until HAVE_METADATA. // Main thread only. virtual void DispatchEncrypted(const nsTArray<uint8_t>& aInitData, const nsAString& aInitDataType) = 0; +#endif }; } // namespace mozilla diff --git a/dom/media/MediaFormatReader.cpp b/dom/media/MediaFormatReader.cpp index 2093803ad..06e8b963b 100644 --- a/dom/media/MediaFormatReader.cpp +++ b/dom/media/MediaFormatReader.cpp @@ -346,8 +346,12 @@ MediaFormatReader::DecoderFactory::DoCreateDecoder(TrackType aTrack) if (!mOwner->mPlatform) { mOwner->mPlatform = new PDMFactory(); if (mOwner->IsEncrypted()) { +#ifdef MOZ_EME MOZ_ASSERT(mOwner->mCDMProxy); mOwner->mPlatform->SetCDMProxy(mOwner->mCDMProxy); +#else + return MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, "EME not supported"); +#endif } } @@ -577,6 +581,7 @@ MediaFormatReader::InitInternal() return NS_OK; } +#ifdef MOZ_EME class DispatchKeyNeededEvent : public Runnable { public: DispatchKeyNeededEvent(AbstractMediaDecoder* aDecoder, @@ -602,6 +607,7 @@ private: nsTArray<uint8_t> mInitData; nsString mInitDataType; }; +#endif void MediaFormatReader::SetCDMProxy(CDMProxy* aProxy) @@ -618,7 +624,11 @@ MediaFormatReader::SetCDMProxy(CDMProxy* aProxy) bool MediaFormatReader::IsWaitingOnCDMResource() { MOZ_ASSERT(OnTaskQueue()); +#ifdef MOZ_EME return IsEncrypted() && !mCDMProxy; +#else + return false; +#endif } RefPtr<MediaDecoderReader::MetadataPromise> @@ -725,11 +735,13 @@ MediaFormatReader::OnDemuxerInitDone(nsresult) UniquePtr<EncryptionInfo> crypto = mDemuxer->GetCrypto(); if (mDecoder && crypto && crypto->IsEncrypted()) { +#ifdef MOZ_EME // Try and dispatch 'encrypted'. Won't go if ready state still HAVE_NOTHING. for (uint32_t i = 0; i < crypto->mInitDatas.Length(); i++) { NS_DispatchToMainThread( new DispatchKeyNeededEvent(mDecoder, crypto->mInitDatas[i].mInitData, crypto->mInitDatas[i].mType)); } +#endif mInfo.mCrypto = *crypto; } diff --git a/dom/media/MediaPrefs.h b/dom/media/MediaPrefs.h index 62b8fc47b..b237ecd3d 100644 --- a/dom/media/MediaPrefs.h +++ b/dom/media/MediaPrefs.h @@ -156,10 +156,6 @@ private: DECL_MEDIA_PREF("media.ogg.flac.enabled", FlacInOgg, bool, false); DECL_MEDIA_PREF("media.flac.enabled", FlacEnabled, bool, true); -#if defined(MOZ_RUST_MP4PARSE) && !defined(RELEASE_OR_BETA) - DECL_MEDIA_PREF("media.rust.test_mode", RustTestMode, bool, false); -#endif - public: // Manage the singleton: static MediaPrefs& GetSingleton(); diff --git a/dom/media/gtest/moz.build b/dom/media/gtest/moz.build index fc92d5ef3..d5d02bced 100644 --- a/dom/media/gtest/moz.build +++ b/dom/media/gtest/moz.build @@ -35,10 +35,6 @@ if CONFIG['MOZ_WEBM_ENCODER']: 'TestWebMWriter.cpp', ] -if CONFIG['MOZ_RUST']: - UNIFIED_SOURCES += ['TestRust.cpp',] - - TEST_HARNESS_FILES.gtest += [ '../test/gizmo-frag.mp4', '../test/gizmo.mp4', diff --git a/dom/media/mediasource/TrackBuffersManager.cpp b/dom/media/mediasource/TrackBuffersManager.cpp index 4265aed81..ac6d82411 100644 --- a/dom/media/mediasource/TrackBuffersManager.cpp +++ b/dom/media/mediasource/TrackBuffersManager.cpp @@ -58,6 +58,7 @@ AppendStateToStr(SourceBufferAttributes::AppendState aState) static Atomic<uint32_t> sStreamSourceID(0u); +#ifdef MOZ_EME class DispatchKeyNeededEvent : public Runnable { public: DispatchKeyNeededEvent(AbstractMediaDecoder* aDecoder, @@ -83,6 +84,7 @@ private: nsTArray<uint8_t> mInitData; nsString mInitDataType; }; +#endif TrackBuffersManager::TrackBuffersManager(MediaSourceDecoder* aParentDecoder, const nsACString& aType) @@ -1097,12 +1099,14 @@ TrackBuffersManager::OnDemuxerInitDone(nsresult) UniquePtr<EncryptionInfo> crypto = mInputDemuxer->GetCrypto(); if (crypto && crypto->IsEncrypted()) { +#ifdef MOZ_EME // Try and dispatch 'encrypted'. Won't go if ready state still HAVE_NOTHING. for (uint32_t i = 0; i < crypto->mInitDatas.Length(); i++) { NS_DispatchToMainThread( new DispatchKeyNeededEvent(mParentDecoder, crypto->mInitDatas[i].mInitData, crypto->mInitDatas[i].mType)); } +#endif info.mCrypto = *crypto; // We clear our crypto init data array, so the MediaFormatReader will // not emit an encrypted event for the same init data again. diff --git a/dom/media/test/test_background_video_suspend.html b/dom/media/test/test_background_video_suspend.html index e872eacf8..a5ac5cc2c 100644..100755 --- a/dom/media/test/test_background_video_suspend.html +++ b/dom/media/test/test_background_video_suspend.html @@ -15,7 +15,7 @@ var MIN_DELAY = 100; function testDelay(v, start, min) { let end = performance.now(); let delay = end - start; - ok(delay > min, `${v.token} suspended with a delay of ${delay} ms`); + ok(delay >= min, `${v.token} suspended with a delay of ${delay} ms`); } startTest({ @@ -25,7 +25,7 @@ startTest({ [ "media.suspend-bkgnd-video.enabled", true ], // User a short delay to ensure video decode suspend happens before end // of video. - [ "media.suspend-bkgnd-video.delay-ms", MIN_DELAY ] + [ "media.suspend-bkgnd-video.delay-ms", MIN_DELAY ], ], tests: gDecodeSuspendTests, runTest: (test, token) => { diff --git a/dom/media/test/test_streams_element_capture.html b/dom/media/test/test_streams_element_capture.html index 5e30a3ce4..a29eeef4d 100644..100755 --- a/dom/media/test/test_streams_element_capture.html +++ b/dom/media/test/test_streams_element_capture.html @@ -38,7 +38,8 @@ function startTest(test) { var stream; var checkEnded = function() { - is(stream.currentTime, vout.currentTime, test.name + " stream final currentTime"); + // We know the video time won't match up to the stream time + // is(stream.currentTime, vout.currentTime, test.name + " stream final currentTime"); if (test.duration) { isGreaterThanOrEqualEps(vout.currentTime, test.duration, test.name + " current time at end"); diff --git a/dom/media/test/test_streams_element_capture_createObjectURL.html b/dom/media/test/test_streams_element_capture_createObjectURL.html index d5d7efc5c..d952c7142 100644..100755 --- a/dom/media/test/test_streams_element_capture_createObjectURL.html +++ b/dom/media/test/test_streams_element_capture_createObjectURL.html @@ -38,7 +38,8 @@ function startTest(test, token) { var stream; var checkEnded = function() { - is(stream.currentTime, vout.currentTime, test.name + " stream final currentTime"); + // We know the video time won't match up to the stream time + // is(stream.currentTime, vout.currentTime, test.name + " stream final currentTime"); if (test.duration) { isGreaterThanOrEqualEps(vout.currentTime, test.duration, test.name + " current time at end"); diff --git a/dom/media/webaudio/AudioContext.cpp b/dom/media/webaudio/AudioContext.cpp index f61226a48..85842c811 100644..100755 --- a/dom/media/webaudio/AudioContext.cpp +++ b/dom/media/webaudio/AudioContext.cpp @@ -41,6 +41,7 @@ #include "nsNetUtil.h" #include "nsPIDOMWindow.h" #include "nsPrintfCString.h" +#include "mozilla/TimerClamping.h" #include "OscillatorNode.h" #include "PannerNode.h" #include "PeriodicWave.h" @@ -379,10 +380,12 @@ AudioContext::CreateMediaElementSource(HTMLMediaElement& aMediaElement, return nullptr; } +#ifdef MOZ_EME if (aMediaElement.ContainsRestrictedContent()) { aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR); return nullptr; } +#endif if (CheckClosed(aRv)) { return nullptr; @@ -744,7 +747,7 @@ double AudioContext::CurrentTime() const { MediaStream* stream = Destination()->Stream(); - return stream->StreamTimeToSeconds(stream->GetCurrentTime()); + return TimerClamping::ReduceSTimeValue(stream->StreamTimeToSeconds(stream->GetCurrentTime())); } void |