author | JW Wang <jwwang@mozilla.com> |
Wed, 01 Mar 2017 11:58:39 +0800 | |
changeset 345697 | 1274c971cea4c5ccdaa409341bbf7818894a12a9 |
parent 345696 | 11dc8f6f7ed03e9a4e6c4fede1a1660868bea742 |
child 345698 | 30601e17a9251d4e8d51d0dbbfaf43f5da085839 |
push id | 38262 |
push user | jwwang@mozilla.com |
push date | Fri, 03 Mar 2017 02:29:05 +0000 |
treeherder | autoland@1274c971cea4 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | jya |
bugs | 1343433 |
milestone | 54.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/dom/media/MediaFormatReader.cpp +++ b/dom/media/MediaFormatReader.cpp @@ -38,16 +38,18 @@ using mozilla::layers::LayerManager; using mozilla::layers::LayersBackend; static mozilla::LazyLogModule sFormatDecoderLog("MediaFormatReader"); mozilla::LazyLogModule gMediaDemuxerLog("MediaDemuxer"); #define LOG(arg, ...) MOZ_LOG(sFormatDecoderLog, mozilla::LogLevel::Debug, ("MediaFormatReader(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) #define LOGV(arg, ...) MOZ_LOG(sFormatDecoderLog, mozilla::LogLevel::Verbose, ("MediaFormatReader(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) +#define NS_DispatchToMainThread(...) CompileError_UseAbstractMainThreadInstead + namespace mozilla { /** * This is a singleton which controls the number of decoders that can be * created concurrently. Before calling PDMFactory::CreateDecoder(), Alloc() * must be called to get a token object as a permission to create a decoder. * The token should stay alive until Shutdown() is called on the decoder. * The destructor of the token will restore the decoder count so it is available @@ -111,21 +113,23 @@ private: GlobalAllocPolicy& mPolicy; // reference to a singleton object. }; GlobalAllocPolicy::GlobalAllocPolicy() : mMonitor("DecoderAllocPolicy::mMonitor") , mDecoderLimit(MediaPrefs::MediaDecoderLimit()) { - // Non DocGroup-version AbstractThread::MainThread is fine for - // ClearOnShutdown(). - AbstractThread::MainThread()->Dispatch(NS_NewRunnableFunction([this] () { - ClearOnShutdown(this, ShutdownPhase::ShutdownThreads); - })); + SystemGroup::Dispatch( + "GlobalAllocPolicy::ClearOnShutdown", + TaskCategory::Other, + NS_NewRunnableFunction([this] () { + ClearOnShutdown(this, ShutdownPhase::ShutdownThreads); + }) + ); } GlobalAllocPolicy::~GlobalAllocPolicy() { while (!mPromises.empty()) { RefPtr<PromisePrivate> p = mPromises.front().forget(); mPromises.pop(); p->Reject(true, __func__); @@ -1331,19 +1335,20 @@ MediaFormatReader::OnDemuxerInitDone(nsr mAudio.mTrackDemuxer = nullptr; } } UniquePtr<EncryptionInfo> crypto = mDemuxer->GetCrypto(); if (mDecoder && crypto && crypto->IsEncrypted()) { // 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( + nsCOMPtr<nsIRunnable> r = new DispatchKeyNeededEvent(mDecoder, crypto->mInitDatas[i].mInitData, - crypto->mInitDatas[i].mType)); + crypto->mInitDatas[i].mType); + mDecoder->AbstractMainThread()->Dispatch(r.forget()); } mInfo.mCrypto = *crypto; } int64_t videoDuration = HasVideo() ? mInfo.mVideo.mDuration : 0; int64_t audioDuration = HasAudio() ? mInfo.mAudio.mDuration : 0; int64_t duration = std::max(videoDuration, audioDuration); @@ -3044,8 +3049,10 @@ MediaFormatReader::OnFirstDemuxFailed(Tr auto& decoder = GetDecoderData(aType); MOZ_ASSERT(decoder.mFirstDemuxedSampleTime.isNothing()); decoder.mFirstDemuxedSampleTime.emplace(TimeUnit::FromInfinity()); MaybeResolveMetadataPromise(); } } // namespace mozilla + +#undef NS_DispatchToMainThread