From aca11575bea358acd7302b81fe2c85e9ce631cc5 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Sat, 14 Feb 2015 19:08:15 -0800 Subject: [PATCH] Bug 1125970 - Make flushing an opt-in mechanism, and use it only for the PDM task queues. v1 r=cpearce --- dom/media/MediaTaskQueue.cpp | 22 +++---- dom/media/MediaTaskQueue.h | 64 ++++++++++--------- dom/media/VideoUtils.cpp | 20 ++++++ dom/media/VideoUtils.h | 4 ++ dom/media/fmp4/AVCCDecoderModule.cpp | 10 +-- dom/media/fmp4/AVCCDecoderModule.h | 4 +- dom/media/fmp4/BlankDecoderModule.cpp | 8 +-- dom/media/fmp4/MP4Reader.cpp | 7 +- dom/media/fmp4/MP4Reader.h | 2 +- dom/media/fmp4/PlatformDecoderModule.cpp | 3 +- dom/media/fmp4/PlatformDecoderModule.h | 9 ++- dom/media/fmp4/SharedDecoderManager.cpp | 4 +- dom/media/fmp4/SharedDecoderManager.h | 4 +- .../fmp4/android/AndroidDecoderModule.cpp | 4 +- dom/media/fmp4/android/AndroidDecoderModule.h | 4 +- dom/media/fmp4/apple/AppleATDecoder.cpp | 2 +- dom/media/fmp4/apple/AppleATDecoder.h | 6 +- dom/media/fmp4/apple/AppleDecoderModule.cpp | 4 +- dom/media/fmp4/apple/AppleDecoderModule.h | 4 +- dom/media/fmp4/apple/AppleVDADecoder.cpp | 4 +- dom/media/fmp4/apple/AppleVDADecoder.h | 8 +-- dom/media/fmp4/apple/AppleVTDecoder.cpp | 2 +- dom/media/fmp4/apple/AppleVTDecoder.h | 2 +- dom/media/fmp4/eme/EMEDecoderModule.cpp | 16 ++--- dom/media/fmp4/eme/EMEDecoderModule.h | 8 +-- dom/media/fmp4/ffmpeg/FFmpegAudioDecoder.cpp | 2 +- dom/media/fmp4/ffmpeg/FFmpegAudioDecoder.h | 2 +- dom/media/fmp4/ffmpeg/FFmpegDataDecoder.cpp | 2 +- dom/media/fmp4/ffmpeg/FFmpegDataDecoder.h | 4 +- dom/media/fmp4/ffmpeg/FFmpegDecoderModule.h | 4 +- dom/media/fmp4/ffmpeg/FFmpegH264Decoder.cpp | 2 +- dom/media/fmp4/ffmpeg/FFmpegH264Decoder.h | 2 +- dom/media/fmp4/gmp/GMPDecoderModule.cpp | 4 +- dom/media/fmp4/gmp/GMPDecoderModule.h | 4 +- dom/media/fmp4/gonk/GonkDecoderModule.cpp | 4 +- dom/media/fmp4/gonk/GonkDecoderModule.h | 4 +- dom/media/fmp4/gonk/GonkMediaDataDecoder.cpp | 2 +- dom/media/fmp4/gonk/GonkMediaDataDecoder.h | 4 +- dom/media/fmp4/wmf/WMFDecoderModule.cpp | 4 +- dom/media/fmp4/wmf/WMFDecoderModule.h | 4 +- dom/media/fmp4/wmf/WMFMediaDataDecoder.cpp | 2 +- dom/media/fmp4/wmf/WMFMediaDataDecoder.h | 4 +- dom/media/fmp4/wmf/WMFVideoMFTManager.h | 2 +- dom/media/omx/MediaCodecReader.cpp | 4 +- dom/media/omx/MediaCodecReader.h | 4 +- dom/media/webm/IntelWebMVideoDecoder.h | 2 +- dom/media/webm/WebMReader.cpp | 2 +- dom/media/webm/WebMReader.h | 4 +- 48 files changed, 162 insertions(+), 135 deletions(-) diff --git a/dom/media/MediaTaskQueue.cpp b/dom/media/MediaTaskQueue.cpp index 78235612138..1c1d72a847a 100644 --- a/dom/media/MediaTaskQueue.cpp +++ b/dom/media/MediaTaskQueue.cpp @@ -147,8 +147,17 @@ MediaTaskQueue::BeginShutdown() return p; } +void +FlushableMediaTaskQueue::Flush() +{ + MonitorAutoLock mon(mQueueMonitor); + AutoSetFlushing autoFlush(this); + FlushLocked(); + AwaitIdleLocked(); +} + nsresult -MediaTaskQueue::FlushAndDispatch(TemporaryRef aRunnable) +FlushableMediaTaskQueue::FlushAndDispatch(TemporaryRef aRunnable) { MonitorAutoLock mon(mQueueMonitor); AutoSetFlushing autoFlush(this); @@ -160,16 +169,7 @@ MediaTaskQueue::FlushAndDispatch(TemporaryRef aRunnable) } void -MediaTaskQueue::Flush() -{ - MonitorAutoLock mon(mQueueMonitor); - AutoSetFlushing autoFlush(this); - FlushLocked(); - AwaitIdleLocked(); -} - -void -MediaTaskQueue::FlushLocked() +FlushableMediaTaskQueue::FlushLocked() { mQueueMonitor.AssertCurrentThreadOwns(); MOZ_ASSERT(mIsFlushing); diff --git a/dom/media/MediaTaskQueue.h b/dom/media/MediaTaskQueue.h index 42be2bf1c51..0b2bfcc9a3d 100644 --- a/dom/media/MediaTaskQueue.h +++ b/dom/media/MediaTaskQueue.h @@ -27,9 +27,7 @@ typedef MediaPromise ShutdownPromise; // they're received, and are guaranteed to not be executed concurrently. // They may be executed on different threads, and a memory barrier is used // to make this threadsafe for objects that aren't already threadsafe. -class MediaTaskQueue MOZ_FINAL { - ~MediaTaskQueue(); - +class MediaTaskQueue { public: NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaTaskQueue) @@ -43,12 +41,6 @@ public: nsresult SyncDispatch(TemporaryRef aRunnable); - nsresult FlushAndDispatch(TemporaryRef aRunnable); - - // Removes all pending tasks from the task queue, and blocks until - // the currently running task (if any) finishes. - void Flush(); - // Puts the queue in a shutdown state and returns immediately. The queue will // remain alive at least until all the events are drained, because the Runners // hold a strong reference to the task queue, and one of them is always held @@ -70,7 +62,9 @@ public: // the task queue. This is for debugging/validation purposes only. bool IsCurrentThreadIn(); -private: +protected: + virtual ~MediaTaskQueue(); + // Blocks until all task finish executing. Called internally by methods // that need to wait until the task queue is idle. @@ -81,7 +75,6 @@ private: nsresult DispatchLocked(TemporaryRef aRunnable, DispatchMode aMode); - void FlushLocked(); RefPtr mPool; @@ -113,24 +106,6 @@ private: bool mIsShutdown; MediaPromiseHolder mShutdownPromise; - class MOZ_STACK_CLASS AutoSetFlushing - { - public: - explicit AutoSetFlushing(MediaTaskQueue* aTaskQueue) : mTaskQueue(aTaskQueue) - { - mTaskQueue->mQueueMonitor.AssertCurrentThreadOwns(); - mTaskQueue->mIsFlushing = true; - } - ~AutoSetFlushing() - { - mTaskQueue->mQueueMonitor.AssertCurrentThreadOwns(); - mTaskQueue->mIsFlushing = false; - } - - private: - MediaTaskQueue* mTaskQueue; - }; - // True if we're flushing; we reject new tasks if we're flushing. bool mIsFlushing; @@ -146,6 +121,37 @@ private: }; }; +class FlushableMediaTaskQueue : public MediaTaskQueue +{ +public: + explicit FlushableMediaTaskQueue(TemporaryRef aPool) : MediaTaskQueue(aPool) {} + nsresult FlushAndDispatch(TemporaryRef aRunnable); + void Flush(); + +private: + + class MOZ_STACK_CLASS AutoSetFlushing + { + public: + explicit AutoSetFlushing(FlushableMediaTaskQueue* aTaskQueue) : mTaskQueue(aTaskQueue) + { + mTaskQueue->mQueueMonitor.AssertCurrentThreadOwns(); + mTaskQueue->mIsFlushing = true; + } + ~AutoSetFlushing() + { + mTaskQueue->mQueueMonitor.AssertCurrentThreadOwns(); + mTaskQueue->mIsFlushing = false; + } + + private: + FlushableMediaTaskQueue* mTaskQueue; + }; + + void FlushLocked(); + +}; + } // namespace mozilla #endif // MediaTaskQueue_h_ diff --git a/dom/media/VideoUtils.cpp b/dom/media/VideoUtils.cpp index 697c87a6bbd..529d350dbe8 100644 --- a/dom/media/VideoUtils.cpp +++ b/dom/media/VideoUtils.cpp @@ -294,6 +294,16 @@ public: nsRefPtr mTaskQueue; }; +class CreateFlushableTaskQueueTask : public nsRunnable { +public: + NS_IMETHOD Run() { + MOZ_ASSERT(NS_IsMainThread()); + mTaskQueue = new FlushableMediaTaskQueue(GetMediaDecodeThreadPool()); + return NS_OK; + } + nsRefPtr mTaskQueue; +}; + already_AddRefed CreateMediaDecodeTaskQueue() { @@ -304,4 +314,14 @@ CreateMediaDecodeTaskQueue() return t->mTaskQueue.forget(); } +already_AddRefed +CreateFlushableMediaDecodeTaskQueue() +{ + // We must create the MediaTaskQueue/SharedThreadPool on the main thread. + nsRefPtr t(new CreateFlushableTaskQueueTask()); + nsresult rv = NS_DispatchToMainThread(t, NS_DISPATCH_SYNC); + NS_ENSURE_SUCCESS(rv, nullptr); + return t->mTaskQueue.forget(); +} + } // end namespace mozilla diff --git a/dom/media/VideoUtils.h b/dom/media/VideoUtils.h index db9e837c8df..67a32a26e63 100644 --- a/dom/media/VideoUtils.h +++ b/dom/media/VideoUtils.h @@ -264,10 +264,14 @@ nsresult GenerateRandomPathName(nsCString& aOutSalt, uint32_t aLength); class MediaTaskQueue; +class FlushableMediaTaskQueue; already_AddRefed CreateMediaDecodeTaskQueue(); +already_AddRefed +CreateFlushableMediaDecodeTaskQueue(); + } // end namespace mozilla #endif diff --git a/dom/media/fmp4/AVCCDecoderModule.cpp b/dom/media/fmp4/AVCCDecoderModule.cpp index d1061355cce..0c48df92ca7 100644 --- a/dom/media/fmp4/AVCCDecoderModule.cpp +++ b/dom/media/fmp4/AVCCDecoderModule.cpp @@ -20,7 +20,7 @@ public: const mp4_demuxer::VideoDecoderConfig& aConfig, layers::LayersBackend aLayersBackend, layers::ImageContainer* aImageContainer, - MediaTaskQueue* aVideoTaskQueue, + FlushableMediaTaskQueue* aVideoTaskQueue, MediaDataDecoderCallback* aCallback); virtual ~AVCCMediaDataDecoder(); @@ -47,7 +47,7 @@ private: mp4_demuxer::VideoDecoderConfig mCurrentConfig; layers::LayersBackend mLayersBackend; nsRefPtr mImageContainer; - nsRefPtr mVideoTaskQueue; + nsRefPtr mVideoTaskQueue; MediaDataDecoderCallback* mCallback; nsRefPtr mDecoder; nsresult mLastError; @@ -57,7 +57,7 @@ AVCCMediaDataDecoder::AVCCMediaDataDecoder(PlatformDecoderModule* aPDM, const mp4_demuxer::VideoDecoderConfig& aConfig, layers::LayersBackend aLayersBackend, layers::ImageContainer* aImageContainer, - MediaTaskQueue* aVideoTaskQueue, + FlushableMediaTaskQueue* aVideoTaskQueue, MediaDataDecoderCallback* aCallback) : mPDM(aPDM) , mCurrentConfig(aConfig) @@ -239,7 +239,7 @@ already_AddRefed AVCCDecoderModule::CreateVideoDecoder(const mp4_demuxer::VideoDecoderConfig& aConfig, layers::LayersBackend aLayersBackend, layers::ImageContainer* aImageContainer, - MediaTaskQueue* aVideoTaskQueue, + FlushableMediaTaskQueue* aVideoTaskQueue, MediaDataDecoderCallback* aCallback) { nsRefPtr decoder; @@ -265,7 +265,7 @@ AVCCDecoderModule::CreateVideoDecoder(const mp4_demuxer::VideoDecoderConfig& aCo already_AddRefed AVCCDecoderModule::CreateAudioDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig, - MediaTaskQueue* aAudioTaskQueue, + FlushableMediaTaskQueue* aAudioTaskQueue, MediaDataDecoderCallback* aCallback) { return mPDM->CreateAudioDecoder(aConfig, diff --git a/dom/media/fmp4/AVCCDecoderModule.h b/dom/media/fmp4/AVCCDecoderModule.h index 99a3d6dd34f..c47862879ac 100644 --- a/dom/media/fmp4/AVCCDecoderModule.h +++ b/dom/media/fmp4/AVCCDecoderModule.h @@ -34,12 +34,12 @@ public: CreateVideoDecoder(const mp4_demuxer::VideoDecoderConfig& aConfig, layers::LayersBackend aLayersBackend, layers::ImageContainer* aImageContainer, - MediaTaskQueue* aVideoTaskQueue, + FlushableMediaTaskQueue* aVideoTaskQueue, MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE; virtual already_AddRefed CreateAudioDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig, - MediaTaskQueue* aAudioTaskQueue, + FlushableMediaTaskQueue* aAudioTaskQueue, MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE; virtual bool SupportsAudioMimeType(const char* aMimeType) MOZ_OVERRIDE; diff --git a/dom/media/fmp4/BlankDecoderModule.cpp b/dom/media/fmp4/BlankDecoderModule.cpp index 37db2aea491..9a5f1df172c 100644 --- a/dom/media/fmp4/BlankDecoderModule.cpp +++ b/dom/media/fmp4/BlankDecoderModule.cpp @@ -23,7 +23,7 @@ class BlankMediaDataDecoder : public MediaDataDecoder { public: BlankMediaDataDecoder(BlankMediaDataCreator* aCreator, - MediaTaskQueue* aTaskQueue, + FlushableMediaTaskQueue* aTaskQueue, MediaDataDecoderCallback* aCallback) : mCreator(aCreator) , mTaskQueue(aTaskQueue) @@ -85,7 +85,7 @@ public: private: nsAutoPtr mCreator; - RefPtr mTaskQueue; + RefPtr mTaskQueue; MediaDataDecoderCallback* mCallback; }; @@ -216,7 +216,7 @@ public: CreateVideoDecoder(const mp4_demuxer::VideoDecoderConfig& aConfig, layers::LayersBackend aLayersBackend, layers::ImageContainer* aImageContainer, - MediaTaskQueue* aVideoTaskQueue, + FlushableMediaTaskQueue* aVideoTaskQueue, MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE { BlankVideoDataCreator* creator = new BlankVideoDataCreator( aConfig.display_width, aConfig.display_height, aImageContainer); @@ -230,7 +230,7 @@ public: // Decode thread. virtual already_AddRefed CreateAudioDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig, - MediaTaskQueue* aAudioTaskQueue, + FlushableMediaTaskQueue* aAudioTaskQueue, MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE { BlankAudioDataCreator* creator = new BlankAudioDataCreator( aConfig.channel_count, aConfig.samples_per_second); diff --git a/dom/media/fmp4/MP4Reader.cpp b/dom/media/fmp4/MP4Reader.cpp index 08b8a8b9cda..dc2aa7a76ee 100644 --- a/dom/media/fmp4/MP4Reader.cpp +++ b/dom/media/fmp4/MP4Reader.cpp @@ -235,10 +235,10 @@ MP4Reader::Init(MediaDecoderReader* aCloneDonor) InitLayersBackendType(); - mAudio.mTaskQueue = new MediaTaskQueue(GetMediaDecodeThreadPool()); + mAudio.mTaskQueue = new FlushableMediaTaskQueue(GetMediaDecodeThreadPool()); NS_ENSURE_TRUE(mAudio.mTaskQueue, NS_ERROR_FAILURE); - mVideo.mTaskQueue = new MediaTaskQueue(GetMediaDecodeThreadPool()); + mVideo.mTaskQueue = new FlushableMediaTaskQueue(GetMediaDecodeThreadPool()); NS_ENSURE_TRUE(mVideo.mTaskQueue, NS_ERROR_FAILURE); static bool sSetupPrefCache = false; @@ -434,8 +434,7 @@ MP4Reader::ReadMetadata(MediaInfo* aInfo, mPlatform = PlatformDecoderModule::CreateCDMWrapper(proxy, HasAudio(), - HasVideo(), - GetTaskQueue()); + HasVideo()); NS_ENSURE_TRUE(mPlatform, NS_ERROR_FAILURE); #else // EME not supported. diff --git a/dom/media/fmp4/MP4Reader.h b/dom/media/fmp4/MP4Reader.h index 0c894a626d7..e8582f79f6c 100644 --- a/dom/media/fmp4/MP4Reader.h +++ b/dom/media/fmp4/MP4Reader.h @@ -185,7 +185,7 @@ private: nsRefPtr mDecoder; // TaskQueue on which decoder can choose to decode. // Only non-null up until the decoder is created. - nsRefPtr mTaskQueue; + nsRefPtr mTaskQueue; // Callback that receives output and error notifications from the decoder. nsAutoPtr mCallback; // Decoded samples returned my mDecoder awaiting being returned to diff --git a/dom/media/fmp4/PlatformDecoderModule.cpp b/dom/media/fmp4/PlatformDecoderModule.cpp index a20365179f6..516fa3bfe86 100644 --- a/dom/media/fmp4/PlatformDecoderModule.cpp +++ b/dom/media/fmp4/PlatformDecoderModule.cpp @@ -86,8 +86,7 @@ PlatformDecoderModule::Init() already_AddRefed PlatformDecoderModule::CreateCDMWrapper(CDMProxy* aProxy, bool aHasAudio, - bool aHasVideo, - MediaTaskQueue* aTaskQueue) + bool aHasVideo) { bool cdmDecodesAudio; bool cdmDecodesVideo; diff --git a/dom/media/fmp4/PlatformDecoderModule.h b/dom/media/fmp4/PlatformDecoderModule.h index 52624de286b..09af0d78589 100644 --- a/dom/media/fmp4/PlatformDecoderModule.h +++ b/dom/media/fmp4/PlatformDecoderModule.h @@ -30,7 +30,7 @@ class ImageContainer; class MediaDataDecoder; class MediaDataDecoderCallback; class MediaInputQueue; -class MediaTaskQueue; +class FlushableMediaTaskQueue; class CDMProxy; typedef int64_t Microseconds; @@ -83,8 +83,7 @@ public: static already_AddRefed CreateCDMWrapper(CDMProxy* aProxy, bool aHasAudio, - bool aHasVideo, - MediaTaskQueue* aTaskQueue); + bool aHasVideo); #endif // Called to shutdown the decoder module and cleanup state. The PDM @@ -109,7 +108,7 @@ public: CreateVideoDecoder(const mp4_demuxer::VideoDecoderConfig& aConfig, layers::LayersBackend aLayersBackend, layers::ImageContainer* aImageContainer, - MediaTaskQueue* aVideoTaskQueue, + FlushableMediaTaskQueue* aVideoTaskQueue, MediaDataDecoderCallback* aCallback) = 0; // Creates an Audio decoder with the specified properties. @@ -124,7 +123,7 @@ public: // This is called on the decode task queue. virtual already_AddRefed CreateAudioDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig, - MediaTaskQueue* aAudioTaskQueue, + FlushableMediaTaskQueue* aAudioTaskQueue, MediaDataDecoderCallback* aCallback) = 0; // An audio decoder module must support AAC by default. diff --git a/dom/media/fmp4/SharedDecoderManager.cpp b/dom/media/fmp4/SharedDecoderManager.cpp index f78bb963d1d..b01e5cc5274 100644 --- a/dom/media/fmp4/SharedDecoderManager.cpp +++ b/dom/media/fmp4/SharedDecoderManager.cpp @@ -55,7 +55,7 @@ public: }; SharedDecoderManager::SharedDecoderManager() - : mTaskQueue(new MediaTaskQueue(GetMediaDecodeThreadPool())) + : mTaskQueue(new FlushableMediaTaskQueue(GetMediaDecodeThreadPool())) , mActiveProxy(nullptr) , mActiveCallback(nullptr) , mWaitForInternalDrain(false) @@ -73,7 +73,7 @@ SharedDecoderManager::CreateVideoDecoder( PlatformDecoderModule* aPDM, const mp4_demuxer::VideoDecoderConfig& aConfig, layers::LayersBackend aLayersBackend, layers::ImageContainer* aImageContainer, - MediaTaskQueue* aVideoTaskQueue, MediaDataDecoderCallback* aCallback) + FlushableMediaTaskQueue* aVideoTaskQueue, MediaDataDecoderCallback* aCallback) { if (!mDecoder) { // We use the manager's task queue for the decoder, rather than the one diff --git a/dom/media/fmp4/SharedDecoderManager.h b/dom/media/fmp4/SharedDecoderManager.h index 6433461576c..4836ef8b7f3 100644 --- a/dom/media/fmp4/SharedDecoderManager.h +++ b/dom/media/fmp4/SharedDecoderManager.h @@ -28,7 +28,7 @@ public: PlatformDecoderModule* aPDM, const mp4_demuxer::VideoDecoderConfig& aConfig, layers::LayersBackend aLayersBackend, - layers::ImageContainer* aImageContainer, MediaTaskQueue* aVideoTaskQueue, + layers::ImageContainer* aImageContainer, FlushableMediaTaskQueue* aVideoTaskQueue, MediaDataDecoderCallback* aCallback); void SetReader(MediaDecoderReader* aReader); @@ -45,7 +45,7 @@ private: void DrainComplete(); nsRefPtr mDecoder; - nsRefPtr mTaskQueue; + nsRefPtr mTaskQueue; SharedDecoderProxy* mActiveProxy; MediaDataDecoderCallback* mActiveCallback; nsAutoPtr mCallback; diff --git a/dom/media/fmp4/android/AndroidDecoderModule.cpp b/dom/media/fmp4/android/AndroidDecoderModule.cpp index 758b3fe51ea..895b4e672d7 100644 --- a/dom/media/fmp4/android/AndroidDecoderModule.cpp +++ b/dom/media/fmp4/android/AndroidDecoderModule.cpp @@ -260,7 +260,7 @@ AndroidDecoderModule::CreateVideoDecoder( const mp4_demuxer::VideoDecoderConfig& aConfig, layers::LayersBackend aLayersBackend, layers::ImageContainer* aImageContainer, - MediaTaskQueue* aVideoTaskQueue, + FlushableMediaTaskQueue* aVideoTaskQueue, MediaDataDecoderCallback* aCallback) { MediaFormat::LocalRef format; @@ -279,7 +279,7 @@ AndroidDecoderModule::CreateVideoDecoder( already_AddRefed AndroidDecoderModule::CreateAudioDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig, - MediaTaskQueue* aAudioTaskQueue, + FlushableMediaTaskQueue* aAudioTaskQueue, MediaDataDecoderCallback* aCallback) { MOZ_ASSERT(aConfig.bits_per_sample == 16, "We only handle 16-bit audio!"); diff --git a/dom/media/fmp4/android/AndroidDecoderModule.h b/dom/media/fmp4/android/AndroidDecoderModule.h index ac21e329a67..1d6c9c31200 100644 --- a/dom/media/fmp4/android/AndroidDecoderModule.h +++ b/dom/media/fmp4/android/AndroidDecoderModule.h @@ -25,12 +25,12 @@ public: CreateVideoDecoder(const mp4_demuxer::VideoDecoderConfig& aConfig, layers::LayersBackend aLayersBackend, layers::ImageContainer* aImageContainer, - MediaTaskQueue* aVideoTaskQueue, + FlushableMediaTaskQueue* aVideoTaskQueue, MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE; virtual already_AddRefed CreateAudioDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig, - MediaTaskQueue* aAudioTaskQueue, + FlushableMediaTaskQueue* aAudioTaskQueue, MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE; diff --git a/dom/media/fmp4/apple/AppleATDecoder.cpp b/dom/media/fmp4/apple/AppleATDecoder.cpp index 498deb4fc22..c98f94deb2f 100644 --- a/dom/media/fmp4/apple/AppleATDecoder.cpp +++ b/dom/media/fmp4/apple/AppleATDecoder.cpp @@ -23,7 +23,7 @@ PRLogModuleInfo* GetAppleMediaLog(); namespace mozilla { AppleATDecoder::AppleATDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig, - MediaTaskQueue* aAudioTaskQueue, + FlushableMediaTaskQueue* aAudioTaskQueue, MediaDataDecoderCallback* aCallback) : mConfig(aConfig) , mFileStreamError(false) diff --git a/dom/media/fmp4/apple/AppleATDecoder.h b/dom/media/fmp4/apple/AppleATDecoder.h index 2d9b9a5ede8..91dd2bf88b3 100644 --- a/dom/media/fmp4/apple/AppleATDecoder.h +++ b/dom/media/fmp4/apple/AppleATDecoder.h @@ -15,13 +15,13 @@ namespace mozilla { -class MediaTaskQueue; +class FlushableMediaTaskQueue; class MediaDataDecoderCallback; class AppleATDecoder : public MediaDataDecoder { public: AppleATDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig, - MediaTaskQueue* aVideoTaskQueue, + FlushableMediaTaskQueue* aVideoTaskQueue, MediaDataDecoderCallback* aCallback); virtual ~AppleATDecoder(); @@ -41,7 +41,7 @@ public: bool mFileStreamError; private: - nsRefPtr mTaskQueue; + nsRefPtr mTaskQueue; MediaDataDecoderCallback* mCallback; AudioConverterRef mConverter; AudioStreamBasicDescription mOutputFormat; diff --git a/dom/media/fmp4/apple/AppleDecoderModule.cpp b/dom/media/fmp4/apple/AppleDecoderModule.cpp index 31e86937f3a..fabb3f30b19 100644 --- a/dom/media/fmp4/apple/AppleDecoderModule.cpp +++ b/dom/media/fmp4/apple/AppleDecoderModule.cpp @@ -158,7 +158,7 @@ already_AddRefed AppleDecoderModule::CreateVideoDecoder(const mp4_demuxer::VideoDecoderConfig& aConfig, layers::LayersBackend aLayersBackend, layers::ImageContainer* aImageContainer, - MediaTaskQueue* aVideoTaskQueue, + FlushableMediaTaskQueue* aVideoTaskQueue, MediaDataDecoderCallback* aCallback) { nsRefPtr decoder; @@ -184,7 +184,7 @@ AppleDecoderModule::CreateVideoDecoder(const mp4_demuxer::VideoDecoderConfig& aC already_AddRefed AppleDecoderModule::CreateAudioDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig, - MediaTaskQueue* aAudioTaskQueue, + FlushableMediaTaskQueue* aAudioTaskQueue, MediaDataDecoderCallback* aCallback) { nsRefPtr decoder = diff --git a/dom/media/fmp4/apple/AppleDecoderModule.h b/dom/media/fmp4/apple/AppleDecoderModule.h index af56e0157c9..43e586a356b 100644 --- a/dom/media/fmp4/apple/AppleDecoderModule.h +++ b/dom/media/fmp4/apple/AppleDecoderModule.h @@ -27,13 +27,13 @@ public: CreateVideoDecoder(const mp4_demuxer::VideoDecoderConfig& aConfig, layers::LayersBackend aLayersBackend, layers::ImageContainer* aImageContainer, - MediaTaskQueue* aVideoTaskQueue, + FlushableMediaTaskQueue* aVideoTaskQueue, MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE; // Decode thread. virtual already_AddRefed CreateAudioDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig, - MediaTaskQueue* aAudioTaskQueue, + FlushableMediaTaskQueue* aAudioTaskQueue, MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE; virtual bool SupportsAudioMimeType(const char* aMimeType) MOZ_OVERRIDE; diff --git a/dom/media/fmp4/apple/AppleVDADecoder.cpp b/dom/media/fmp4/apple/AppleVDADecoder.cpp index 08bfa063094..44d838714b7 100644 --- a/dom/media/fmp4/apple/AppleVDADecoder.cpp +++ b/dom/media/fmp4/apple/AppleVDADecoder.cpp @@ -32,7 +32,7 @@ PRLogModuleInfo* GetAppleMediaLog(); namespace mozilla { AppleVDADecoder::AppleVDADecoder(const mp4_demuxer::VideoDecoderConfig& aConfig, - MediaTaskQueue* aVideoTaskQueue, + FlushableMediaTaskQueue* aVideoTaskQueue, MediaDataDecoderCallback* aCallback, layers::ImageContainer* aImageContainer) : mConfig(aConfig) @@ -495,7 +495,7 @@ AppleVDADecoder::CreateOutputConfiguration() already_AddRefed AppleVDADecoder::CreateVDADecoder( const mp4_demuxer::VideoDecoderConfig& aConfig, - MediaTaskQueue* aVideoTaskQueue, + FlushableMediaTaskQueue* aVideoTaskQueue, MediaDataDecoderCallback* aCallback, layers::ImageContainer* aImageContainer) { diff --git a/dom/media/fmp4/apple/AppleVDADecoder.h b/dom/media/fmp4/apple/AppleVDADecoder.h index 785721bbf90..8875dabb0ff 100644 --- a/dom/media/fmp4/apple/AppleVDADecoder.h +++ b/dom/media/fmp4/apple/AppleVDADecoder.h @@ -18,7 +18,7 @@ namespace mozilla { -class MediaTaskQueue; +class FlushableMediaTaskQueue; class MediaDataDecoderCallback; namespace layers { class ImageContainer; @@ -61,12 +61,12 @@ public: // not supported by current configuration. static already_AddRefed CreateVDADecoder( const mp4_demuxer::VideoDecoderConfig& aConfig, - MediaTaskQueue* aVideoTaskQueue, + FlushableMediaTaskQueue* aVideoTaskQueue, MediaDataDecoderCallback* aCallback, layers::ImageContainer* aImageContainer); AppleVDADecoder(const mp4_demuxer::VideoDecoderConfig& aConfig, - MediaTaskQueue* aVideoTaskQueue, + FlushableMediaTaskQueue* aVideoTaskQueue, MediaDataDecoderCallback* aCallback, layers::ImageContainer* aImageContainer); virtual ~AppleVDADecoder(); @@ -86,7 +86,7 @@ public: CFDictionaryRef CreateOutputConfiguration(); const mp4_demuxer::VideoDecoderConfig& mConfig; - nsRefPtr mTaskQueue; + nsRefPtr mTaskQueue; MediaDataDecoderCallback* mCallback; nsRefPtr mImageContainer; ReorderQueue mReorderQueue; diff --git a/dom/media/fmp4/apple/AppleVTDecoder.cpp b/dom/media/fmp4/apple/AppleVTDecoder.cpp index 8ccc218e78e..addf5be4db0 100644 --- a/dom/media/fmp4/apple/AppleVTDecoder.cpp +++ b/dom/media/fmp4/apple/AppleVTDecoder.cpp @@ -35,7 +35,7 @@ PRLogModuleInfo* GetAppleMediaLog(); namespace mozilla { AppleVTDecoder::AppleVTDecoder(const mp4_demuxer::VideoDecoderConfig& aConfig, - MediaTaskQueue* aVideoTaskQueue, + FlushableMediaTaskQueue* aVideoTaskQueue, MediaDataDecoderCallback* aCallback, layers::ImageContainer* aImageContainer) : AppleVDADecoder(aConfig, aVideoTaskQueue, aCallback, aImageContainer) diff --git a/dom/media/fmp4/apple/AppleVTDecoder.h b/dom/media/fmp4/apple/AppleVTDecoder.h index b3686335737..5011b10ace0 100644 --- a/dom/media/fmp4/apple/AppleVTDecoder.h +++ b/dom/media/fmp4/apple/AppleVTDecoder.h @@ -16,7 +16,7 @@ namespace mozilla { class AppleVTDecoder : public AppleVDADecoder { public: AppleVTDecoder(const mp4_demuxer::VideoDecoderConfig& aConfig, - MediaTaskQueue* aVideoTaskQueue, + FlushableMediaTaskQueue* aVideoTaskQueue, MediaDataDecoderCallback* aCallback, layers::ImageContainer* aImageContainer); virtual ~AppleVTDecoder(); diff --git a/dom/media/fmp4/eme/EMEDecoderModule.cpp b/dom/media/fmp4/eme/EMEDecoderModule.cpp index 4907f573eee..8d220300b76 100644 --- a/dom/media/fmp4/eme/EMEDecoderModule.cpp +++ b/dom/media/fmp4/eme/EMEDecoderModule.cpp @@ -25,7 +25,7 @@ public: CDMProxy* aProxy) : mDecoder(aDecoder) , mCallback(aCallback) - , mTaskQueue(CreateMediaDecodeTaskQueue()) + , mTaskQueue(CreateFlushableMediaDecodeTaskQueue()) , mProxy(aProxy) , mSamplesWaitingForKey(new SamplesWaitingForKey(this, mTaskQueue, mProxy)) #ifdef DEBUG @@ -44,7 +44,7 @@ public: class DeliverDecrypted : public DecryptionClient { public: - DeliverDecrypted(EMEDecryptor* aDecryptor, MediaTaskQueue* aTaskQueue) + DeliverDecrypted(EMEDecryptor* aDecryptor, FlushableMediaTaskQueue* aTaskQueue) : mDecryptor(aDecryptor) , mTaskQueue(aTaskQueue) {} @@ -73,7 +73,7 @@ public: } private: nsRefPtr mDecryptor; - nsRefPtr mTaskQueue; + nsRefPtr mTaskQueue; }; virtual nsresult Input(MP4Sample* aSample) MOZ_OVERRIDE { @@ -149,7 +149,7 @@ private: nsRefPtr mDecoder; MediaDataDecoderCallback* mCallback; - nsRefPtr mTaskQueue; + nsRefPtr mTaskQueue; nsRefPtr mProxy; nsRefPtr mSamplesWaitingForKey; #ifdef DEBUG @@ -159,7 +159,7 @@ private: class EMEMediaDataDecoderProxy : public MediaDataDecoderProxy { public: - EMEMediaDataDecoderProxy(nsIThread* aProxyThread, MediaDataDecoderCallback* aCallback, CDMProxy* aProxy, MediaTaskQueue* aTaskQueue) + EMEMediaDataDecoderProxy(nsIThread* aProxyThread, MediaDataDecoderCallback* aCallback, CDMProxy* aProxy, FlushableMediaTaskQueue* aTaskQueue) : MediaDataDecoderProxy(aProxyThread, aCallback) , mSamplesWaitingForKey(new SamplesWaitingForKey(this, aTaskQueue, aProxy)) { @@ -218,7 +218,7 @@ EMEDecoderModule::Shutdown() } static already_AddRefed -CreateDecoderWrapper(MediaDataDecoderCallback* aCallback, CDMProxy* aProxy, MediaTaskQueue* aTaskQueue) +CreateDecoderWrapper(MediaDataDecoderCallback* aCallback, CDMProxy* aProxy, FlushableMediaTaskQueue* aTaskQueue) { nsCOMPtr gmpService = do_GetService("@mozilla.org/gecko-media-plugin-service;1"); if (!gmpService) { @@ -239,7 +239,7 @@ already_AddRefed EMEDecoderModule::CreateVideoDecoder(const VideoDecoderConfig& aConfig, layers::LayersBackend aLayersBackend, layers::ImageContainer* aImageContainer, - MediaTaskQueue* aVideoTaskQueue, + FlushableMediaTaskQueue* aVideoTaskQueue, MediaDataDecoderCallback* aCallback) { if (mCDMDecodesVideo && aConfig.crypto.valid) { @@ -274,7 +274,7 @@ EMEDecoderModule::CreateVideoDecoder(const VideoDecoderConfig& aConfig, already_AddRefed EMEDecoderModule::CreateAudioDecoder(const AudioDecoderConfig& aConfig, - MediaTaskQueue* aAudioTaskQueue, + FlushableMediaTaskQueue* aAudioTaskQueue, MediaDataDecoderCallback* aCallback) { if (mCDMDecodesAudio && aConfig.crypto.valid) { diff --git a/dom/media/fmp4/eme/EMEDecoderModule.h b/dom/media/fmp4/eme/EMEDecoderModule.h index bafe593fa00..411ca78c72a 100644 --- a/dom/media/fmp4/eme/EMEDecoderModule.h +++ b/dom/media/fmp4/eme/EMEDecoderModule.h @@ -13,7 +13,7 @@ namespace mozilla { class CDMProxy; -class MediaTaskQueue; +class FlushableMediaTaskQueue; class EMEDecoderModule : public PlatformDecoderModule { private: @@ -36,13 +36,13 @@ public: CreateVideoDecoder(const mp4_demuxer::VideoDecoderConfig& aConfig, layers::LayersBackend aLayersBackend, layers::ImageContainer* aImageContainer, - MediaTaskQueue* aVideoTaskQueue, + FlushableMediaTaskQueue* aVideoTaskQueue, MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE; // Decode thread. virtual already_AddRefed CreateAudioDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig, - MediaTaskQueue* aAudioTaskQueue, + FlushableMediaTaskQueue* aAudioTaskQueue, MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE; virtual bool @@ -53,7 +53,7 @@ private: // Will be null if CDM has decoding capability. nsRefPtr mPDM; // We run the PDM on its own task queue. - nsRefPtr mTaskQueue; + nsRefPtr mTaskQueue; bool mCDMDecodesAudio; bool mCDMDecodesVideo; diff --git a/dom/media/fmp4/ffmpeg/FFmpegAudioDecoder.cpp b/dom/media/fmp4/ffmpeg/FFmpegAudioDecoder.cpp index a56f461488b..00e1bfb5449 100644 --- a/dom/media/fmp4/ffmpeg/FFmpegAudioDecoder.cpp +++ b/dom/media/fmp4/ffmpeg/FFmpegAudioDecoder.cpp @@ -18,7 +18,7 @@ namespace mozilla { FFmpegAudioDecoder::FFmpegAudioDecoder( - MediaTaskQueue* aTaskQueue, MediaDataDecoderCallback* aCallback, + FlushableMediaTaskQueue* aTaskQueue, MediaDataDecoderCallback* aCallback, const mp4_demuxer::AudioDecoderConfig& aConfig) : FFmpegDataDecoder(aTaskQueue, GetCodecId(aConfig.mime_type)) , mCallback(aCallback) diff --git a/dom/media/fmp4/ffmpeg/FFmpegAudioDecoder.h b/dom/media/fmp4/ffmpeg/FFmpegAudioDecoder.h index 9f7bfa6b9ad..31d0b18da21 100644 --- a/dom/media/fmp4/ffmpeg/FFmpegAudioDecoder.h +++ b/dom/media/fmp4/ffmpeg/FFmpegAudioDecoder.h @@ -21,7 +21,7 @@ template <> class FFmpegAudioDecoder : public FFmpegDataDecoder { public: - FFmpegAudioDecoder(MediaTaskQueue* aTaskQueue, + FFmpegAudioDecoder(FlushableMediaTaskQueue* aTaskQueue, MediaDataDecoderCallback* aCallback, const mp4_demuxer::AudioDecoderConfig& aConfig); virtual ~FFmpegAudioDecoder(); diff --git a/dom/media/fmp4/ffmpeg/FFmpegDataDecoder.cpp b/dom/media/fmp4/ffmpeg/FFmpegDataDecoder.cpp index dbf310ee97a..9a0ab0a5f88 100644 --- a/dom/media/fmp4/ffmpeg/FFmpegDataDecoder.cpp +++ b/dom/media/fmp4/ffmpeg/FFmpegDataDecoder.cpp @@ -19,7 +19,7 @@ namespace mozilla bool FFmpegDataDecoder::sFFmpegInitDone = false; StaticMutex FFmpegDataDecoder::sMonitor; -FFmpegDataDecoder::FFmpegDataDecoder(MediaTaskQueue* aTaskQueue, +FFmpegDataDecoder::FFmpegDataDecoder(FlushableMediaTaskQueue* aTaskQueue, AVCodecID aCodecID) : mTaskQueue(aTaskQueue) , mCodecContext(nullptr) diff --git a/dom/media/fmp4/ffmpeg/FFmpegDataDecoder.h b/dom/media/fmp4/ffmpeg/FFmpegDataDecoder.h index 8a402e8aefc..99749620599 100644 --- a/dom/media/fmp4/ffmpeg/FFmpegDataDecoder.h +++ b/dom/media/fmp4/ffmpeg/FFmpegDataDecoder.h @@ -24,7 +24,7 @@ template <> class FFmpegDataDecoder : public MediaDataDecoder { public: - FFmpegDataDecoder(MediaTaskQueue* aTaskQueue, AVCodecID aCodecID); + FFmpegDataDecoder(FlushableMediaTaskQueue* aTaskQueue, AVCodecID aCodecID); virtual ~FFmpegDataDecoder(); static bool Link(); @@ -38,7 +38,7 @@ public: protected: AVFrame* PrepareFrame(); - MediaTaskQueue* mTaskQueue; + FlushableMediaTaskQueue* mTaskQueue; AVCodecContext* mCodecContext; AVFrame* mFrame; nsRefPtr mExtraData; diff --git a/dom/media/fmp4/ffmpeg/FFmpegDecoderModule.h b/dom/media/fmp4/ffmpeg/FFmpegDecoderModule.h index 821c5cd447f..fed889f456a 100644 --- a/dom/media/fmp4/ffmpeg/FFmpegDecoderModule.h +++ b/dom/media/fmp4/ffmpeg/FFmpegDecoderModule.h @@ -34,7 +34,7 @@ public: CreateVideoDecoder(const mp4_demuxer::VideoDecoderConfig& aConfig, layers::LayersBackend aLayersBackend, layers::ImageContainer* aImageContainer, - MediaTaskQueue* aVideoTaskQueue, + FlushableMediaTaskQueue* aVideoTaskQueue, MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE { nsRefPtr decoder = @@ -45,7 +45,7 @@ public: virtual already_AddRefed CreateAudioDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig, - MediaTaskQueue* aAudioTaskQueue, + FlushableMediaTaskQueue* aAudioTaskQueue, MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE { nsRefPtr decoder = diff --git a/dom/media/fmp4/ffmpeg/FFmpegH264Decoder.cpp b/dom/media/fmp4/ffmpeg/FFmpegH264Decoder.cpp index 6a08fcbbb41..685fea954c9 100644 --- a/dom/media/fmp4/ffmpeg/FFmpegH264Decoder.cpp +++ b/dom/media/fmp4/ffmpeg/FFmpegH264Decoder.cpp @@ -25,7 +25,7 @@ namespace mozilla { FFmpegH264Decoder::FFmpegH264Decoder( - MediaTaskQueue* aTaskQueue, MediaDataDecoderCallback* aCallback, + FlushableMediaTaskQueue* aTaskQueue, MediaDataDecoderCallback* aCallback, const mp4_demuxer::VideoDecoderConfig& aConfig, ImageContainer* aImageContainer) : FFmpegDataDecoder(aTaskQueue, GetCodecId(aConfig.mime_type)) diff --git a/dom/media/fmp4/ffmpeg/FFmpegH264Decoder.h b/dom/media/fmp4/ffmpeg/FFmpegH264Decoder.h index df1c1485be0..26b69bdf36a 100644 --- a/dom/media/fmp4/ffmpeg/FFmpegH264Decoder.h +++ b/dom/media/fmp4/ffmpeg/FFmpegH264Decoder.h @@ -30,7 +30,7 @@ class FFmpegH264Decoder : public FFmpegDataDecoder }; public: - FFmpegH264Decoder(MediaTaskQueue* aTaskQueue, + FFmpegH264Decoder(FlushableMediaTaskQueue* aTaskQueue, MediaDataDecoderCallback* aCallback, const mp4_demuxer::VideoDecoderConfig& aConfig, ImageContainer* aImageContainer); diff --git a/dom/media/fmp4/gmp/GMPDecoderModule.cpp b/dom/media/fmp4/gmp/GMPDecoderModule.cpp index ccfaf6b4b50..dc8cd145130 100644 --- a/dom/media/fmp4/gmp/GMPDecoderModule.cpp +++ b/dom/media/fmp4/gmp/GMPDecoderModule.cpp @@ -49,7 +49,7 @@ already_AddRefed GMPDecoderModule::CreateVideoDecoder(const mp4_demuxer::VideoDecoderConfig& aConfig, layers::LayersBackend aLayersBackend, layers::ImageContainer* aImageContainer, - MediaTaskQueue* aVideoTaskQueue, + FlushableMediaTaskQueue* aVideoTaskQueue, MediaDataDecoderCallback* aCallback) { if (strcmp(aConfig.mime_type, "video/avc") != 0) { @@ -67,7 +67,7 @@ GMPDecoderModule::CreateVideoDecoder(const mp4_demuxer::VideoDecoderConfig& aCon already_AddRefed GMPDecoderModule::CreateAudioDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig, - MediaTaskQueue* aAudioTaskQueue, + FlushableMediaTaskQueue* aAudioTaskQueue, MediaDataDecoderCallback* aCallback) { if (strcmp(aConfig.mime_type, "audio/mp4a-latm") != 0) { diff --git a/dom/media/fmp4/gmp/GMPDecoderModule.h b/dom/media/fmp4/gmp/GMPDecoderModule.h index 82819993b4a..153fdf81bf0 100644 --- a/dom/media/fmp4/gmp/GMPDecoderModule.h +++ b/dom/media/fmp4/gmp/GMPDecoderModule.h @@ -25,13 +25,13 @@ public: CreateVideoDecoder(const mp4_demuxer::VideoDecoderConfig& aConfig, layers::LayersBackend aLayersBackend, layers::ImageContainer* aImageContainer, - MediaTaskQueue* aVideoTaskQueue, + FlushableMediaTaskQueue* aVideoTaskQueue, MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE; // Decode thread. virtual already_AddRefed CreateAudioDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig, - MediaTaskQueue* aAudioTaskQueue, + FlushableMediaTaskQueue* aAudioTaskQueue, MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE; virtual bool DecoderNeedsAVCC(const mp4_demuxer::VideoDecoderConfig& aConfig) MOZ_OVERRIDE; diff --git a/dom/media/fmp4/gonk/GonkDecoderModule.cpp b/dom/media/fmp4/gonk/GonkDecoderModule.cpp index ffb553275f2..a402aa78e00 100644 --- a/dom/media/fmp4/gonk/GonkDecoderModule.cpp +++ b/dom/media/fmp4/gonk/GonkDecoderModule.cpp @@ -36,7 +36,7 @@ already_AddRefed GonkDecoderModule::CreateVideoDecoder(const mp4_demuxer::VideoDecoderConfig& aConfig, mozilla::layers::LayersBackend aLayersBackend, mozilla::layers::ImageContainer* aImageContainer, - MediaTaskQueue* aVideoTaskQueue, + FlushableMediaTaskQueue* aVideoTaskQueue, MediaDataDecoderCallback* aCallback) { nsRefPtr decoder = @@ -48,7 +48,7 @@ GonkDecoderModule::CreateVideoDecoder(const mp4_demuxer::VideoDecoderConfig& aCo already_AddRefed GonkDecoderModule::CreateAudioDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig, - MediaTaskQueue* aAudioTaskQueue, + FlushableMediaTaskQueue* aAudioTaskQueue, MediaDataDecoderCallback* aCallback) { nsRefPtr decoder = diff --git a/dom/media/fmp4/gonk/GonkDecoderModule.h b/dom/media/fmp4/gonk/GonkDecoderModule.h index fd228bb9763..0e740d79ad2 100644 --- a/dom/media/fmp4/gonk/GonkDecoderModule.h +++ b/dom/media/fmp4/gonk/GonkDecoderModule.h @@ -24,13 +24,13 @@ public: CreateVideoDecoder(const mp4_demuxer::VideoDecoderConfig& aConfig, mozilla::layers::LayersBackend aLayersBackend, mozilla::layers::ImageContainer* aImageContainer, - MediaTaskQueue* aVideoTaskQueue, + FlushableMediaTaskQueue* aVideoTaskQueue, MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE; // Decode thread. virtual already_AddRefed CreateAudioDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig, - MediaTaskQueue* aAudioTaskQueue, + FlushableMediaTaskQueue* aAudioTaskQueue, MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE; static void Init(); diff --git a/dom/media/fmp4/gonk/GonkMediaDataDecoder.cpp b/dom/media/fmp4/gonk/GonkMediaDataDecoder.cpp index eb31e3faed6..cee59176414 100644 --- a/dom/media/fmp4/gonk/GonkMediaDataDecoder.cpp +++ b/dom/media/fmp4/gonk/GonkMediaDataDecoder.cpp @@ -117,7 +117,7 @@ GonkDecoderManager::Flush() } GonkMediaDataDecoder::GonkMediaDataDecoder(GonkDecoderManager* aManager, - MediaTaskQueue* aTaskQueue, + FlushableMediaTaskQueue* aTaskQueue, MediaDataDecoderCallback* aCallback) : mTaskQueue(aTaskQueue) , mCallback(aCallback) diff --git a/dom/media/fmp4/gonk/GonkMediaDataDecoder.h b/dom/media/fmp4/gonk/GonkMediaDataDecoder.h index e66272cd19e..14eece787a1 100644 --- a/dom/media/fmp4/gonk/GonkMediaDataDecoder.h +++ b/dom/media/fmp4/gonk/GonkMediaDataDecoder.h @@ -83,7 +83,7 @@ protected: class GonkMediaDataDecoder : public MediaDataDecoder { public: GonkMediaDataDecoder(GonkDecoderManager* aDecoderManager, - MediaTaskQueue* aTaskQueue, + FlushableMediaTaskQueue* aTaskQueue, MediaDataDecoderCallback* aCallback); ~GonkMediaDataDecoder(); @@ -122,7 +122,7 @@ private: // all available output. void ProcessDrain(); - RefPtr mTaskQueue; + RefPtr mTaskQueue; MediaDataDecoderCallback* mCallback; android::sp mDecoder; diff --git a/dom/media/fmp4/wmf/WMFDecoderModule.cpp b/dom/media/fmp4/wmf/WMFDecoderModule.cpp index 4145792b916..e0abde3b2a8 100644 --- a/dom/media/fmp4/wmf/WMFDecoderModule.cpp +++ b/dom/media/fmp4/wmf/WMFDecoderModule.cpp @@ -68,7 +68,7 @@ already_AddRefed WMFDecoderModule::CreateVideoDecoder(const mp4_demuxer::VideoDecoderConfig& aConfig, layers::LayersBackend aLayersBackend, layers::ImageContainer* aImageContainer, - MediaTaskQueue* aVideoTaskQueue, + FlushableMediaTaskQueue* aVideoTaskQueue, MediaDataDecoderCallback* aCallback) { nsRefPtr decoder = @@ -83,7 +83,7 @@ WMFDecoderModule::CreateVideoDecoder(const mp4_demuxer::VideoDecoderConfig& aCon already_AddRefed WMFDecoderModule::CreateAudioDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig, - MediaTaskQueue* aAudioTaskQueue, + FlushableMediaTaskQueue* aAudioTaskQueue, MediaDataDecoderCallback* aCallback) { nsRefPtr decoder = diff --git a/dom/media/fmp4/wmf/WMFDecoderModule.h b/dom/media/fmp4/wmf/WMFDecoderModule.h index fb3281d43e2..8045483e35f 100644 --- a/dom/media/fmp4/wmf/WMFDecoderModule.h +++ b/dom/media/fmp4/wmf/WMFDecoderModule.h @@ -26,12 +26,12 @@ public: CreateVideoDecoder(const mp4_demuxer::VideoDecoderConfig& aConfig, layers::LayersBackend aLayersBackend, layers::ImageContainer* aImageContainer, - MediaTaskQueue* aVideoTaskQueue, + FlushableMediaTaskQueue* aVideoTaskQueue, MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE; virtual already_AddRefed CreateAudioDecoder(const mp4_demuxer::AudioDecoderConfig& aConfig, - MediaTaskQueue* aAudioTaskQueue, + FlushableMediaTaskQueue* aAudioTaskQueue, MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE; bool SupportsVideoMimeType(const char* aMimeType) MOZ_OVERRIDE; diff --git a/dom/media/fmp4/wmf/WMFMediaDataDecoder.cpp b/dom/media/fmp4/wmf/WMFMediaDataDecoder.cpp index 8d89c1d699c..54c9002e944 100644 --- a/dom/media/fmp4/wmf/WMFMediaDataDecoder.cpp +++ b/dom/media/fmp4/wmf/WMFMediaDataDecoder.cpp @@ -22,7 +22,7 @@ PRLogModuleInfo* GetDemuxerLog(); namespace mozilla { WMFMediaDataDecoder::WMFMediaDataDecoder(MFTManager* aMFTManager, - MediaTaskQueue* aTaskQueue, + FlushableMediaTaskQueue* aTaskQueue, MediaDataDecoderCallback* aCallback) : mTaskQueue(aTaskQueue) , mCallback(aCallback) diff --git a/dom/media/fmp4/wmf/WMFMediaDataDecoder.h b/dom/media/fmp4/wmf/WMFMediaDataDecoder.h index 0d6424ab39e..300cf3d99d3 100644 --- a/dom/media/fmp4/wmf/WMFMediaDataDecoder.h +++ b/dom/media/fmp4/wmf/WMFMediaDataDecoder.h @@ -59,7 +59,7 @@ public: class WMFMediaDataDecoder : public MediaDataDecoder { public: WMFMediaDataDecoder(MFTManager* aOutputSource, - MediaTaskQueue* aAudioTaskQueue, + FlushableMediaTaskQueue* aAudioTaskQueue, MediaDataDecoderCallback* aCallback); ~WMFMediaDataDecoder(); @@ -97,7 +97,7 @@ private: void ProcessShutdown(); void ProcessReleaseDecoder(); - RefPtr mTaskQueue; + RefPtr mTaskQueue; MediaDataDecoderCallback* mCallback; RefPtr mDecoder; diff --git a/dom/media/fmp4/wmf/WMFVideoMFTManager.h b/dom/media/fmp4/wmf/WMFVideoMFTManager.h index 0b61ba58684..acfd88dc5f1 100644 --- a/dom/media/fmp4/wmf/WMFVideoMFTManager.h +++ b/dom/media/fmp4/wmf/WMFVideoMFTManager.h @@ -61,7 +61,7 @@ private: RefPtr mDecoder; RefPtr mImageContainer; nsAutoPtr mDXVA2Manager; - RefPtr mTaskQueue; + RefPtr mTaskQueue; MediaDataDecoderCallback* mCallback; const bool mDXVAEnabled; diff --git a/dom/media/omx/MediaCodecReader.cpp b/dom/media/omx/MediaCodecReader.cpp index 6b0ecb06bd8..47e28e578d0 100644 --- a/dom/media/omx/MediaCodecReader.cpp +++ b/dom/media/omx/MediaCodecReader.cpp @@ -1306,12 +1306,12 @@ MediaCodecReader::CreateTaskQueues() { if (mAudioTrack.mSource != nullptr && mAudioTrack.mCodec != nullptr && !mAudioTrack.mTaskQueue) { - mAudioTrack.mTaskQueue = CreateMediaDecodeTaskQueue(); + mAudioTrack.mTaskQueue = CreateFlushableMediaDecodeTaskQueue(); NS_ENSURE_TRUE(mAudioTrack.mTaskQueue, false); } if (mVideoTrack.mSource != nullptr && mVideoTrack.mCodec != nullptr && !mVideoTrack.mTaskQueue) { - mVideoTrack.mTaskQueue = CreateMediaDecodeTaskQueue(); + mVideoTrack.mTaskQueue = CreateFlushableMediaDecodeTaskQueue(); NS_ENSURE_TRUE(mVideoTrack.mTaskQueue, false); mVideoTrack.mReleaseBufferTaskQueue = CreateMediaDecodeTaskQueue(); NS_ENSURE_TRUE(mVideoTrack.mReleaseBufferTaskQueue, false); diff --git a/dom/media/omx/MediaCodecReader.h b/dom/media/omx/MediaCodecReader.h index 475e369be19..80157f0e1b2 100644 --- a/dom/media/omx/MediaCodecReader.h +++ b/dom/media/omx/MediaCodecReader.h @@ -41,7 +41,7 @@ class GonkNativeWindow; namespace mozilla { -class MediaTaskQueue; +class FlushableMediaTaskQueue; class MP3FrameParser; namespace layers { @@ -164,7 +164,7 @@ protected: int64_t mSeekTimeUs; bool mFlushed; // meaningless when mSeekTimeUs is invalid. bool mDiscontinuity; - nsRefPtr mTaskQueue; + nsRefPtr mTaskQueue; Monitor mTrackMonitor; private: diff --git a/dom/media/webm/IntelWebMVideoDecoder.h b/dom/media/webm/IntelWebMVideoDecoder.h index d43ff68d8de..35d9b5538fc 100644 --- a/dom/media/webm/IntelWebMVideoDecoder.h +++ b/dom/media/webm/IntelWebMVideoDecoder.h @@ -64,7 +64,7 @@ private: // TaskQueue on which decoder can choose to decode. // Only non-null up until the decoder is created. - nsRefPtr mTaskQueue; + nsRefPtr mTaskQueue; // Monitor that protects all non-threadsafe state; the primitives // that follow. diff --git a/dom/media/webm/WebMReader.cpp b/dom/media/webm/WebMReader.cpp index 2d72cbc5efc..4879f1f6379 100644 --- a/dom/media/webm/WebMReader.cpp +++ b/dom/media/webm/WebMReader.cpp @@ -249,7 +249,7 @@ nsresult WebMReader::Init(MediaDecoderReader* aCloneDonor) InitLayersBackendType(); - mVideoTaskQueue = new MediaTaskQueue( + mVideoTaskQueue = new FlushableMediaTaskQueue( SharedThreadPool::Get(NS_LITERAL_CSTRING("IntelVP8 Video Decode"))); NS_ENSURE_TRUE(mVideoTaskQueue, NS_ERROR_FAILURE); } diff --git a/dom/media/webm/WebMReader.h b/dom/media/webm/WebMReader.h index 40b370dff5d..23bebb0b087 100644 --- a/dom/media/webm/WebMReader.h +++ b/dom/media/webm/WebMReader.h @@ -186,7 +186,7 @@ public: uint64_t GetLastVideoFrameTime(); void SetLastVideoFrameTime(uint64_t aFrameTime); layers::LayersBackend GetLayersBackendType() { return mLayersBackendType; } - MediaTaskQueue* GetVideoTaskQueue() { return mVideoTaskQueue; } + FlushableMediaTaskQueue* GetVideoTaskQueue() { return mVideoTaskQueue; } protected: // Setup opus decoder @@ -277,7 +277,7 @@ private: layers::LayersBackend mLayersBackendType; // For hardware video decoding. - nsRefPtr mVideoTaskQueue; + nsRefPtr mVideoTaskQueue; // Booleans to indicate if we have audio and/or video data bool mHasVideo;