diff options
Diffstat (limited to 'dom/media')
-rw-r--r-- | dom/media/AudioConverter.cpp | 8 | ||||
-rw-r--r-- | dom/media/Benchmark.cpp | 2 | ||||
-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/MediaStreamGraph.cpp | 4 | ||||
-rw-r--r-- | dom/media/MediaStreamTrack.cpp | 12 | ||||
-rw-r--r-- | dom/media/gmp/GMPChild.cpp | 4 | ||||
-rw-r--r-- | dom/media/gmp/GMPParent.cpp | 154 | ||||
-rw-r--r-- | dom/media/gmp/GMPParent.h | 15 | ||||
-rw-r--r-- | dom/media/gmp/GMPServiceParent.cpp | 109 | ||||
-rw-r--r-- | dom/media/gmp/GMPServiceParent.h | 18 | ||||
-rw-r--r-- | dom/media/platforms/ffmpeg/FFmpegVideoDecoder.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 | 3 |
17 files changed, 31 insertions, 320 deletions
diff --git a/dom/media/AudioConverter.cpp b/dom/media/AudioConverter.cpp index 77ad46ec6..25b981f43 100644 --- a/dom/media/AudioConverter.cpp +++ b/dom/media/AudioConverter.cpp @@ -362,15 +362,13 @@ size_t AudioConverter::ResampleRecipientFrames(size_t aFrames) const { if (!aFrames && mIn.Rate() != mOut.Rate()) { - // The resampler will be drained, account for frames currently buffered - // in the resampler. if (!mResampler) { return 0; } - return speex_resampler_get_output_latency(mResampler); - } else { - return (uint64_t)aFrames * mOut.Rate() / mIn.Rate() + 1; + // We drain by pushing in get_input_latency() samples of 0 + aFrames = speex_resampler_get_input_latency(mResampler); } + return (uint64_t)aFrames * mOut.Rate() / mIn.Rate() + 1; } size_t diff --git a/dom/media/Benchmark.cpp b/dom/media/Benchmark.cpp index 1ba6e561c..fdbedeca5 100644 --- a/dom/media/Benchmark.cpp +++ b/dom/media/Benchmark.cpp @@ -22,7 +22,7 @@ namespace mozilla { // Update this version number to force re-running the benchmark. Such as when // an improvement to FFVP9 or LIBVPX is deemed worthwhile. -const uint32_t VP9Benchmark::sBenchmarkVersionID = 2; +const uint32_t VP9Benchmark::sBenchmarkVersionID = 3; const char* VP9Benchmark::sBenchmarkFpsPref = "media.benchmark.vp9.fps"; const char* VP9Benchmark::sBenchmarkFpsVersionCheck = "media.benchmark.vp9.versioncheck"; 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/MediaStreamGraph.cpp b/dom/media/MediaStreamGraph.cpp index 94cafa029..e2934cbb2 100644 --- a/dom/media/MediaStreamGraph.cpp +++ b/dom/media/MediaStreamGraph.cpp @@ -1715,6 +1715,10 @@ MediaStreamGraphImpl::RunInStableState(bool aSourceIsMSG) RefPtr<GraphDriver> driver = CurrentDriver(); MonitorAutoUnlock unlock(mMonitor); driver->Start(); + // It's not safe to Shutdown() a thread from StableState, and + // releasing this may shutdown a SystemClockDriver thread. + // Proxy the release to outside of StableState. + NS_ReleaseOnMainThread(driver.forget(), true); // always proxy } } diff --git a/dom/media/MediaStreamTrack.cpp b/dom/media/MediaStreamTrack.cpp index 8ccdeb90c..75cdeb1d1 100644 --- a/dom/media/MediaStreamTrack.cpp +++ b/dom/media/MediaStreamTrack.cpp @@ -165,11 +165,15 @@ MediaStreamTrack::Destroy() mPrincipalHandleListener->Forget(); mPrincipalHandleListener = nullptr; } - for (auto l : mTrackListeners) { - RemoveListener(l); + // Remove all listeners -- avoid iterating over the list we're removing from + const nsTArray<RefPtr<MediaStreamTrackListener>> trackListeners(mTrackListeners); + for (auto listener : trackListeners) { + RemoveListener(listener); } - for (auto l : mDirectTrackListeners) { - RemoveDirectListener(l); + // Do the same as above for direct listeners + const nsTArray<RefPtr<DirectMediaStreamTrackListener>> directTrackListeners(mDirectTrackListeners); + for (auto listener : directTrackListeners) { + RemoveDirectListener(listener); } } diff --git a/dom/media/gmp/GMPChild.cpp b/dom/media/gmp/GMPChild.cpp index 953dae3c6..f8e75e299 100644 --- a/dom/media/gmp/GMPChild.cpp +++ b/dom/media/gmp/GMPChild.cpp @@ -257,10 +257,6 @@ GMPChild::Init(const nsAString& aPluginPath, return false; } -#ifdef MOZ_CRASHREPORTER - SendPCrashReporterConstructor(CrashReporter::CurrentThreadId()); -#endif - mPluginPath = aPluginPath; mSandboxVoucherPath = aVoucherPath; diff --git a/dom/media/gmp/GMPParent.cpp b/dom/media/gmp/GMPParent.cpp index 75468ea9a..00bc97777 100644 --- a/dom/media/gmp/GMPParent.cpp +++ b/dom/media/gmp/GMPParent.cpp @@ -29,12 +29,6 @@ using mozilla::dom::CrashReporterParent; using mozilla::ipc::GeckoChildProcessHost; -#ifdef MOZ_CRASHREPORTER -#include "nsPrintfCString.h" -using CrashReporter::AnnotationTable; -using CrashReporter::GetIDFromMinidump; -#endif - #include "mozilla/Telemetry.h" #ifdef XP_WIN @@ -224,10 +218,6 @@ GMPParent::AbortWaitingForGMPAsyncShutdown(nsITimer* aTimer, void* aClosure) NS_WARNING("Timed out waiting for GMP async shutdown!"); GMPParent* parent = reinterpret_cast<GMPParent*>(aClosure); MOZ_ASSERT(parent->mService); -#if defined(MOZ_CRASHREPORTER) - parent->mService->SetAsyncShutdownPluginState(parent, 'G', - NS_LITERAL_CSTRING("Timed out waiting for async shutdown")); -#endif parent->mService->AsyncShutdownComplete(parent); } @@ -270,22 +260,8 @@ GMPParent::RecvPGMPContentChildDestroyed() { --mGMPContentChildCount; if (!IsUsed()) { -#if defined(MOZ_CRASHREPORTER) - if (mService) { - mService->SetAsyncShutdownPluginState(this, 'E', - NS_LITERAL_CSTRING("Last content child destroyed")); - } -#endif CloseIfUnused(); } -#if defined(MOZ_CRASHREPORTER) - else { - if (mService) { - mService->SetAsyncShutdownPluginState(this, 'F', - nsPrintfCString("Content child destroyed, remaining: %u", mGMPContentChildCount)); - } - } -#endif return true; } @@ -307,38 +283,14 @@ GMPParent::CloseIfUnused() if (mAsyncShutdownRequired) { if (!mAsyncShutdownInProgress) { LOGD("%s: sending async shutdown notification", __FUNCTION__); -#if defined(MOZ_CRASHREPORTER) - if (mService) { - mService->SetAsyncShutdownPluginState(this, 'H', - NS_LITERAL_CSTRING("Sent BeginAsyncShutdown")); - } -#endif mAsyncShutdownInProgress = true; if (!SendBeginAsyncShutdown()) { -#if defined(MOZ_CRASHREPORTER) - if (mService) { - mService->SetAsyncShutdownPluginState(this, 'I', - NS_LITERAL_CSTRING("Could not send BeginAsyncShutdown - Aborting async shutdown")); - } -#endif AbortAsyncShutdown(); } else if (NS_FAILED(EnsureAsyncShutdownTimeoutSet())) { -#if defined(MOZ_CRASHREPORTER) - if (mService) { - mService->SetAsyncShutdownPluginState(this, 'J', - NS_LITERAL_CSTRING("Could not start timer after sending BeginAsyncShutdown - Aborting async shutdown")); - } -#endif AbortAsyncShutdown(); } } } else { -#if defined(MOZ_CRASHREPORTER) - if (mService) { - mService->SetAsyncShutdownPluginState(this, 'K', - NS_LITERAL_CSTRING("No (more) async-shutdown required")); - } -#endif // No async-shutdown, kill async-shutdown timer started in CloseActive(). AbortAsyncShutdown(); // Any async shutdown must be complete. Shutdown GMPStorage. @@ -385,29 +337,11 @@ GMPParent::CloseActive(bool aDieWhenUnloaded) mState = GMPStateUnloading; } if (mState != GMPStateNotLoaded && IsUsed()) { -#if defined(MOZ_CRASHREPORTER) - if (mService) { - mService->SetAsyncShutdownPluginState(this, 'A', - nsPrintfCString("Sent CloseActive, content children to close: %u", mGMPContentChildCount)); - } -#endif if (!SendCloseActive()) { -#if defined(MOZ_CRASHREPORTER) - if (mService) { - mService->SetAsyncShutdownPluginState(this, 'B', - NS_LITERAL_CSTRING("Could not send CloseActive - Aborting async shutdown")); - } -#endif AbortAsyncShutdown(); } else if (IsUsed()) { // We're expecting RecvPGMPContentChildDestroyed's -> Start async-shutdown timer now if needed. if (mAsyncShutdownRequired && NS_FAILED(EnsureAsyncShutdownTimeoutSet())) { -#if defined(MOZ_CRASHREPORTER) - if (mService) { - mService->SetAsyncShutdownPluginState(this, 'C', - NS_LITERAL_CSTRING("Could not start timer after sending CloseActive - Aborting async shutdown")); - } -#endif AbortAsyncShutdown(); } } else { @@ -418,12 +352,6 @@ GMPParent::CloseActive(bool aDieWhenUnloaded) // that time, it might not have proceeded with shutdown; And calling it // again after shutdown is fine because after the first one we'll be in // GMPStateNotLoaded. -#if defined(MOZ_CRASHREPORTER) - if (mService) { - mService->SetAsyncShutdownPluginState(this, 'D', - NS_LITERAL_CSTRING("Content children already destroyed")); - } -#endif CloseIfUnused(); } } @@ -630,78 +558,10 @@ GMPParent::EnsureProcessLoaded() return NS_SUCCEEDED(rv); } -#ifdef MOZ_CRASHREPORTER -void -GMPParent::WriteExtraDataForMinidump(CrashReporter::AnnotationTable& notes) -{ - notes.Put(NS_LITERAL_CSTRING("GMPPlugin"), NS_LITERAL_CSTRING("1")); - notes.Put(NS_LITERAL_CSTRING("PluginFilename"), - NS_ConvertUTF16toUTF8(mName)); - notes.Put(NS_LITERAL_CSTRING("PluginName"), mDisplayName); - notes.Put(NS_LITERAL_CSTRING("PluginVersion"), mVersion); -} - -void -GMPParent::GetCrashID(nsString& aResult) -{ - CrashReporterParent* cr = - static_cast<CrashReporterParent*>(LoneManagedOrNullAsserts(ManagedPCrashReporterParent())); - if (NS_WARN_IF(!cr)) { - return; - } - - AnnotationTable notes(4); - WriteExtraDataForMinidump(notes); - nsCOMPtr<nsIFile> dumpFile; - TakeMinidump(getter_AddRefs(dumpFile), nullptr); - if (!dumpFile) { - NS_WARNING("GMP crash without crash report"); - aResult = mName; - aResult += '-'; - AppendUTF8toUTF16(mVersion, aResult); - return; - } - GetIDFromMinidump(dumpFile, aResult); - cr->GenerateCrashReportForMinidump(dumpFile, ¬es); -} - -static void -GMPNotifyObservers(const uint32_t aPluginID, const nsACString& aPluginName, const nsAString& aPluginDumpID) -{ - nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService(); - nsCOMPtr<nsIWritablePropertyBag2> propbag = - do_CreateInstance("@mozilla.org/hash-property-bag;1"); - if (obs && propbag) { - propbag->SetPropertyAsUint32(NS_LITERAL_STRING("pluginID"), aPluginID); - propbag->SetPropertyAsACString(NS_LITERAL_STRING("pluginName"), aPluginName); - propbag->SetPropertyAsAString(NS_LITERAL_STRING("pluginDumpID"), aPluginDumpID); - obs->NotifyObservers(propbag, "gmp-plugin-crash", nullptr); - } - - RefPtr<gmp::GeckoMediaPluginService> service = - gmp::GeckoMediaPluginService::GetGeckoMediaPluginService(); - if (service) { - service->RunPluginCrashCallbacks(aPluginID, aPluginName); - } -} -#endif void GMPParent::ActorDestroy(ActorDestroyReason aWhy) { LOGD("%s: (%d)", __FUNCTION__, (int)aWhy); -#ifdef MOZ_CRASHREPORTER - if (AbnormalShutdown == aWhy) { - Telemetry::Accumulate(Telemetry::SUBPROCESS_ABNORMAL_ABORT, - NS_LITERAL_CSTRING("gmplugin"), 1); - nsString dumpID; - GetCrashID(dumpID); - - // NotifyObservers is mainthread-only - NS_DispatchToMainThread(WrapRunnableNM(&GMPNotifyObservers, - mPluginId, mDisplayName, dumpID), - NS_DISPATCH_NORMAL); - } -#endif // warn us off trying to close again mState = GMPStateClosing; mAbnormalShutdownInProgress = true; @@ -711,12 +571,6 @@ GMPParent::ActorDestroy(ActorDestroyReason aWhy) if (AbnormalShutdown == aWhy) { RefPtr<GMPParent> self(this); if (mAsyncShutdownRequired) { -#if defined(MOZ_CRASHREPORTER) - if (mService) { - mService->SetAsyncShutdownPluginState(this, 'M', - NS_LITERAL_CSTRING("Actor destroyed")); - } -#endif mService->AsyncShutdownComplete(this); mAsyncShutdownRequired = false; } @@ -732,9 +586,7 @@ GMPParent::ActorDestroy(ActorDestroyReason aWhy) mozilla::dom::PCrashReporterParent* GMPParent::AllocPCrashReporterParent(const NativeThreadId& aThread) { -#ifndef MOZ_CRASHREPORTER MOZ_ASSERT(false, "Should only be sent if crash reporting is enabled."); -#endif CrashReporterParent* cr = new CrashReporterParent(); cr->SetChildData(aThread, GeckoProcessType_GMPlugin); return cr; @@ -1043,12 +895,6 @@ GMPParent::RecvAsyncShutdownComplete() LOGD("%s", __FUNCTION__); MOZ_ASSERT(mAsyncShutdownRequired); -#if defined(MOZ_CRASHREPORTER) - if (mService) { - mService->SetAsyncShutdownPluginState(this, 'L', - NS_LITERAL_CSTRING("Received AsyncShutdownComplete")); - } -#endif AbortAsyncShutdown(); return true; } diff --git a/dom/media/gmp/GMPParent.h b/dom/media/gmp/GMPParent.h index 91a6fb429..4f91ec5ba 100644 --- a/dom/media/gmp/GMPParent.h +++ b/dom/media/gmp/GMPParent.h @@ -25,17 +25,6 @@ class nsIThread; -#ifdef MOZ_CRASHREPORTER -#include "nsExceptionHandler.h" - -namespace mozilla { -namespace dom { -class PCrashReporterParent; -class CrashReporterParent; -} -} -#endif - namespace mozilla { namespace gmp { @@ -177,10 +166,6 @@ private: RefPtr<GenericPromise> ReadGMPInfoFile(nsIFile* aFile); RefPtr<GenericPromise> ParseChromiumManifest(nsString aJSON); // Main thread. RefPtr<GenericPromise> ReadChromiumManifestFile(nsIFile* aFile); // GMP thread. -#ifdef MOZ_CRASHREPORTER - void WriteExtraDataForMinidump(CrashReporter::AnnotationTable& notes); - void GetCrashID(nsString& aResult); -#endif void ActorDestroy(ActorDestroyReason aWhy) override; PCrashReporterParent* AllocPCrashReporterParent(const NativeThreadId& aThread) override; diff --git a/dom/media/gmp/GMPServiceParent.cpp b/dom/media/gmp/GMPServiceParent.cpp index 8741989e3..f25c36811 100644 --- a/dom/media/gmp/GMPServiceParent.cpp +++ b/dom/media/gmp/GMPServiceParent.cpp @@ -36,10 +36,6 @@ #include "nsHashKeys.h" #include "nsIFile.h" #include "nsISimpleEnumerator.h" -#if defined(MOZ_CRASHREPORTER) -#include "nsExceptionHandler.h" -#include "nsPrintfCString.h" -#endif #include "nsIXULRuntime.h" #include "GMPDecoderModule.h" #include <limits> @@ -88,9 +84,6 @@ NS_IMPL_ISUPPORTS_INHERITED(GeckoMediaPluginServiceParent, GeckoMediaPluginServiceParent::GeckoMediaPluginServiceParent() : mShuttingDown(false) -#ifdef MOZ_CRASHREPORTER - , mAsyncShutdownPluginStatesMutex("GeckoMediaPluginService::mAsyncShutdownPluginStatesMutex") -#endif , mScannedPluginOnDisk(false) , mWaitingForPluginsSyncShutdown(false) , mInitPromiseMonitor("GeckoMediaPluginServiceParent::mInitPromiseMonitor") @@ -421,28 +414,16 @@ GeckoMediaPluginServiceParent::Observe(nsISupports* aSubject, if (gmpThread) { LOGD(("%s::%s Starting to unload plugins, waiting for first sync shutdown..." , __CLASS__, __FUNCTION__)); -#ifdef MOZ_CRASHREPORTER - SetAsyncShutdownPluginState(nullptr, '0', - NS_LITERAL_CSTRING("Dispatching UnloadPlugins")); -#endif gmpThread->Dispatch( NewRunnableMethod(this, &GeckoMediaPluginServiceParent::UnloadPlugins), NS_DISPATCH_NORMAL); -#ifdef MOZ_CRASHREPORTER - SetAsyncShutdownPluginState(nullptr, '1', - NS_LITERAL_CSTRING("Waiting for sync shutdown")); -#endif // Wait for UnloadPlugins() to do initial sync shutdown... while (mWaitingForPluginsSyncShutdown) { NS_ProcessNextEvent(NS_GetCurrentThread(), true); } -#ifdef MOZ_CRASHREPORTER - SetAsyncShutdownPluginState(nullptr, '4', - NS_LITERAL_CSTRING("Waiting for async shutdown")); -#endif // Wait for other plugins (if any) to do async shutdown... auto syncShutdownPluginsRemaining = std::numeric_limits<decltype(mAsyncShutdownPlugins.Length())>::max(); @@ -452,10 +433,6 @@ GeckoMediaPluginServiceParent::Observe(nsISupports* aSubject, if (mAsyncShutdownPlugins.IsEmpty()) { LOGD(("%s::%s Finished unloading all plugins" , __CLASS__, __FUNCTION__)); -#if defined(MOZ_CRASHREPORTER) - CrashReporter::RemoveCrashReportAnnotation( - NS_LITERAL_CSTRING("AsyncPluginShutdown")); -#endif break; } else if (mAsyncShutdownPlugins.Length() < syncShutdownPluginsRemaining) { // First time here, or number of pending plugins has decreased. @@ -463,24 +440,10 @@ GeckoMediaPluginServiceParent::Observe(nsISupports* aSubject, syncShutdownPluginsRemaining = mAsyncShutdownPlugins.Length(); LOGD(("%s::%s Still waiting for %d plugins to shutdown..." , __CLASS__, __FUNCTION__, (int)syncShutdownPluginsRemaining)); -#if defined(MOZ_CRASHREPORTER) - nsAutoCString names; - for (const auto& plugin : mAsyncShutdownPlugins) { - if (!names.IsEmpty()) { names.Append(NS_LITERAL_CSTRING(", ")); } - names.Append(plugin->GetDisplayName()); - } - CrashReporter::AnnotateCrashReport( - NS_LITERAL_CSTRING("AsyncPluginShutdown"), - names); -#endif } } NS_ProcessNextEvent(NS_GetCurrentThread(), true); } -#ifdef MOZ_CRASHREPORTER - SetAsyncShutdownPluginState(nullptr, '5', - NS_LITERAL_CSTRING("Async shutdown complete")); -#endif } else { // GMP thread has already shutdown. MOZ_ASSERT(mPlugins.IsEmpty()); @@ -627,66 +590,6 @@ GeckoMediaPluginServiceParent::AsyncShutdownComplete(GMPParent* aParent) } } -#ifdef MOZ_CRASHREPORTER -void -GeckoMediaPluginServiceParent::SetAsyncShutdownPluginState(GMPParent* aGMPParent, - char aId, - const nsCString& aState) -{ - MutexAutoLock lock(mAsyncShutdownPluginStatesMutex); - if (!aGMPParent) { - mAsyncShutdownPluginStates.Update(NS_LITERAL_CSTRING("-"), - NS_LITERAL_CSTRING("-"), - aId, - aState); - return; - } - mAsyncShutdownPluginStates.Update(aGMPParent->GetDisplayName(), - nsPrintfCString("%p", aGMPParent), - aId, - aState); -} - -void -GeckoMediaPluginServiceParent::AsyncShutdownPluginStates::Update(const nsCString& aPlugin, - const nsCString& aInstance, - char aId, - const nsCString& aState) -{ - nsCString note; - StatesByInstance* instances = mStates.LookupOrAdd(aPlugin); - if (!instances) { return; } - State* state = instances->LookupOrAdd(aInstance); - if (!state) { return; } - state->mStateSequence += aId; - state->mLastStateDescription = aState; - note += '{'; - bool firstPlugin = true; - for (auto pluginIt = mStates.ConstIter(); !pluginIt.Done(); pluginIt.Next()) { - if (!firstPlugin) { note += ','; } else { firstPlugin = false; } - note += pluginIt.Key(); - note += ":{"; - bool firstInstance = true; - for (auto instanceIt = pluginIt.UserData()->ConstIter(); !instanceIt.Done(); instanceIt.Next()) { - if (!firstInstance) { note += ','; } else { firstInstance = false; } - note += instanceIt.Key(); - note += ":\""; - note += instanceIt.UserData()->mStateSequence; - note += '='; - note += instanceIt.UserData()->mLastStateDescription; - note += '"'; - } - note += '}'; - } - note += '}'; - LOGD(("%s::%s states[%s][%s]='%c'/'%s' -> %s", __CLASS__, __FUNCTION__, - aPlugin.get(), aInstance.get(), aId, aState.get(), note.get())); - CrashReporter::AnnotateCrashReport( - NS_LITERAL_CSTRING("AsyncPluginShutdownStates"), - note); -} -#endif // MOZ_CRASHREPORTER - void GeckoMediaPluginServiceParent::NotifyAsyncShutdownComplete() { @@ -714,10 +617,6 @@ GeckoMediaPluginServiceParent::UnloadPlugins() MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread); MOZ_ASSERT(!mShuttingDownOnGMPThread); mShuttingDownOnGMPThread = true; -#ifdef MOZ_CRASHREPORTER - SetAsyncShutdownPluginState(nullptr, '2', - NS_LITERAL_CSTRING("Starting to unload plugins")); -#endif nsTArray<RefPtr<GMPParent>> plugins; { @@ -742,17 +641,9 @@ GeckoMediaPluginServiceParent::UnloadPlugins() // Note: CloseActive may be async; it could actually finish // shutting down when all the plugins have unloaded. for (const auto& plugin : plugins) { -#ifdef MOZ_CRASHREPORTER - SetAsyncShutdownPluginState(plugin, 'S', - NS_LITERAL_CSTRING("CloseActive")); -#endif plugin->CloseActive(true); } -#ifdef MOZ_CRASHREPORTER - SetAsyncShutdownPluginState(nullptr, '3', - NS_LITERAL_CSTRING("Dispatching sync-shutdown-complete")); -#endif nsCOMPtr<nsIRunnable> task(NewRunnableMethod( this, &GeckoMediaPluginServiceParent::NotifySyncShutdownComplete)); NS_DispatchToMainThread(task); diff --git a/dom/media/gmp/GMPServiceParent.h b/dom/media/gmp/GMPServiceParent.h index f3f43e215..49d81055b 100644 --- a/dom/media/gmp/GMPServiceParent.h +++ b/dom/media/gmp/GMPServiceParent.h @@ -54,9 +54,6 @@ public: void AsyncShutdownComplete(GMPParent* aParent); int32_t AsyncShutdownTimeoutMs(); -#ifdef MOZ_CRASHREPORTER - void SetAsyncShutdownPluginState(GMPParent* aGMPParent, char aId, const nsCString& aState); -#endif // MOZ_CRASHREPORTER RefPtr<GenericPromise> EnsureInitialized(); RefPtr<GenericPromise> AsyncAddPluginDirectory(const nsAString& aDirectory); @@ -169,21 +166,6 @@ private: bool mShuttingDown; nsTArray<RefPtr<GMPParent>> mAsyncShutdownPlugins; -#ifdef MOZ_CRASHREPORTER - Mutex mAsyncShutdownPluginStatesMutex; // Protects mAsyncShutdownPluginStates. - class AsyncShutdownPluginStates - { - public: - void Update(const nsCString& aPlugin, const nsCString& aInstance, - char aId, const nsCString& aState); - private: - struct State { nsCString mStateSequence; nsCString mLastStateDescription; }; - typedef nsClassHashtable<nsCStringHashKey, State> StatesByInstance; - typedef nsClassHashtable<nsCStringHashKey, StatesByInstance> StateInstancesByPlugin; - StateInstancesByPlugin mStates; - } mAsyncShutdownPluginStates; -#endif // MOZ_CRASHREPORTER - // True if we've inspected MOZ_GMP_PATH on the GMP thread and loaded any // plugins found there into mPlugins. Atomic<bool> mScannedPluginOnDisk; diff --git a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp index 5c1b6c97b..aec1e9136 100644 --- a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp +++ b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp @@ -181,8 +181,8 @@ FFmpegVideoDecoder<LIBAV_VER>::DoDecode(MediaRawData* aSample, bool* aGotFrame) #endif )) { while (inputSize) { - uint8_t* data; - int size; + uint8_t* data = inputData; + int size = inputSize; int len = mLib->av_parser_parse2(mCodecParser, mCodecContext, &data, &size, inputData, inputSize, aSample->mTime, aSample->mTimecode, 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 a36eda621..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" @@ -746,7 +747,7 @@ double AudioContext::CurrentTime() const { MediaStream* stream = Destination()->Stream(); - return stream->StreamTimeToSeconds(stream->GetCurrentTime()); + return TimerClamping::ReduceSTimeValue(stream->StreamTimeToSeconds(stream->GetCurrentTime())); } void |