mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Bug 1184634
- Rename MediaTaskQueue to TaskQueue. r=gerald
This commit is contained in:
parent
78001ffc43
commit
997543e6ba
@ -6,7 +6,7 @@
|
||||
|
||||
#include "AbstractThread.h"
|
||||
|
||||
#include "MediaTaskQueue.h"
|
||||
#include "TaskQueue.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "TaskDispatcher.h"
|
||||
|
||||
|
@ -17,18 +17,18 @@
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class MediaTaskQueue;
|
||||
class TaskQueue;
|
||||
class TaskDispatcher;
|
||||
|
||||
/*
|
||||
* We often want to run tasks on a target that guarantees that events will never
|
||||
* run in parallel. There are various target types that achieve this - namely
|
||||
* nsIThread and MediaTaskQueue. Note that nsIThreadPool (which implements
|
||||
* nsIThread and TaskQueue. Note that nsIThreadPool (which implements
|
||||
* nsIEventTarget) does not have this property, so we do not want to use
|
||||
* nsIEventTarget for this purpose. This class encapsulates the specifics of
|
||||
* the structures we might use here and provides a consistent interface.
|
||||
*
|
||||
* At present, the supported AbstractThread implementations are MediaTaskQueue
|
||||
* At present, the supported AbstractThread implementations are TaskQueue
|
||||
* and AbstractThread::MainThread. If you add support for another thread that is
|
||||
* not the MainThread, you'll need to figure out how to make it unique such that
|
||||
* comparing AbstractThread pointers is equivalent to comparing nsIThread pointers.
|
||||
@ -53,7 +53,7 @@ public:
|
||||
virtual bool IsCurrentThreadIn() = 0;
|
||||
|
||||
// Returns true if dispatch is generally reliable. This is used to guard
|
||||
// against FlushableMediaTaskQueues, which should go away.
|
||||
// against FlushableTaskQueues, which should go away.
|
||||
virtual bool IsDispatchReliable() { return true; }
|
||||
|
||||
// Returns a TaskDispatcher that will dispatch its tasks when the currently-
|
||||
@ -70,7 +70,7 @@ public:
|
||||
// aThread go through the tail dispatcher.
|
||||
bool RequiresTailDispatch(AbstractThread* aThread) const;
|
||||
|
||||
virtual MediaTaskQueue* AsTaskQueue() { MOZ_CRASH("Not a task queue!"); }
|
||||
virtual TaskQueue* AsTaskQueue() { MOZ_CRASH("Not a task queue!"); }
|
||||
virtual nsIThread* AsXPCOMThread() { MOZ_CRASH("Not an XPCOM thread!"); }
|
||||
|
||||
// Convenience method for getting an AbstractThread for the main thread.
|
||||
|
@ -6,7 +6,7 @@
|
||||
/*
|
||||
Each video element based on MediaDecoder has a state machine to manage
|
||||
its play state and keep the current frame up to date. All state machines
|
||||
share time in a single shared thread. Each decoder also has a MediaTaskQueue
|
||||
share time in a single shared thread. Each decoder also has a TaskQueue
|
||||
running in a SharedThreadPool to decode audio and video data.
|
||||
Each decoder also has a thread to push decoded audio
|
||||
to the hardware. This thread is not created until playback starts, but
|
||||
|
@ -63,12 +63,12 @@ public:
|
||||
};
|
||||
|
||||
MediaDecoderReader::MediaDecoderReader(AbstractMediaDecoder* aDecoder,
|
||||
MediaTaskQueue* aBorrowedTaskQueue)
|
||||
TaskQueue* aBorrowedTaskQueue)
|
||||
: mAudioCompactor(mAudioQueue)
|
||||
, mDecoder(aDecoder)
|
||||
, mTaskQueue(aBorrowedTaskQueue ? aBorrowedTaskQueue
|
||||
: new MediaTaskQueue(GetMediaThreadPool(MediaThreadType::PLAYBACK),
|
||||
/* aSupportsTailDispatch = */ true))
|
||||
: new TaskQueue(GetMediaThreadPool(MediaThreadType::PLAYBACK),
|
||||
/* aSupportsTailDispatch = */ true))
|
||||
, mWatchManager(this, mTaskQueue)
|
||||
, mTimer(new MediaTimer())
|
||||
, mBuffered(mTaskQueue, TimeIntervals(), "MediaDecoderReader::mBuffered (Canonical)")
|
||||
|
@ -81,7 +81,7 @@ public:
|
||||
|
||||
// The caller must ensure that Shutdown() is called before aDecoder is
|
||||
// destroyed.
|
||||
explicit MediaDecoderReader(AbstractMediaDecoder* aDecoder, MediaTaskQueue* aBorrowedTaskQueue = nullptr);
|
||||
explicit MediaDecoderReader(AbstractMediaDecoder* aDecoder, TaskQueue* aBorrowedTaskQueue = nullptr);
|
||||
|
||||
// Does any spinup that needs to happen on this task queue. This runs on a
|
||||
// different thread than Init, and there should not be ordering dependencies
|
||||
@ -310,7 +310,7 @@ public:
|
||||
OwnerThread()->Dispatch(r.forget());
|
||||
}
|
||||
|
||||
MediaTaskQueue* OwnerThread() {
|
||||
TaskQueue* OwnerThread() {
|
||||
return mTaskQueue;
|
||||
}
|
||||
|
||||
@ -365,7 +365,7 @@ protected:
|
||||
AbstractMediaDecoder* mDecoder;
|
||||
|
||||
// Decode task queue.
|
||||
nsRefPtr<MediaTaskQueue> mTaskQueue;
|
||||
nsRefPtr<TaskQueue> mTaskQueue;
|
||||
|
||||
// State-watching manager.
|
||||
WatchManager<MediaDecoderReader> mWatchManager;
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include "nsContentUtils.h"
|
||||
#include "MediaShutdownManager.h"
|
||||
#include "SharedThreadPool.h"
|
||||
#include "MediaTaskQueue.h"
|
||||
#include "TaskQueue.h"
|
||||
#include "nsIEventTarget.h"
|
||||
#include "prenv.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
@ -182,8 +182,8 @@ MediaDecoderStateMachine::MediaDecoderStateMachine(MediaDecoder* aDecoder,
|
||||
MediaDecoderReader* aReader,
|
||||
bool aRealTime) :
|
||||
mDecoder(aDecoder),
|
||||
mTaskQueue(new MediaTaskQueue(GetMediaThreadPool(MediaThreadType::PLAYBACK),
|
||||
/* aSupportsTailDispatch = */ true)),
|
||||
mTaskQueue(new TaskQueue(GetMediaThreadPool(MediaThreadType::PLAYBACK),
|
||||
/* aSupportsTailDispatch = */ true)),
|
||||
mWatchManager(this, mTaskQueue),
|
||||
mProducerID(ImageContainer::AllocateProducerID()),
|
||||
mRealTime(aRealTime),
|
||||
|
@ -15,7 +15,7 @@ AudioStream will be refactored to have a callback interface
|
||||
where it asks for data and this thread will no longer be
|
||||
needed.
|
||||
|
||||
The element/state machine also has a MediaTaskQueue which runs in a
|
||||
The element/state machine also has a TaskQueue which runs in a
|
||||
SharedThreadPool that is shared with all other elements/decoders. The state
|
||||
machine dispatches tasks to this to call into the MediaDecoderReader to
|
||||
request decoded audio or video data. The Reader will callback with decoded
|
||||
@ -98,7 +98,7 @@ hardware (via AudioStream).
|
||||
namespace mozilla {
|
||||
|
||||
class AudioSegment;
|
||||
class MediaTaskQueue;
|
||||
class TaskQueue;
|
||||
class AudioSink;
|
||||
|
||||
extern PRLogModuleInfo* gMediaDecoderLog;
|
||||
@ -264,7 +264,7 @@ public:
|
||||
}
|
||||
|
||||
// Returns the state machine task queue.
|
||||
MediaTaskQueue* OwnerThread() const { return mTaskQueue; }
|
||||
TaskQueue* OwnerThread() const { return mTaskQueue; }
|
||||
|
||||
// Calls ScheduleStateMachine() after taking the decoder lock. Also
|
||||
// notifies the decoder thread in case it's waiting on the decoder lock.
|
||||
@ -709,7 +709,7 @@ private:
|
||||
nsRefPtr<MediaDecoder> mDecoder;
|
||||
|
||||
// Task queue for running the state machine.
|
||||
nsRefPtr<MediaTaskQueue> mTaskQueue;
|
||||
nsRefPtr<TaskQueue> mTaskQueue;
|
||||
|
||||
// State-watching manager.
|
||||
WatchManager<MediaDecoderStateMachine> mWatchManager;
|
||||
@ -920,7 +920,7 @@ private:
|
||||
// The task queue in which we run decode tasks. This is referred to as
|
||||
// the "decode thread", though in practise tasks can run on a different
|
||||
// thread every time they're called.
|
||||
MediaTaskQueue* DecodeTaskQueue() const { return mReader->OwnerThread(); }
|
||||
TaskQueue* DecodeTaskQueue() const { return mReader->OwnerThread(); }
|
||||
|
||||
// The time that playback started from the system clock. This is used for
|
||||
// timing the presentation of video frames when there's no audio.
|
||||
|
@ -62,7 +62,7 @@ TrackTypeToStr(TrackInfo::TrackType aTrack)
|
||||
|
||||
MediaFormatReader::MediaFormatReader(AbstractMediaDecoder* aDecoder,
|
||||
MediaDataDemuxer* aDemuxer,
|
||||
MediaTaskQueue* aBorrowedTaskQueue)
|
||||
TaskQueue* aBorrowedTaskQueue)
|
||||
: MediaDecoderReader(aDecoder, aBorrowedTaskQueue)
|
||||
, mDemuxer(aDemuxer)
|
||||
, mAudio(this, MediaData::AUDIO_DATA, Preferences::GetUint("media.audio-decode-ahead", 2))
|
||||
@ -188,9 +188,9 @@ MediaFormatReader::Init(MediaDecoderReader* aCloneDonor)
|
||||
InitLayersBackendType();
|
||||
|
||||
mAudio.mTaskQueue =
|
||||
new FlushableMediaTaskQueue(GetMediaThreadPool(MediaThreadType::PLATFORM_DECODER));
|
||||
new FlushableTaskQueue(GetMediaThreadPool(MediaThreadType::PLATFORM_DECODER));
|
||||
mVideo.mTaskQueue =
|
||||
new FlushableMediaTaskQueue(GetMediaThreadPool(MediaThreadType::PLATFORM_DECODER));
|
||||
new FlushableTaskQueue(GetMediaThreadPool(MediaThreadType::PLATFORM_DECODER));
|
||||
|
||||
static bool sSetupPrefCache = false;
|
||||
if (!sSetupPrefCache) {
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "MediaDataDemuxer.h"
|
||||
#include "MediaDecoderReader.h"
|
||||
#include "MediaTaskQueue.h"
|
||||
#include "TaskQueue.h"
|
||||
#include "PlatformDecoderModule.h"
|
||||
|
||||
namespace mozilla {
|
||||
@ -24,7 +24,7 @@ class MediaFormatReader final : public MediaDecoderReader
|
||||
public:
|
||||
explicit MediaFormatReader(AbstractMediaDecoder* aDecoder,
|
||||
MediaDataDemuxer* aDemuxer,
|
||||
MediaTaskQueue* aBorrowedTaskQueue = nullptr);
|
||||
TaskQueue* aBorrowedTaskQueue = nullptr);
|
||||
|
||||
virtual ~MediaFormatReader();
|
||||
|
||||
@ -213,7 +213,7 @@ private:
|
||||
nsRefPtr<MediaDataDecoder> mDecoder;
|
||||
// TaskQueue on which decoder can choose to decode.
|
||||
// Only non-null up until the decoder is created.
|
||||
nsRefPtr<FlushableMediaTaskQueue> mTaskQueue;
|
||||
nsRefPtr<FlushableTaskQueue> mTaskQueue;
|
||||
// Callback that receives output and error notifications from the decoder.
|
||||
nsAutoPtr<DecoderCallback> mCallback;
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "nsTArray.h"
|
||||
#include "mozilla/ReentrantMonitor.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "MediaTaskQueue.h"
|
||||
#include "TaskQueue.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
@ -159,7 +159,7 @@ template <class T> class MediaQueue : private nsDeque {
|
||||
mPopListeners.Clear();
|
||||
}
|
||||
|
||||
void AddPopListener(nsIRunnable* aRunnable, MediaTaskQueue* aTarget) {
|
||||
void AddPopListener(nsIRunnable* aRunnable, TaskQueue* aTarget) {
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
mPopListeners.AppendElement(Listener(aRunnable, aTarget));
|
||||
}
|
||||
@ -168,7 +168,7 @@ private:
|
||||
mutable ReentrantMonitor mReentrantMonitor;
|
||||
|
||||
struct Listener {
|
||||
Listener(nsIRunnable* aRunnable, MediaTaskQueue* aTarget)
|
||||
Listener(nsIRunnable* aRunnable, TaskQueue* aTarget)
|
||||
: mRunnable(aRunnable)
|
||||
, mTarget(aTarget)
|
||||
{
|
||||
@ -179,7 +179,7 @@ private:
|
||||
{
|
||||
}
|
||||
nsCOMPtr<nsIRunnable> mRunnable;
|
||||
RefPtr<MediaTaskQueue> mTarget;
|
||||
RefPtr<TaskQueue> mTarget;
|
||||
};
|
||||
|
||||
nsTArray<Listener> mPopListeners;
|
||||
|
@ -2670,7 +2670,7 @@ SourceMediaStream::GetEndOfAppendedData(TrackID aID)
|
||||
|
||||
void
|
||||
SourceMediaStream::DispatchWhenNotEnoughBuffered(TrackID aID,
|
||||
MediaTaskQueue* aSignalQueue, nsIRunnable* aSignalRunnable)
|
||||
TaskQueue* aSignalQueue, nsIRunnable* aSignalRunnable)
|
||||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
TrackData* data = FindDataForTrack(aID);
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "VideoFrameContainer.h"
|
||||
#include "VideoSegment.h"
|
||||
#include "MainThreadUtils.h"
|
||||
#include "MediaTaskQueue.h"
|
||||
#include "TaskQueue.h"
|
||||
#include "nsAutoRef.h"
|
||||
#include "GraphDriver.h"
|
||||
#include <speex/speex_resampler.h>
|
||||
@ -832,7 +832,7 @@ public:
|
||||
* does not exist. No op if a runnable is already present for this track.
|
||||
*/
|
||||
void DispatchWhenNotEnoughBuffered(TrackID aID,
|
||||
MediaTaskQueue* aSignalQueue, nsIRunnable* aSignalRunnable);
|
||||
TaskQueue* aSignalQueue, nsIRunnable* aSignalRunnable);
|
||||
/**
|
||||
* Indicate that a track has ended. Do not do any more API calls
|
||||
* affecting this track.
|
||||
@ -896,13 +896,13 @@ public:
|
||||
|
||||
protected:
|
||||
struct ThreadAndRunnable {
|
||||
void Init(MediaTaskQueue* aTarget, nsIRunnable* aRunnable)
|
||||
void Init(TaskQueue* aTarget, nsIRunnable* aRunnable)
|
||||
{
|
||||
mTarget = aTarget;
|
||||
mRunnable = aRunnable;
|
||||
}
|
||||
|
||||
nsRefPtr<MediaTaskQueue> mTarget;
|
||||
nsRefPtr<TaskQueue> mTarget;
|
||||
nsCOMPtr<nsIRunnable> mRunnable;
|
||||
};
|
||||
enum TrackCommands {
|
||||
|
@ -31,7 +31,7 @@ extern PRLogModuleInfo* gMediaTimerLog;
|
||||
typedef MozPromise<bool, bool, /* IsExclusive = */ true> MediaTimerPromise;
|
||||
|
||||
// Timers only know how to fire at a given thread, which creates an impedence
|
||||
// mismatch with code that operates with MediaTaskQueues. This class solves
|
||||
// mismatch with code that operates with TaskQueues. This class solves
|
||||
// that mismatch with a dedicated (but shared) thread and a nice MozPromise-y
|
||||
// interface.
|
||||
class MediaTimer
|
||||
|
@ -4,34 +4,34 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "MediaTaskQueue.h"
|
||||
#include "TaskQueue.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "SharedThreadPool.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
MediaTaskQueue::MediaTaskQueue(already_AddRefed<SharedThreadPool> aPool,
|
||||
TaskQueue::TaskQueue(already_AddRefed<SharedThreadPool> aPool,
|
||||
bool aRequireTailDispatch)
|
||||
: AbstractThread(aRequireTailDispatch)
|
||||
, mPool(aPool)
|
||||
, mQueueMonitor("MediaTaskQueue::Queue")
|
||||
, mQueueMonitor("TaskQueue::Queue")
|
||||
, mTailDispatcher(nullptr)
|
||||
, mIsRunning(false)
|
||||
, mIsShutdown(false)
|
||||
, mIsFlushing(false)
|
||||
{
|
||||
MOZ_COUNT_CTOR(MediaTaskQueue);
|
||||
MOZ_COUNT_CTOR(TaskQueue);
|
||||
}
|
||||
|
||||
MediaTaskQueue::~MediaTaskQueue()
|
||||
TaskQueue::~TaskQueue()
|
||||
{
|
||||
MonitorAutoLock mon(mQueueMonitor);
|
||||
MOZ_ASSERT(mIsShutdown);
|
||||
MOZ_COUNT_DTOR(MediaTaskQueue);
|
||||
MOZ_COUNT_DTOR(TaskQueue);
|
||||
}
|
||||
|
||||
TaskDispatcher&
|
||||
MediaTaskQueue::TailDispatcher()
|
||||
TaskQueue::TailDispatcher()
|
||||
{
|
||||
MOZ_ASSERT(IsCurrentThreadIn());
|
||||
MOZ_ASSERT(mTailDispatcher);
|
||||
@ -39,7 +39,7 @@ MediaTaskQueue::TailDispatcher()
|
||||
}
|
||||
|
||||
nsresult
|
||||
MediaTaskQueue::DispatchLocked(already_AddRefed<nsIRunnable> aRunnable,
|
||||
TaskQueue::DispatchLocked(already_AddRefed<nsIRunnable> aRunnable,
|
||||
DispatchMode aMode, DispatchFailureHandling aFailureHandling,
|
||||
DispatchReason aReason)
|
||||
{
|
||||
@ -64,7 +64,7 @@ MediaTaskQueue::DispatchLocked(already_AddRefed<nsIRunnable> aRunnable,
|
||||
RefPtr<nsIRunnable> runner(new Runner(this));
|
||||
nsresult rv = mPool->Dispatch(runner, NS_DISPATCH_NORMAL);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Failed to dispatch runnable to run MediaTaskQueue");
|
||||
NS_WARNING("Failed to dispatch runnable to run TaskQueue");
|
||||
return rv;
|
||||
}
|
||||
mIsRunning = true;
|
||||
@ -72,11 +72,11 @@ MediaTaskQueue::DispatchLocked(already_AddRefed<nsIRunnable> aRunnable,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
class MediaTaskQueueSyncRunnable : public nsRunnable {
|
||||
class TaskQueueSyncRunnable : public nsRunnable {
|
||||
public:
|
||||
explicit MediaTaskQueueSyncRunnable(already_AddRefed<nsIRunnable> aRunnable)
|
||||
explicit TaskQueueSyncRunnable(already_AddRefed<nsIRunnable> aRunnable)
|
||||
: mRunnable(aRunnable)
|
||||
, mMonitor("MediaTaskQueueSyncRunnable")
|
||||
, mMonitor("TaskQueueSyncRunnable")
|
||||
, mDone(false)
|
||||
{
|
||||
}
|
||||
@ -104,30 +104,30 @@ private:
|
||||
};
|
||||
|
||||
void
|
||||
MediaTaskQueue::SyncDispatch(already_AddRefed<nsIRunnable> aRunnable) {
|
||||
NS_WARNING("MediaTaskQueue::SyncDispatch is dangerous and deprecated. Stop using this!");
|
||||
nsRefPtr<MediaTaskQueueSyncRunnable> task(new MediaTaskQueueSyncRunnable(Move(aRunnable)));
|
||||
TaskQueue::SyncDispatch(already_AddRefed<nsIRunnable> aRunnable) {
|
||||
NS_WARNING("TaskQueue::SyncDispatch is dangerous and deprecated. Stop using this!");
|
||||
nsRefPtr<TaskQueueSyncRunnable> task(new TaskQueueSyncRunnable(Move(aRunnable)));
|
||||
|
||||
// Tail dispatchers don't interact nicely with sync dispatch. We require that
|
||||
// nothing is already in the tail dispatcher, and then sidestep it for this
|
||||
// task.
|
||||
MOZ_ASSERT_IF(AbstractThread::GetCurrent(),
|
||||
!AbstractThread::GetCurrent()->TailDispatcher().HasTasksFor(this));
|
||||
nsRefPtr<MediaTaskQueueSyncRunnable> taskRef = task;
|
||||
nsRefPtr<TaskQueueSyncRunnable> taskRef = task;
|
||||
Dispatch(taskRef.forget(), AssertDispatchSuccess, TailDispatch);
|
||||
|
||||
task->WaitUntilDone();
|
||||
}
|
||||
|
||||
void
|
||||
MediaTaskQueue::AwaitIdle()
|
||||
TaskQueue::AwaitIdle()
|
||||
{
|
||||
MonitorAutoLock mon(mQueueMonitor);
|
||||
AwaitIdleLocked();
|
||||
}
|
||||
|
||||
void
|
||||
MediaTaskQueue::AwaitIdleLocked()
|
||||
TaskQueue::AwaitIdleLocked()
|
||||
{
|
||||
// Make sure there are no tasks for this queue waiting in the caller's tail
|
||||
// dispatcher.
|
||||
@ -142,7 +142,7 @@ MediaTaskQueue::AwaitIdleLocked()
|
||||
}
|
||||
|
||||
void
|
||||
MediaTaskQueue::AwaitShutdownAndIdle()
|
||||
TaskQueue::AwaitShutdownAndIdle()
|
||||
{
|
||||
// Make sure there are no tasks for this queue waiting in the caller's tail
|
||||
// dispatcher.
|
||||
@ -157,7 +157,7 @@ MediaTaskQueue::AwaitShutdownAndIdle()
|
||||
}
|
||||
|
||||
nsRefPtr<ShutdownPromise>
|
||||
MediaTaskQueue::BeginShutdown()
|
||||
TaskQueue::BeginShutdown()
|
||||
{
|
||||
// Dispatch any tasks for this queue waiting in the caller's tail dispatcher,
|
||||
// since this is the last opportunity to do so.
|
||||
@ -174,7 +174,7 @@ MediaTaskQueue::BeginShutdown()
|
||||
}
|
||||
|
||||
void
|
||||
FlushableMediaTaskQueue::Flush()
|
||||
FlushableTaskQueue::Flush()
|
||||
{
|
||||
MonitorAutoLock mon(mQueueMonitor);
|
||||
AutoSetFlushing autoFlush(this);
|
||||
@ -183,7 +183,7 @@ FlushableMediaTaskQueue::Flush()
|
||||
}
|
||||
|
||||
nsresult
|
||||
FlushableMediaTaskQueue::FlushAndDispatch(already_AddRefed<nsIRunnable> aRunnable)
|
||||
FlushableTaskQueue::FlushAndDispatch(already_AddRefed<nsIRunnable> aRunnable)
|
||||
{
|
||||
MonitorAutoLock mon(mQueueMonitor);
|
||||
AutoSetFlushing autoFlush(this);
|
||||
@ -196,7 +196,7 @@ FlushableMediaTaskQueue::FlushAndDispatch(already_AddRefed<nsIRunnable> aRunnabl
|
||||
}
|
||||
|
||||
void
|
||||
FlushableMediaTaskQueue::FlushLocked()
|
||||
FlushableTaskQueue::FlushLocked()
|
||||
{
|
||||
// Make sure there are no tasks for this queue waiting in the caller's tail
|
||||
// dispatcher.
|
||||
@ -207,21 +207,21 @@ FlushableMediaTaskQueue::FlushLocked()
|
||||
MOZ_ASSERT(mIsFlushing);
|
||||
|
||||
// Clear the tasks. If this strikes you as awful, stop using a
|
||||
// FlushableMediaTaskQueue.
|
||||
// FlushableTaskQueue.
|
||||
while (!mTasks.empty()) {
|
||||
mTasks.pop();
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
MediaTaskQueue::IsEmpty()
|
||||
TaskQueue::IsEmpty()
|
||||
{
|
||||
MonitorAutoLock mon(mQueueMonitor);
|
||||
return mTasks.empty();
|
||||
}
|
||||
|
||||
bool
|
||||
MediaTaskQueue::IsCurrentThreadIn()
|
||||
TaskQueue::IsCurrentThreadIn()
|
||||
{
|
||||
bool in = NS_GetCurrentThread() == mRunningThread;
|
||||
MOZ_ASSERT(in == (GetCurrent() == this));
|
||||
@ -229,7 +229,7 @@ MediaTaskQueue::IsCurrentThreadIn()
|
||||
}
|
||||
|
||||
nsresult
|
||||
MediaTaskQueue::Runner::Run()
|
||||
TaskQueue::Runner::Run()
|
||||
{
|
||||
RefPtr<nsIRunnable> event;
|
||||
{
|
@ -4,8 +4,8 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef MediaTaskQueue_h_
|
||||
#define MediaTaskQueue_h_
|
||||
#ifndef TaskQueue_h_
|
||||
#define TaskQueue_h_
|
||||
|
||||
#include <queue>
|
||||
#include "mozilla/RefPtr.h"
|
||||
@ -25,17 +25,17 @@ class SharedThreadPool;
|
||||
typedef MozPromise<bool, bool, false> ShutdownPromise;
|
||||
|
||||
// Abstracts executing runnables in order in a thread pool. The runnables
|
||||
// dispatched to the MediaTaskQueue will be executed in the order in which
|
||||
// dispatched to the TaskQueue will be executed in the order in which
|
||||
// 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 : public AbstractThread {
|
||||
class TaskQueue : public AbstractThread {
|
||||
public:
|
||||
explicit MediaTaskQueue(already_AddRefed<SharedThreadPool> aPool, bool aSupportsTailDispatch = false);
|
||||
explicit TaskQueue(already_AddRefed<SharedThreadPool> aPool, bool aSupportsTailDispatch = false);
|
||||
|
||||
TaskDispatcher& TailDispatcher() override;
|
||||
|
||||
MediaTaskQueue* AsTaskQueue() override { return this; }
|
||||
TaskQueue* AsTaskQueue() override { return this; }
|
||||
|
||||
void Dispatch(already_AddRefed<nsIRunnable> aRunnable,
|
||||
DispatchFailureHandling aFailureHandling = AssertDispatchSuccess,
|
||||
@ -73,7 +73,7 @@ public:
|
||||
bool IsCurrentThreadIn() override;
|
||||
|
||||
protected:
|
||||
virtual ~MediaTaskQueue();
|
||||
virtual ~TaskQueue();
|
||||
|
||||
|
||||
// Blocks until all task finish executing. Called internally by methods
|
||||
@ -118,7 +118,7 @@ protected:
|
||||
class AutoTaskGuard : public AutoTaskDispatcher
|
||||
{
|
||||
public:
|
||||
explicit AutoTaskGuard(MediaTaskQueue* aQueue)
|
||||
explicit AutoTaskGuard(TaskQueue* aQueue)
|
||||
: AutoTaskDispatcher(/* aIsTailDispatcher = */ true), mQueue(aQueue)
|
||||
{
|
||||
// NB: We don't hold the lock to aQueue here. Don't do anything that
|
||||
@ -145,7 +145,7 @@ protected:
|
||||
}
|
||||
|
||||
private:
|
||||
MediaTaskQueue* mQueue;
|
||||
TaskQueue* mQueue;
|
||||
};
|
||||
|
||||
TaskDispatcher* mTailDispatcher;
|
||||
@ -163,20 +163,20 @@ protected:
|
||||
|
||||
class Runner : public nsRunnable {
|
||||
public:
|
||||
explicit Runner(MediaTaskQueue* aQueue)
|
||||
explicit Runner(TaskQueue* aQueue)
|
||||
: mQueue(aQueue)
|
||||
{
|
||||
}
|
||||
NS_METHOD Run() override;
|
||||
private:
|
||||
RefPtr<MediaTaskQueue> mQueue;
|
||||
RefPtr<TaskQueue> mQueue;
|
||||
};
|
||||
};
|
||||
|
||||
class FlushableMediaTaskQueue : public MediaTaskQueue
|
||||
class FlushableTaskQueue : public TaskQueue
|
||||
{
|
||||
public:
|
||||
explicit FlushableMediaTaskQueue(already_AddRefed<SharedThreadPool> aPool) : MediaTaskQueue(Move(aPool)) {}
|
||||
explicit FlushableTaskQueue(already_AddRefed<SharedThreadPool> aPool) : TaskQueue(Move(aPool)) {}
|
||||
nsresult FlushAndDispatch(already_AddRefed<nsIRunnable> aRunnable);
|
||||
void Flush();
|
||||
|
||||
@ -187,7 +187,7 @@ private:
|
||||
class MOZ_STACK_CLASS AutoSetFlushing
|
||||
{
|
||||
public:
|
||||
explicit AutoSetFlushing(FlushableMediaTaskQueue* aTaskQueue) : mTaskQueue(aTaskQueue)
|
||||
explicit AutoSetFlushing(FlushableTaskQueue* aTaskQueue) : mTaskQueue(aTaskQueue)
|
||||
{
|
||||
mTaskQueue->mQueueMonitor.AssertCurrentThreadOwns();
|
||||
mTaskQueue->mIsFlushing = true;
|
||||
@ -199,7 +199,7 @@ private:
|
||||
}
|
||||
|
||||
private:
|
||||
FlushableMediaTaskQueue* mTaskQueue;
|
||||
FlushableTaskQueue* mTaskQueue;
|
||||
};
|
||||
|
||||
void FlushLocked();
|
||||
@ -208,4 +208,4 @@ private:
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // MediaTaskQueue_h_
|
||||
#endif // TaskQueue_h_
|
@ -15,7 +15,7 @@
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "nsIRandomGenerator.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "MediaTaskQueue.h"
|
||||
#include "TaskQueue.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@ -325,10 +325,10 @@ public:
|
||||
NS_IMETHOD Run() {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
mTaskQueue =
|
||||
new MediaTaskQueue(GetMediaThreadPool(MediaThreadType::PLATFORM_DECODER));
|
||||
new TaskQueue(GetMediaThreadPool(MediaThreadType::PLATFORM_DECODER));
|
||||
return NS_OK;
|
||||
}
|
||||
nsRefPtr<MediaTaskQueue> mTaskQueue;
|
||||
nsRefPtr<TaskQueue> mTaskQueue;
|
||||
};
|
||||
|
||||
class CreateFlushableTaskQueueTask : public nsRunnable {
|
||||
@ -336,26 +336,26 @@ public:
|
||||
NS_IMETHOD Run() {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
mTaskQueue =
|
||||
new FlushableMediaTaskQueue(GetMediaThreadPool(MediaThreadType::PLATFORM_DECODER));
|
||||
new FlushableTaskQueue(GetMediaThreadPool(MediaThreadType::PLATFORM_DECODER));
|
||||
return NS_OK;
|
||||
}
|
||||
nsRefPtr<FlushableMediaTaskQueue> mTaskQueue;
|
||||
nsRefPtr<FlushableTaskQueue> mTaskQueue;
|
||||
};
|
||||
|
||||
already_AddRefed<MediaTaskQueue>
|
||||
already_AddRefed<TaskQueue>
|
||||
CreateMediaDecodeTaskQueue()
|
||||
{
|
||||
// We must create the MediaTaskQueue/SharedThreadPool on the main thread.
|
||||
// We must create the TaskQueue/SharedThreadPool on the main thread.
|
||||
nsRefPtr<CreateTaskQueueTask> t(new CreateTaskQueueTask());
|
||||
nsresult rv = NS_DispatchToMainThread(t, NS_DISPATCH_SYNC);
|
||||
NS_ENSURE_SUCCESS(rv, nullptr);
|
||||
return t->mTaskQueue.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<FlushableMediaTaskQueue>
|
||||
already_AddRefed<FlushableTaskQueue>
|
||||
CreateFlushableMediaDecodeTaskQueue()
|
||||
{
|
||||
// We must create the MediaTaskQueue/SharedThreadPool on the main thread.
|
||||
// We must create the TaskQueue/SharedThreadPool on the main thread.
|
||||
nsRefPtr<CreateFlushableTaskQueueTask> t(new CreateFlushableTaskQueueTask());
|
||||
nsresult rv = NS_DispatchToMainThread(t, NS_DISPATCH_SYNC);
|
||||
NS_ENSURE_SUCCESS(rv, nullptr);
|
||||
|
@ -274,13 +274,13 @@ GenerateRandomName(nsCString& aOutSalt, uint32_t aLength);
|
||||
nsresult
|
||||
GenerateRandomPathName(nsCString& aOutSalt, uint32_t aLength);
|
||||
|
||||
class MediaTaskQueue;
|
||||
class FlushableMediaTaskQueue;
|
||||
class TaskQueue;
|
||||
class FlushableTaskQueue;
|
||||
|
||||
already_AddRefed<MediaTaskQueue>
|
||||
already_AddRefed<TaskQueue>
|
||||
CreateMediaDecodeTaskQueue();
|
||||
|
||||
already_AddRefed<FlushableMediaTaskQueue>
|
||||
already_AddRefed<FlushableTaskQueue>
|
||||
CreateFlushableMediaDecodeTaskQueue();
|
||||
|
||||
// Iteratively invokes aWork until aCondition returns true, or aWork returns false.
|
||||
|
@ -111,7 +111,7 @@ InvokeAndRetry(ThisType* aThisVal, ReturnType(ThisType::*aMethod)(), MP4Stream*
|
||||
}
|
||||
}
|
||||
|
||||
MP4Reader::MP4Reader(AbstractMediaDecoder* aDecoder, MediaTaskQueue* aBorrowedTaskQueue)
|
||||
MP4Reader::MP4Reader(AbstractMediaDecoder* aDecoder, TaskQueue* aBorrowedTaskQueue)
|
||||
: MediaDecoderReader(aDecoder, aBorrowedTaskQueue)
|
||||
, mAudio(MediaData::AUDIO_DATA, Preferences::GetUint("media.mp4-audio-decode-ahead", 2))
|
||||
, mVideo(MediaData::VIDEO_DATA, Preferences::GetUint("media.mp4-video-decode-ahead", 2))
|
||||
@ -210,11 +210,11 @@ MP4Reader::Init(MediaDecoderReader* aCloneDonor)
|
||||
InitLayersBackendType();
|
||||
|
||||
mAudio.mTaskQueue =
|
||||
new FlushableMediaTaskQueue(GetMediaThreadPool(MediaThreadType::PLATFORM_DECODER));
|
||||
new FlushableTaskQueue(GetMediaThreadPool(MediaThreadType::PLATFORM_DECODER));
|
||||
NS_ENSURE_TRUE(mAudio.mTaskQueue, NS_ERROR_FAILURE);
|
||||
|
||||
mVideo.mTaskQueue =
|
||||
new FlushableMediaTaskQueue(GetMediaThreadPool(MediaThreadType::PLATFORM_DECODER));
|
||||
new FlushableTaskQueue(GetMediaThreadPool(MediaThreadType::PLATFORM_DECODER));
|
||||
NS_ENSURE_TRUE(mVideo.mTaskQueue, NS_ERROR_FAILURE);
|
||||
|
||||
static bool sSetupPrefCache = false;
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "PlatformDecoderModule.h"
|
||||
#include "mp4_demuxer/mp4_demuxer.h"
|
||||
#include "demuxer/TrackDemuxer.h"
|
||||
#include "MediaTaskQueue.h"
|
||||
#include "TaskQueue.h"
|
||||
|
||||
#include <deque>
|
||||
#include "mozilla/Monitor.h"
|
||||
@ -28,7 +28,7 @@ class MP4Reader final : public MediaDecoderReader
|
||||
typedef TrackInfo::TrackType TrackType;
|
||||
|
||||
public:
|
||||
explicit MP4Reader(AbstractMediaDecoder* aDecoder, MediaTaskQueue* aBorrowedTaskQueue = nullptr);
|
||||
explicit MP4Reader(AbstractMediaDecoder* aDecoder, TaskQueue* aBorrowedTaskQueue = nullptr);
|
||||
|
||||
virtual ~MP4Reader();
|
||||
|
||||
@ -184,7 +184,7 @@ private:
|
||||
nsRefPtr<MediaDataDecoder> mDecoder;
|
||||
// TaskQueue on which decoder can choose to decode.
|
||||
// Only non-null up until the decoder is created.
|
||||
nsRefPtr<FlushableMediaTaskQueue> mTaskQueue;
|
||||
nsRefPtr<FlushableTaskQueue> mTaskQueue;
|
||||
// Callback that receives output and error notifications from the decoder.
|
||||
nsAutoPtr<DecoderCallback> mCallback;
|
||||
// Decoded samples returned my mDecoder awaiting being returned to
|
||||
|
@ -53,7 +53,7 @@ private:
|
||||
virtual ~TestBinding()
|
||||
{
|
||||
{
|
||||
nsRefPtr<MediaTaskQueue> queue = reader->OwnerThread();
|
||||
nsRefPtr<TaskQueue> queue = reader->OwnerThread();
|
||||
nsCOMPtr<nsIRunnable> task = NS_NewRunnableMethod(reader, &MP4Reader::Shutdown);
|
||||
// Hackily bypass the tail dispatcher so that we can AwaitShutdownAndIdle.
|
||||
// In production code we'd use BeginShutdown + promises.
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "MediaTaskQueue.h"
|
||||
#include "TaskQueue.h"
|
||||
#include "MozPromise.h"
|
||||
#include "SharedThreadPool.h"
|
||||
#include "VideoUtils.h"
|
||||
@ -19,7 +19,7 @@ class MOZ_STACK_CLASS AutoTaskQueue
|
||||
{
|
||||
public:
|
||||
AutoTaskQueue()
|
||||
: mTaskQueue(new MediaTaskQueue(GetMediaThreadPool(MediaThreadType::PLAYBACK)))
|
||||
: mTaskQueue(new TaskQueue(GetMediaThreadPool(MediaThreadType::PLAYBACK)))
|
||||
{}
|
||||
|
||||
~AutoTaskQueue()
|
||||
@ -27,15 +27,15 @@ public:
|
||||
mTaskQueue->AwaitShutdownAndIdle();
|
||||
}
|
||||
|
||||
MediaTaskQueue* Queue() { return mTaskQueue; }
|
||||
TaskQueue* Queue() { return mTaskQueue; }
|
||||
private:
|
||||
nsRefPtr<MediaTaskQueue> mTaskQueue;
|
||||
nsRefPtr<TaskQueue> mTaskQueue;
|
||||
};
|
||||
|
||||
class DelayedResolveOrReject : public nsRunnable
|
||||
{
|
||||
public:
|
||||
DelayedResolveOrReject(MediaTaskQueue* aTaskQueue,
|
||||
DelayedResolveOrReject(TaskQueue* aTaskQueue,
|
||||
TestPromise::Private* aPromise,
|
||||
TestPromise::ResolveOrRejectValue aValue,
|
||||
int aIterations)
|
||||
@ -71,7 +71,7 @@ protected:
|
||||
~DelayedResolveOrReject() {}
|
||||
|
||||
private:
|
||||
nsRefPtr<MediaTaskQueue> mTaskQueue;
|
||||
nsRefPtr<TaskQueue> mTaskQueue;
|
||||
nsRefPtr<TestPromise::Private> mPromise;
|
||||
TestPromise::ResolveOrRejectValue mValue;
|
||||
int mIterations;
|
||||
@ -79,7 +79,7 @@ private:
|
||||
|
||||
template<typename FunctionType>
|
||||
void
|
||||
RunOnTaskQueue(MediaTaskQueue* aQueue, FunctionType aFun)
|
||||
RunOnTaskQueue(TaskQueue* aQueue, FunctionType aFun)
|
||||
{
|
||||
nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction(aFun);
|
||||
aQueue->Dispatch(r.forget());
|
||||
@ -91,7 +91,7 @@ RunOnTaskQueue(MediaTaskQueue* aQueue, FunctionType aFun)
|
||||
TEST(MozPromise, BasicResolve)
|
||||
{
|
||||
AutoTaskQueue atq;
|
||||
nsRefPtr<MediaTaskQueue> queue = atq.Queue();
|
||||
nsRefPtr<TaskQueue> queue = atq.Queue();
|
||||
RunOnTaskQueue(queue, [queue] () -> void {
|
||||
TestPromise::CreateAndResolve(42, __func__)->Then(queue, __func__,
|
||||
[queue] (int aResolveValue) -> void { EXPECT_EQ(aResolveValue, 42); queue->BeginShutdown(); },
|
||||
@ -102,7 +102,7 @@ TEST(MozPromise, BasicResolve)
|
||||
TEST(MozPromise, BasicReject)
|
||||
{
|
||||
AutoTaskQueue atq;
|
||||
nsRefPtr<MediaTaskQueue> queue = atq.Queue();
|
||||
nsRefPtr<TaskQueue> queue = atq.Queue();
|
||||
RunOnTaskQueue(queue, [queue] () -> void {
|
||||
TestPromise::CreateAndReject(42.0, __func__)->Then(queue, __func__,
|
||||
DO_FAIL,
|
||||
@ -113,7 +113,7 @@ TEST(MozPromise, BasicReject)
|
||||
TEST(MozPromise, AsyncResolve)
|
||||
{
|
||||
AutoTaskQueue atq;
|
||||
nsRefPtr<MediaTaskQueue> queue = atq.Queue();
|
||||
nsRefPtr<TaskQueue> queue = atq.Queue();
|
||||
RunOnTaskQueue(queue, [queue] () -> void {
|
||||
nsRefPtr<TestPromise::Private> p = new TestPromise::Private(__func__);
|
||||
|
||||
@ -143,7 +143,7 @@ TEST(MozPromise, CompletionPromises)
|
||||
{
|
||||
bool invokedPass = false;
|
||||
AutoTaskQueue atq;
|
||||
nsRefPtr<MediaTaskQueue> queue = atq.Queue();
|
||||
nsRefPtr<TaskQueue> queue = atq.Queue();
|
||||
RunOnTaskQueue(queue, [queue, &invokedPass] () -> void {
|
||||
TestPromise::CreateAndResolve(40, __func__)
|
||||
->Then(queue, __func__,
|
||||
@ -174,7 +174,7 @@ TEST(MozPromise, CompletionPromises)
|
||||
TEST(MozPromise, PromiseAllResolve)
|
||||
{
|
||||
AutoTaskQueue atq;
|
||||
nsRefPtr<MediaTaskQueue> queue = atq.Queue();
|
||||
nsRefPtr<TaskQueue> queue = atq.Queue();
|
||||
RunOnTaskQueue(queue, [queue] () -> void {
|
||||
|
||||
nsTArray<nsRefPtr<TestPromise>> promises;
|
||||
@ -198,7 +198,7 @@ TEST(MozPromise, PromiseAllResolve)
|
||||
TEST(MozPromise, PromiseAllReject)
|
||||
{
|
||||
AutoTaskQueue atq;
|
||||
nsRefPtr<MediaTaskQueue> queue = atq.Queue();
|
||||
nsRefPtr<TaskQueue> queue = atq.Queue();
|
||||
RunOnTaskQueue(queue, [queue] () -> void {
|
||||
|
||||
nsTArray<nsRefPtr<TestPromise>> promises;
|
||||
|
@ -24,8 +24,8 @@ using media::TimeIntervals;
|
||||
#define EOS_FUZZ_US 125000
|
||||
|
||||
MediaSourceDemuxer::MediaSourceDemuxer()
|
||||
: mTaskQueue(new MediaTaskQueue(GetMediaThreadPool(MediaThreadType::PLAYBACK),
|
||||
/* aSupportsTailDispatch = */ true))
|
||||
: mTaskQueue(new TaskQueue(GetMediaThreadPool(MediaThreadType::PLAYBACK),
|
||||
/* aSupportsTailDispatch = */ true))
|
||||
, mMonitor("MediaSourceDemuxer")
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "MediaDecoderReader.h"
|
||||
#include "MediaResource.h"
|
||||
#include "MediaSource.h"
|
||||
#include "MediaTaskQueue.h"
|
||||
#include "TaskQueue.h"
|
||||
#include "TrackBuffersManager.h"
|
||||
#include "mozilla/Atomics.h"
|
||||
#include "mozilla/Monitor.h"
|
||||
@ -52,7 +52,7 @@ public:
|
||||
/* interface for TrackBuffersManager */
|
||||
void AttachSourceBuffer(TrackBuffersManager* aSourceBuffer);
|
||||
void DetachSourceBuffer(TrackBuffersManager* aSourceBuffer);
|
||||
MediaTaskQueue* GetTaskQueue() { return mTaskQueue; }
|
||||
TaskQueue* GetTaskQueue() { return mTaskQueue; }
|
||||
void NotifyTimeRangesChanged();
|
||||
|
||||
// Returns a string describing the state of the MediaSource internal
|
||||
@ -74,7 +74,7 @@ private:
|
||||
return !GetTaskQueue() || GetTaskQueue()->IsCurrentThreadIn();
|
||||
}
|
||||
|
||||
RefPtr<MediaTaskQueue> mTaskQueue;
|
||||
RefPtr<TaskQueue> mTaskQueue;
|
||||
nsTArray<nsRefPtr<MediaSourceTrackDemuxer>> mDemuxers;
|
||||
|
||||
nsTArray<nsRefPtr<TrackBuffersManager>> mSourceBuffers;
|
||||
|
@ -697,7 +697,7 @@ MediaSourceReader::ReleaseMediaResources()
|
||||
|
||||
MediaDecoderReader*
|
||||
CreateReaderForType(const nsACString& aType, AbstractMediaDecoder* aDecoder,
|
||||
MediaTaskQueue* aBorrowedTaskQueue)
|
||||
TaskQueue* aBorrowedTaskQueue)
|
||||
{
|
||||
#ifdef MOZ_FMP4
|
||||
// The MP4Reader that supports fragmented MP4 and uses
|
||||
|
@ -75,7 +75,7 @@ public:
|
||||
return mReader;
|
||||
}
|
||||
|
||||
void SetTaskQueue(MediaTaskQueue* aTaskQueue)
|
||||
void SetTaskQueue(TaskQueue* aTaskQueue)
|
||||
{
|
||||
MOZ_ASSERT((!mTaskQueue && aTaskQueue) || (mTaskQueue && !aTaskQueue));
|
||||
mTaskQueue = aTaskQueue;
|
||||
@ -138,7 +138,7 @@ private:
|
||||
virtual ~SourceBufferDecoder();
|
||||
|
||||
// Our TrackBuffer's task queue, this is only non-null during initialization.
|
||||
RefPtr<MediaTaskQueue> mTaskQueue;
|
||||
RefPtr<TaskQueue> mTaskQueue;
|
||||
|
||||
nsRefPtr<MediaResource> mResource;
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "MediaData.h"
|
||||
#include "MediaSourceDecoder.h"
|
||||
#include "SharedThreadPool.h"
|
||||
#include "MediaTaskQueue.h"
|
||||
#include "TaskQueue.h"
|
||||
#include "SourceBufferDecoder.h"
|
||||
#include "SourceBufferResource.h"
|
||||
#include "VideoUtils.h"
|
||||
@ -51,7 +51,7 @@ TrackBuffer::TrackBuffer(MediaSourceDecoder* aParentDecoder, const nsACString& a
|
||||
MOZ_COUNT_CTOR(TrackBuffer);
|
||||
mParser = ContainerParser::CreateForMIMEType(aType);
|
||||
mTaskQueue =
|
||||
new MediaTaskQueue(GetMediaThreadPool(MediaThreadType::PLAYBACK));
|
||||
new TaskQueue(GetMediaThreadPool(MediaThreadType::PLAYBACK));
|
||||
aParentDecoder->AddTrackBuffer(this);
|
||||
mDecoderPerSegment = Preferences::GetBool("media.mediasource.decoder-per-segment", false);
|
||||
MSE_DEBUG("TrackBuffer created for parent decoder %p", aParentDecoder);
|
||||
@ -112,7 +112,7 @@ TrackBuffer::Shutdown()
|
||||
MOZ_ASSERT(mShutdownPromise.IsEmpty());
|
||||
nsRefPtr<ShutdownPromise> p = mShutdownPromise.Ensure(__func__);
|
||||
|
||||
RefPtr<MediaTaskQueue> queue = mTaskQueue;
|
||||
RefPtr<TaskQueue> queue = mTaskQueue;
|
||||
mTaskQueue = nullptr;
|
||||
queue->BeginShutdown()
|
||||
->Then(mParentDecoder->GetReader()->OwnerThread(), __func__, this,
|
||||
|
@ -185,7 +185,7 @@ private:
|
||||
// A task queue using the shared media thread pool. Used exclusively to
|
||||
// initialize (i.e. call ReadMetadata on) decoders as they are created via
|
||||
// NewDecoder.
|
||||
RefPtr<MediaTaskQueue> mTaskQueue;
|
||||
RefPtr<TaskQueue> mTaskQueue;
|
||||
|
||||
// All of the decoders managed by this TrackBuffer. Access protected by
|
||||
// mParentDecoder's monitor.
|
||||
|
@ -304,7 +304,7 @@ private:
|
||||
{
|
||||
return !GetTaskQueue() || GetTaskQueue()->IsCurrentThreadIn();
|
||||
}
|
||||
RefPtr<MediaTaskQueue> mTaskQueue;
|
||||
RefPtr<TaskQueue> mTaskQueue;
|
||||
|
||||
TimeInterval mAppendWindow;
|
||||
TimeUnit mTimestampOffset;
|
||||
|
@ -129,7 +129,6 @@ EXPORTS += [
|
||||
'MediaResource.h',
|
||||
'MediaSegment.h',
|
||||
'MediaStreamGraph.h',
|
||||
'MediaTaskQueue.h',
|
||||
'MediaTimer.h',
|
||||
'MediaTrack.h',
|
||||
'MediaTrackList.h',
|
||||
@ -146,6 +145,7 @@ EXPORTS += [
|
||||
'StateWatching.h',
|
||||
'StreamBuffer.h',
|
||||
'TaskDispatcher.h',
|
||||
'TaskQueue.h',
|
||||
'ThreadPoolCOMListener.h',
|
||||
'TimeUnits.h',
|
||||
'TimeVarying.h',
|
||||
@ -228,7 +228,6 @@ UNIFIED_SOURCES += [
|
||||
'MediaStreamError.cpp',
|
||||
'MediaStreamGraph.cpp',
|
||||
'MediaStreamTrack.cpp',
|
||||
'MediaTaskQueue.cpp',
|
||||
'MediaTimer.cpp',
|
||||
'MediaTrack.cpp',
|
||||
'MediaTrackList.cpp',
|
||||
@ -238,6 +237,7 @@ UNIFIED_SOURCES += [
|
||||
'RtspMediaResource.cpp',
|
||||
'SharedThreadPool.cpp',
|
||||
'StreamBuffer.cpp',
|
||||
'TaskQueue.cpp',
|
||||
'TextTrack.cpp',
|
||||
'TextTrackCue.cpp',
|
||||
'TextTrackCueList.cpp',
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include "gfx2DGlue.h"
|
||||
|
||||
#include "MediaStreamSource.h"
|
||||
#include "MediaTaskQueue.h"
|
||||
#include "TaskQueue.h"
|
||||
#include "MP3FrameParser.h"
|
||||
#include "nsMimeTypes.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
@ -41,7 +41,7 @@ class GonkNativeWindow;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class FlushableMediaTaskQueue;
|
||||
class FlushableTaskQueue;
|
||||
class MP3FrameParser;
|
||||
|
||||
namespace layers {
|
||||
@ -77,7 +77,7 @@ protected:
|
||||
virtual void NotifyDataArrivedInternal(uint32_t aLength, int64_t aOffset) override;
|
||||
public:
|
||||
|
||||
// Flush the MediaTaskQueue, flush MediaCodec and raise the mDiscontinuity.
|
||||
// Flush the TaskQueue, flush MediaCodec and raise the mDiscontinuity.
|
||||
virtual nsresult ResetDecode() override;
|
||||
|
||||
// Disptach a DecodeVideoFrameTask to decode video data.
|
||||
@ -154,7 +154,7 @@ protected:
|
||||
int64_t mSeekTimeUs;
|
||||
bool mFlushed; // meaningless when mSeekTimeUs is invalid.
|
||||
bool mDiscontinuity;
|
||||
nsRefPtr<MediaTaskQueue> mTaskQueue;
|
||||
nsRefPtr<TaskQueue> mTaskQueue;
|
||||
Monitor mTrackMonitor;
|
||||
|
||||
private:
|
||||
@ -240,7 +240,7 @@ private:
|
||||
// Protected by mTrackMonitor.
|
||||
MozPromiseHolder<VideoDataPromise> mVideoPromise;
|
||||
|
||||
nsRefPtr<MediaTaskQueue> mReleaseBufferTaskQueue;
|
||||
nsRefPtr<TaskQueue> mReleaseBufferTaskQueue;
|
||||
private:
|
||||
// Forbidden
|
||||
VideoTrack(const VideoTrack &rhs) = delete;
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "mozilla/CDMProxy.h"
|
||||
#endif
|
||||
#include "SharedThreadPool.h"
|
||||
#include "MediaTaskQueue.h"
|
||||
#include "TaskQueue.h"
|
||||
|
||||
#include "MediaInfo.h"
|
||||
#include "H264Converter.h"
|
||||
@ -176,7 +176,7 @@ PlatformDecoderModule::CreatePDM()
|
||||
|
||||
already_AddRefed<MediaDataDecoder>
|
||||
PlatformDecoderModule::CreateDecoder(const TrackInfo& aConfig,
|
||||
FlushableMediaTaskQueue* aTaskQueue,
|
||||
FlushableTaskQueue* aTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback,
|
||||
layers::LayersBackend aLayersBackend,
|
||||
layers::ImageContainer* aImageContainer)
|
||||
|
@ -25,7 +25,7 @@ class ImageContainer;
|
||||
|
||||
class MediaDataDecoder;
|
||||
class MediaDataDecoderCallback;
|
||||
class FlushableMediaTaskQueue;
|
||||
class FlushableTaskQueue;
|
||||
class CDMProxy;
|
||||
|
||||
// The PlatformDecoderModule interface is used by the MP4Reader to abstract
|
||||
@ -82,7 +82,7 @@ public:
|
||||
// See CreateVideoDecoder and CreateAudioDecoder for implementation details.
|
||||
virtual already_AddRefed<MediaDataDecoder>
|
||||
CreateDecoder(const TrackInfo& aConfig,
|
||||
FlushableMediaTaskQueue* aTaskQueue,
|
||||
FlushableTaskQueue* aTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback,
|
||||
layers::LayersBackend aLayersBackend = layers::LayersBackend::LAYERS_NONE,
|
||||
layers::ImageContainer* aImageContainer = nullptr);
|
||||
@ -130,7 +130,7 @@ protected:
|
||||
CreateVideoDecoder(const VideoInfo& aConfig,
|
||||
layers::LayersBackend aLayersBackend,
|
||||
layers::ImageContainer* aImageContainer,
|
||||
FlushableMediaTaskQueue* aVideoTaskQueue,
|
||||
FlushableTaskQueue* aVideoTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback) = 0;
|
||||
|
||||
// Creates an Audio decoder with the specified properties.
|
||||
@ -145,7 +145,7 @@ protected:
|
||||
// This is called on the decode task queue.
|
||||
virtual already_AddRefed<MediaDataDecoder>
|
||||
CreateAudioDecoder(const AudioInfo& aConfig,
|
||||
FlushableMediaTaskQueue* aAudioTaskQueue,
|
||||
FlushableTaskQueue* aAudioTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback) = 0;
|
||||
|
||||
// Caches pref media.fragmented-mp4.use-blank-decoder
|
||||
@ -195,7 +195,7 @@ public:
|
||||
// should (like in Flush()).
|
||||
//
|
||||
// Decoding is done asynchronously. Any async work can be done on the
|
||||
// MediaTaskQueue passed into the PlatformDecoderModules's Create*Decoder()
|
||||
// TaskQueue passed into the PlatformDecoderModules's Create*Decoder()
|
||||
// function. This may not be necessary for platforms with async APIs
|
||||
// for decoding.
|
||||
class MediaDataDecoder {
|
||||
|
@ -70,7 +70,7 @@ private:
|
||||
};
|
||||
|
||||
SharedDecoderManager::SharedDecoderManager()
|
||||
: mTaskQueue(new FlushableMediaTaskQueue(GetMediaThreadPool(MediaThreadType::PLATFORM_DECODER)))
|
||||
: mTaskQueue(new FlushableTaskQueue(GetMediaThreadPool(MediaThreadType::PLATFORM_DECODER)))
|
||||
, mActiveProxy(nullptr)
|
||||
, mActiveCallback(nullptr)
|
||||
, mWaitForInternalDrain(false)
|
||||
@ -91,7 +91,7 @@ SharedDecoderManager::CreateVideoDecoder(
|
||||
const VideoInfo& aConfig,
|
||||
layers::LayersBackend aLayersBackend,
|
||||
layers::ImageContainer* aImageContainer,
|
||||
FlushableMediaTaskQueue* aVideoTaskQueue,
|
||||
FlushableTaskQueue* aVideoTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback)
|
||||
{
|
||||
if (!mDecoder) {
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
const VideoInfo& aConfig,
|
||||
layers::LayersBackend aLayersBackend,
|
||||
layers::ImageContainer* aImageContainer,
|
||||
FlushableMediaTaskQueue* aVideoTaskQueue,
|
||||
FlushableTaskQueue* aVideoTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback);
|
||||
|
||||
void SetReader(MediaDecoderReader* aReader);
|
||||
@ -52,7 +52,7 @@ private:
|
||||
nsRefPtr<MediaDataDecoder> mDecoder;
|
||||
layers::LayersBackend mLayersBackend;
|
||||
nsRefPtr<layers::ImageContainer> mImageContainer;
|
||||
nsRefPtr<FlushableMediaTaskQueue> mTaskQueue;
|
||||
nsRefPtr<FlushableTaskQueue> mTaskQueue;
|
||||
SharedDecoderProxy* mActiveProxy;
|
||||
MediaDataDecoderCallback* mActiveCallback;
|
||||
nsAutoPtr<MediaDataDecoderCallback> mCallback;
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "VideoUtils.h"
|
||||
#include "ImageContainer.h"
|
||||
#include "MediaInfo.h"
|
||||
#include "MediaTaskQueue.h"
|
||||
#include "TaskQueue.h"
|
||||
#include "TimeUnits.h"
|
||||
|
||||
namespace mozilla {
|
||||
@ -24,7 +24,7 @@ class BlankMediaDataDecoder : public MediaDataDecoder {
|
||||
public:
|
||||
|
||||
BlankMediaDataDecoder(BlankMediaDataCreator* aCreator,
|
||||
FlushableMediaTaskQueue* aTaskQueue,
|
||||
FlushableTaskQueue* aTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback)
|
||||
: mCreator(aCreator)
|
||||
, mTaskQueue(aTaskQueue)
|
||||
@ -87,7 +87,7 @@ public:
|
||||
|
||||
private:
|
||||
nsAutoPtr<BlankMediaDataCreator> mCreator;
|
||||
RefPtr<FlushableMediaTaskQueue> mTaskQueue;
|
||||
RefPtr<FlushableTaskQueue> mTaskQueue;
|
||||
MediaDataDecoderCallback* mCallback;
|
||||
};
|
||||
|
||||
@ -214,7 +214,7 @@ public:
|
||||
CreateVideoDecoder(const VideoInfo& aConfig,
|
||||
layers::LayersBackend aLayersBackend,
|
||||
layers::ImageContainer* aImageContainer,
|
||||
FlushableMediaTaskQueue* aVideoTaskQueue,
|
||||
FlushableTaskQueue* aVideoTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback) override {
|
||||
BlankVideoDataCreator* creator = new BlankVideoDataCreator(
|
||||
aConfig.mDisplay.width, aConfig.mDisplay.height, aImageContainer);
|
||||
@ -228,7 +228,7 @@ public:
|
||||
// Decode thread.
|
||||
virtual already_AddRefed<MediaDataDecoder>
|
||||
CreateAudioDecoder(const AudioInfo& aConfig,
|
||||
FlushableMediaTaskQueue* aAudioTaskQueue,
|
||||
FlushableTaskQueue* aAudioTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback) override {
|
||||
BlankAudioDataCreator* creator = new BlankAudioDataCreator(
|
||||
aConfig.mChannels, aConfig.mRate);
|
||||
|
@ -25,7 +25,7 @@ class EMEAudioDecoder : public GMPAudioDecoder {
|
||||
public:
|
||||
EMEAudioDecoder(CDMProxy* aProxy,
|
||||
const AudioInfo& aConfig,
|
||||
MediaTaskQueue* aTaskQueue,
|
||||
TaskQueue* aTaskQueue,
|
||||
MediaDataDecoderCallbackProxy* aCallback)
|
||||
: GMPAudioDecoder(aConfig, aTaskQueue, aCallback, new EMEAudioCallbackAdapter(aCallback))
|
||||
, mProxy(aProxy)
|
||||
|
@ -35,7 +35,7 @@ public:
|
||||
EMEDecryptor(MediaDataDecoder* aDecoder,
|
||||
MediaDataDecoderCallback* aCallback,
|
||||
CDMProxy* aProxy,
|
||||
MediaTaskQueue* aDecodeTaskQueue)
|
||||
TaskQueue* aDecodeTaskQueue)
|
||||
: mDecoder(aDecoder)
|
||||
, mCallback(aCallback)
|
||||
, mTaskQueue(aDecodeTaskQueue)
|
||||
@ -141,7 +141,7 @@ private:
|
||||
|
||||
nsRefPtr<MediaDataDecoder> mDecoder;
|
||||
MediaDataDecoderCallback* mCallback;
|
||||
nsRefPtr<MediaTaskQueue> mTaskQueue;
|
||||
nsRefPtr<TaskQueue> mTaskQueue;
|
||||
nsRefPtr<CDMProxy> mProxy;
|
||||
nsClassHashtable<nsRefPtrHashKey<MediaRawData>, DecryptPromiseRequestHolder> mDecrypts;
|
||||
nsRefPtr<SamplesWaitingForKey> mSamplesWaitingForKey;
|
||||
@ -150,7 +150,7 @@ private:
|
||||
|
||||
class EMEMediaDataDecoderProxy : public MediaDataDecoderProxy {
|
||||
public:
|
||||
EMEMediaDataDecoderProxy(nsIThread* aProxyThread, MediaDataDecoderCallback* aCallback, CDMProxy* aProxy, FlushableMediaTaskQueue* aTaskQueue)
|
||||
EMEMediaDataDecoderProxy(nsIThread* aProxyThread, MediaDataDecoderCallback* aCallback, CDMProxy* aProxy, FlushableTaskQueue* aTaskQueue)
|
||||
: MediaDataDecoderProxy(aProxyThread, aCallback)
|
||||
, mSamplesWaitingForKey(new SamplesWaitingForKey(this, aTaskQueue, aProxy))
|
||||
, mProxy(aProxy)
|
||||
@ -207,7 +207,7 @@ EMEDecoderModule::~EMEDecoderModule()
|
||||
}
|
||||
|
||||
static already_AddRefed<MediaDataDecoderProxy>
|
||||
CreateDecoderWrapper(MediaDataDecoderCallback* aCallback, CDMProxy* aProxy, FlushableMediaTaskQueue* aTaskQueue)
|
||||
CreateDecoderWrapper(MediaDataDecoderCallback* aCallback, CDMProxy* aProxy, FlushableTaskQueue* aTaskQueue)
|
||||
{
|
||||
nsCOMPtr<mozIGeckoMediaPluginService> gmpService = do_GetService("@mozilla.org/gecko-media-plugin-service;1");
|
||||
if (!gmpService) {
|
||||
@ -228,7 +228,7 @@ already_AddRefed<MediaDataDecoder>
|
||||
EMEDecoderModule::CreateVideoDecoder(const VideoInfo& aConfig,
|
||||
layers::LayersBackend aLayersBackend,
|
||||
layers::ImageContainer* aImageContainer,
|
||||
FlushableMediaTaskQueue* aVideoTaskQueue,
|
||||
FlushableTaskQueue* aVideoTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback)
|
||||
{
|
||||
if (mCDMDecodesVideo && aConfig.mCrypto.mValid) {
|
||||
@ -266,7 +266,7 @@ EMEDecoderModule::CreateVideoDecoder(const VideoInfo& aConfig,
|
||||
|
||||
already_AddRefed<MediaDataDecoder>
|
||||
EMEDecoderModule::CreateAudioDecoder(const AudioInfo& aConfig,
|
||||
FlushableMediaTaskQueue* aAudioTaskQueue,
|
||||
FlushableTaskQueue* aAudioTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback)
|
||||
{
|
||||
if (mCDMDecodesAudio && aConfig.mCrypto.mValid) {
|
||||
|
@ -30,13 +30,13 @@ public:
|
||||
CreateVideoDecoder(const VideoInfo& aConfig,
|
||||
layers::LayersBackend aLayersBackend,
|
||||
layers::ImageContainer* aImageContainer,
|
||||
FlushableMediaTaskQueue* aVideoTaskQueue,
|
||||
FlushableTaskQueue* aVideoTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback) override;
|
||||
|
||||
// Decode thread.
|
||||
virtual already_AddRefed<MediaDataDecoder>
|
||||
CreateAudioDecoder(const AudioInfo& aConfig,
|
||||
FlushableMediaTaskQueue* aAudioTaskQueue,
|
||||
FlushableTaskQueue* aAudioTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback) override;
|
||||
|
||||
virtual ConversionRequired
|
||||
@ -47,7 +47,7 @@ private:
|
||||
// Will be null if CDM has decoding capability.
|
||||
nsRefPtr<PlatformDecoderModule> mPDM;
|
||||
// We run the PDM on its own task queue.
|
||||
nsRefPtr<MediaTaskQueue> mTaskQueue;
|
||||
nsRefPtr<TaskQueue> mTaskQueue;
|
||||
bool mCDMDecodesAudio;
|
||||
bool mCDMDecodesVideo;
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
namespace mozilla {
|
||||
|
||||
class CDMProxy;
|
||||
class MediaTaskQueue;
|
||||
class TaskQueue;
|
||||
|
||||
class EMEVideoCallbackAdapter : public VideoCallbackAdapter {
|
||||
public:
|
||||
@ -32,7 +32,7 @@ public:
|
||||
const VideoInfo& aConfig,
|
||||
layers::LayersBackend aLayersBackend,
|
||||
layers::ImageContainer* aImageContainer,
|
||||
MediaTaskQueue* aTaskQueue,
|
||||
TaskQueue* aTaskQueue,
|
||||
MediaDataDecoderCallbackProxy* aCallback)
|
||||
: GMPVideoDecoder(aConfig,
|
||||
aLayersBackend,
|
||||
|
@ -12,7 +12,7 @@
|
||||
namespace mozilla {
|
||||
|
||||
SamplesWaitingForKey::SamplesWaitingForKey(MediaDataDecoder* aDecoder,
|
||||
MediaTaskQueue* aTaskQueue,
|
||||
TaskQueue* aTaskQueue,
|
||||
CDMProxy* aProxy)
|
||||
: mMutex("SamplesWaitingForKey")
|
||||
, mDecoder(aDecoder)
|
||||
|
@ -7,7 +7,7 @@
|
||||
#ifndef SamplesWaitingForKey_h_
|
||||
#define SamplesWaitingForKey_h_
|
||||
|
||||
#include "MediaTaskQueue.h"
|
||||
#include "TaskQueue.h"
|
||||
#include "PlatformDecoderModule.h"
|
||||
|
||||
namespace mozilla {
|
||||
@ -24,7 +24,7 @@ public:
|
||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(SamplesWaitingForKey)
|
||||
|
||||
explicit SamplesWaitingForKey(MediaDataDecoder* aDecoder,
|
||||
MediaTaskQueue* aTaskQueue,
|
||||
TaskQueue* aTaskQueue,
|
||||
CDMProxy* aProxy);
|
||||
|
||||
// Returns true if we need to wait for a key to become usable.
|
||||
@ -45,7 +45,7 @@ protected:
|
||||
private:
|
||||
Mutex mMutex;
|
||||
nsRefPtr<MediaDataDecoder> mDecoder;
|
||||
nsRefPtr<MediaTaskQueue> mTaskQueue;
|
||||
nsRefPtr<TaskQueue> mTaskQueue;
|
||||
nsRefPtr<CDMProxy> mProxy;
|
||||
nsTArray<nsRefPtr<MediaRawData>> mSamples;
|
||||
};
|
||||
|
@ -48,7 +48,7 @@ private:
|
||||
class GMPAudioDecoder : public MediaDataDecoder {
|
||||
protected:
|
||||
GMPAudioDecoder(const AudioInfo& aConfig,
|
||||
MediaTaskQueue* aTaskQueue,
|
||||
TaskQueue* aTaskQueue,
|
||||
MediaDataDecoderCallbackProxy* aCallback,
|
||||
AudioCallbackAdapter* aAdapter)
|
||||
: mConfig(aConfig)
|
||||
@ -60,7 +60,7 @@ protected:
|
||||
|
||||
public:
|
||||
GMPAudioDecoder(const AudioInfo& aConfig,
|
||||
MediaTaskQueue* aTaskQueue,
|
||||
TaskQueue* aTaskQueue,
|
||||
MediaDataDecoderCallbackProxy* aCallback)
|
||||
: mConfig(aConfig)
|
||||
, mCallback(aCallback)
|
||||
|
@ -43,7 +43,7 @@ already_AddRefed<MediaDataDecoder>
|
||||
GMPDecoderModule::CreateVideoDecoder(const VideoInfo& aConfig,
|
||||
layers::LayersBackend aLayersBackend,
|
||||
layers::ImageContainer* aImageContainer,
|
||||
FlushableMediaTaskQueue* aVideoTaskQueue,
|
||||
FlushableTaskQueue* aVideoTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback)
|
||||
{
|
||||
if (!aConfig.mMimeType.EqualsLiteral("video/avc")) {
|
||||
@ -61,7 +61,7 @@ GMPDecoderModule::CreateVideoDecoder(const VideoInfo& aConfig,
|
||||
|
||||
already_AddRefed<MediaDataDecoder>
|
||||
GMPDecoderModule::CreateAudioDecoder(const AudioInfo& aConfig,
|
||||
FlushableMediaTaskQueue* aAudioTaskQueue,
|
||||
FlushableTaskQueue* aAudioTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback)
|
||||
{
|
||||
if (!aConfig.mMimeType.EqualsLiteral("audio/mp4a-latm")) {
|
||||
|
@ -22,13 +22,13 @@ public:
|
||||
CreateVideoDecoder(const VideoInfo& aConfig,
|
||||
layers::LayersBackend aLayersBackend,
|
||||
layers::ImageContainer* aImageContainer,
|
||||
FlushableMediaTaskQueue* aVideoTaskQueue,
|
||||
FlushableTaskQueue* aVideoTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback) override;
|
||||
|
||||
// Decode thread.
|
||||
virtual already_AddRefed<MediaDataDecoder>
|
||||
CreateAudioDecoder(const AudioInfo& aConfig,
|
||||
FlushableMediaTaskQueue* aAudioTaskQueue,
|
||||
FlushableTaskQueue* aAudioTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback) override;
|
||||
|
||||
virtual ConversionRequired
|
||||
|
@ -54,7 +54,7 @@ protected:
|
||||
GMPVideoDecoder(const VideoInfo& aConfig,
|
||||
layers::LayersBackend aLayersBackend,
|
||||
layers::ImageContainer* aImageContainer,
|
||||
MediaTaskQueue* aTaskQueue,
|
||||
TaskQueue* aTaskQueue,
|
||||
MediaDataDecoderCallbackProxy* aCallback,
|
||||
VideoCallbackAdapter* aAdapter)
|
||||
: mConfig(aConfig)
|
||||
@ -70,7 +70,7 @@ public:
|
||||
GMPVideoDecoder(const VideoInfo& aConfig,
|
||||
layers::LayersBackend aLayersBackend,
|
||||
layers::ImageContainer* aImageContainer,
|
||||
MediaTaskQueue* aTaskQueue,
|
||||
TaskQueue* aTaskQueue,
|
||||
MediaDataDecoderCallbackProxy* aCallback)
|
||||
: mConfig(aConfig)
|
||||
, mCallback(aCallback)
|
||||
|
@ -267,7 +267,7 @@ AndroidDecoderModule::CreateVideoDecoder(
|
||||
const VideoInfo& aConfig,
|
||||
layers::LayersBackend aLayersBackend,
|
||||
layers::ImageContainer* aImageContainer,
|
||||
FlushableMediaTaskQueue* aVideoTaskQueue,
|
||||
FlushableTaskQueue* aVideoTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback)
|
||||
{
|
||||
MediaFormat::LocalRef format;
|
||||
@ -286,7 +286,7 @@ AndroidDecoderModule::CreateVideoDecoder(
|
||||
|
||||
already_AddRefed<MediaDataDecoder>
|
||||
AndroidDecoderModule::CreateAudioDecoder(const AudioInfo& aConfig,
|
||||
FlushableMediaTaskQueue* aAudioTaskQueue,
|
||||
FlushableTaskQueue* aAudioTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback)
|
||||
{
|
||||
MOZ_ASSERT(aConfig.mBitDepth == 16, "We only handle 16-bit audio!");
|
||||
|
@ -24,12 +24,12 @@ public:
|
||||
CreateVideoDecoder(const VideoInfo& aConfig,
|
||||
layers::LayersBackend aLayersBackend,
|
||||
layers::ImageContainer* aImageContainer,
|
||||
FlushableMediaTaskQueue* aVideoTaskQueue,
|
||||
FlushableTaskQueue* aVideoTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback) override;
|
||||
|
||||
virtual already_AddRefed<MediaDataDecoder>
|
||||
CreateAudioDecoder(const AudioInfo& aConfig,
|
||||
FlushableMediaTaskQueue* aAudioTaskQueue,
|
||||
FlushableTaskQueue* aAudioTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback) override;
|
||||
|
||||
|
||||
|
@ -19,7 +19,7 @@ PRLogModuleInfo* GetAppleMediaLog();
|
||||
namespace mozilla {
|
||||
|
||||
AppleATDecoder::AppleATDecoder(const AudioInfo& aConfig,
|
||||
FlushableMediaTaskQueue* aAudioTaskQueue,
|
||||
FlushableTaskQueue* aAudioTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback)
|
||||
: mConfig(aConfig)
|
||||
, mFileStreamError(false)
|
||||
|
@ -15,13 +15,13 @@
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class FlushableMediaTaskQueue;
|
||||
class FlushableTaskQueue;
|
||||
class MediaDataDecoderCallback;
|
||||
|
||||
class AppleATDecoder : public MediaDataDecoder {
|
||||
public:
|
||||
AppleATDecoder(const AudioInfo& aConfig,
|
||||
FlushableMediaTaskQueue* aVideoTaskQueue,
|
||||
FlushableTaskQueue* aVideoTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback);
|
||||
virtual ~AppleATDecoder();
|
||||
|
||||
@ -41,7 +41,7 @@ public:
|
||||
bool mFileStreamError;
|
||||
|
||||
private:
|
||||
nsRefPtr<FlushableMediaTaskQueue> mTaskQueue;
|
||||
nsRefPtr<FlushableTaskQueue> mTaskQueue;
|
||||
MediaDataDecoderCallback* mCallback;
|
||||
AudioConverterRef mConverter;
|
||||
AudioStreamBasicDescription mOutputFormat;
|
||||
|
@ -80,7 +80,7 @@ already_AddRefed<MediaDataDecoder>
|
||||
AppleDecoderModule::CreateVideoDecoder(const VideoInfo& aConfig,
|
||||
layers::LayersBackend aLayersBackend,
|
||||
layers::ImageContainer* aImageContainer,
|
||||
FlushableMediaTaskQueue* aVideoTaskQueue,
|
||||
FlushableTaskQueue* aVideoTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback)
|
||||
{
|
||||
nsRefPtr<MediaDataDecoder> decoder;
|
||||
@ -106,7 +106,7 @@ AppleDecoderModule::CreateVideoDecoder(const VideoInfo& aConfig,
|
||||
|
||||
already_AddRefed<MediaDataDecoder>
|
||||
AppleDecoderModule::CreateAudioDecoder(const AudioInfo& aConfig,
|
||||
FlushableMediaTaskQueue* aAudioTaskQueue,
|
||||
FlushableTaskQueue* aAudioTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback)
|
||||
{
|
||||
nsRefPtr<MediaDataDecoder> decoder =
|
||||
|
@ -23,13 +23,13 @@ public:
|
||||
CreateVideoDecoder(const VideoInfo& aConfig,
|
||||
layers::LayersBackend aLayersBackend,
|
||||
layers::ImageContainer* aImageContainer,
|
||||
FlushableMediaTaskQueue* aVideoTaskQueue,
|
||||
FlushableTaskQueue* aVideoTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback) override;
|
||||
|
||||
// Decode thread.
|
||||
virtual already_AddRefed<MediaDataDecoder>
|
||||
CreateAudioDecoder(const AudioInfo& aConfig,
|
||||
FlushableMediaTaskQueue* aAudioTaskQueue,
|
||||
FlushableTaskQueue* aAudioTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback) override;
|
||||
|
||||
virtual bool SupportsMimeType(const nsACString& aMimeType) override;
|
||||
|
@ -30,7 +30,7 @@ PRLogModuleInfo* GetAppleMediaLog();
|
||||
namespace mozilla {
|
||||
|
||||
AppleVDADecoder::AppleVDADecoder(const VideoInfo& aConfig,
|
||||
FlushableMediaTaskQueue* aVideoTaskQueue,
|
||||
FlushableTaskQueue* aVideoTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback,
|
||||
layers::ImageContainer* aImageContainer)
|
||||
: mTaskQueue(aVideoTaskQueue)
|
||||
@ -501,7 +501,7 @@ AppleVDADecoder::CreateOutputConfiguration()
|
||||
already_AddRefed<AppleVDADecoder>
|
||||
AppleVDADecoder::CreateVDADecoder(
|
||||
const VideoInfo& aConfig,
|
||||
FlushableMediaTaskQueue* aVideoTaskQueue,
|
||||
FlushableTaskQueue* aVideoTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback,
|
||||
layers::ImageContainer* aImageContainer)
|
||||
{
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class FlushableMediaTaskQueue;
|
||||
class FlushableTaskQueue;
|
||||
class MediaDataDecoderCallback;
|
||||
namespace layers {
|
||||
class ImageContainer;
|
||||
@ -62,12 +62,12 @@ public:
|
||||
// not supported by current configuration.
|
||||
static already_AddRefed<AppleVDADecoder> CreateVDADecoder(
|
||||
const VideoInfo& aConfig,
|
||||
FlushableMediaTaskQueue* aVideoTaskQueue,
|
||||
FlushableTaskQueue* aVideoTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback,
|
||||
layers::ImageContainer* aImageContainer);
|
||||
|
||||
AppleVDADecoder(const VideoInfo& aConfig,
|
||||
FlushableMediaTaskQueue* aVideoTaskQueue,
|
||||
FlushableTaskQueue* aVideoTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback,
|
||||
layers::ImageContainer* aImageContainer);
|
||||
virtual ~AppleVDADecoder();
|
||||
@ -91,7 +91,7 @@ public:
|
||||
CFDictionaryRef CreateOutputConfiguration();
|
||||
|
||||
nsRefPtr<MediaByteBuffer> mExtraData;
|
||||
nsRefPtr<FlushableMediaTaskQueue> mTaskQueue;
|
||||
nsRefPtr<FlushableTaskQueue> mTaskQueue;
|
||||
MediaDataDecoderCallback* mCallback;
|
||||
nsRefPtr<layers::ImageContainer> mImageContainer;
|
||||
ReorderQueue mReorderQueue;
|
||||
|
@ -31,7 +31,7 @@ PRLogModuleInfo* GetAppleMediaLog();
|
||||
namespace mozilla {
|
||||
|
||||
AppleVTDecoder::AppleVTDecoder(const VideoInfo& aConfig,
|
||||
FlushableMediaTaskQueue* aVideoTaskQueue,
|
||||
FlushableTaskQueue* aVideoTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback,
|
||||
layers::ImageContainer* aImageContainer)
|
||||
: AppleVDADecoder(aConfig, aVideoTaskQueue, aCallback, aImageContainer)
|
||||
|
@ -16,7 +16,7 @@ namespace mozilla {
|
||||
class AppleVTDecoder : public AppleVDADecoder {
|
||||
public:
|
||||
AppleVTDecoder(const VideoInfo& aConfig,
|
||||
FlushableMediaTaskQueue* aVideoTaskQueue,
|
||||
FlushableTaskQueue* aVideoTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback,
|
||||
layers::ImageContainer* aImageContainer);
|
||||
virtual ~AppleVTDecoder();
|
||||
|
@ -4,7 +4,7 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "MediaTaskQueue.h"
|
||||
#include "TaskQueue.h"
|
||||
#include "FFmpegRuntimeLinker.h"
|
||||
|
||||
#include "FFmpegAudioDecoder.h"
|
||||
@ -16,7 +16,7 @@ namespace mozilla
|
||||
{
|
||||
|
||||
FFmpegAudioDecoder<LIBAV_VER>::FFmpegAudioDecoder(
|
||||
FlushableMediaTaskQueue* aTaskQueue, MediaDataDecoderCallback* aCallback,
|
||||
FlushableTaskQueue* aTaskQueue, MediaDataDecoderCallback* aCallback,
|
||||
const AudioInfo& aConfig)
|
||||
: FFmpegDataDecoder(aTaskQueue, GetCodecId(aConfig.mMimeType))
|
||||
, mCallback(aCallback)
|
||||
|
@ -20,7 +20,7 @@ template <>
|
||||
class FFmpegAudioDecoder<LIBAV_VER> : public FFmpegDataDecoder<LIBAV_VER>
|
||||
{
|
||||
public:
|
||||
FFmpegAudioDecoder(FlushableMediaTaskQueue* aTaskQueue,
|
||||
FFmpegAudioDecoder(FlushableTaskQueue* aTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback,
|
||||
const AudioInfo& aConfig);
|
||||
virtual ~FFmpegAudioDecoder();
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "MediaTaskQueue.h"
|
||||
#include "TaskQueue.h"
|
||||
#include "FFmpegLibs.h"
|
||||
#include "FFmpegLog.h"
|
||||
#include "FFmpegDataDecoder.h"
|
||||
@ -19,7 +19,7 @@ namespace mozilla
|
||||
bool FFmpegDataDecoder<LIBAV_VER>::sFFmpegInitDone = false;
|
||||
StaticMutex FFmpegDataDecoder<LIBAV_VER>::sMonitor;
|
||||
|
||||
FFmpegDataDecoder<LIBAV_VER>::FFmpegDataDecoder(FlushableMediaTaskQueue* aTaskQueue,
|
||||
FFmpegDataDecoder<LIBAV_VER>::FFmpegDataDecoder(FlushableTaskQueue* aTaskQueue,
|
||||
AVCodecID aCodecID)
|
||||
: mTaskQueue(aTaskQueue)
|
||||
, mCodecContext(nullptr)
|
||||
|
@ -24,7 +24,7 @@ template <>
|
||||
class FFmpegDataDecoder<LIBAV_VER> : public MediaDataDecoder
|
||||
{
|
||||
public:
|
||||
FFmpegDataDecoder(FlushableMediaTaskQueue* aTaskQueue, AVCodecID aCodecID);
|
||||
FFmpegDataDecoder(FlushableTaskQueue* aTaskQueue, AVCodecID aCodecID);
|
||||
virtual ~FFmpegDataDecoder();
|
||||
|
||||
static bool Link();
|
||||
@ -38,7 +38,7 @@ public:
|
||||
protected:
|
||||
AVFrame* PrepareFrame();
|
||||
|
||||
FlushableMediaTaskQueue* mTaskQueue;
|
||||
FlushableTaskQueue* mTaskQueue;
|
||||
AVCodecContext* mCodecContext;
|
||||
AVFrame* mFrame;
|
||||
nsRefPtr<MediaByteBuffer> mExtraData;
|
||||
|
@ -32,7 +32,7 @@ public:
|
||||
CreateVideoDecoder(const VideoInfo& aConfig,
|
||||
layers::LayersBackend aLayersBackend,
|
||||
layers::ImageContainer* aImageContainer,
|
||||
FlushableMediaTaskQueue* aVideoTaskQueue,
|
||||
FlushableTaskQueue* aVideoTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback) override
|
||||
{
|
||||
nsRefPtr<MediaDataDecoder> decoder =
|
||||
@ -43,7 +43,7 @@ public:
|
||||
|
||||
virtual already_AddRefed<MediaDataDecoder>
|
||||
CreateAudioDecoder(const AudioInfo& aConfig,
|
||||
FlushableMediaTaskQueue* aAudioTaskQueue,
|
||||
FlushableTaskQueue* aAudioTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback) override
|
||||
{
|
||||
nsRefPtr<MediaDataDecoder> decoder =
|
||||
|
@ -4,7 +4,7 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "MediaTaskQueue.h"
|
||||
#include "TaskQueue.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "ImageContainer.h"
|
||||
@ -23,7 +23,7 @@ namespace mozilla
|
||||
{
|
||||
|
||||
FFmpegH264Decoder<LIBAV_VER>::FFmpegH264Decoder(
|
||||
FlushableMediaTaskQueue* aTaskQueue, MediaDataDecoderCallback* aCallback,
|
||||
FlushableTaskQueue* aTaskQueue, MediaDataDecoderCallback* aCallback,
|
||||
const VideoInfo& aConfig,
|
||||
ImageContainer* aImageContainer)
|
||||
: FFmpegDataDecoder(aTaskQueue, GetCodecId(aConfig.mMimeType))
|
||||
|
@ -30,7 +30,7 @@ class FFmpegH264Decoder<LIBAV_VER> : public FFmpegDataDecoder<LIBAV_VER>
|
||||
};
|
||||
|
||||
public:
|
||||
FFmpegH264Decoder(FlushableMediaTaskQueue* aTaskQueue,
|
||||
FFmpegH264Decoder(FlushableTaskQueue* aTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback,
|
||||
const VideoInfo& aConfig,
|
||||
ImageContainer* aImageContainer);
|
||||
|
@ -30,7 +30,7 @@ already_AddRefed<MediaDataDecoder>
|
||||
GonkDecoderModule::CreateVideoDecoder(const VideoInfo& aConfig,
|
||||
mozilla::layers::LayersBackend aLayersBackend,
|
||||
mozilla::layers::ImageContainer* aImageContainer,
|
||||
FlushableMediaTaskQueue* aVideoTaskQueue,
|
||||
FlushableTaskQueue* aVideoTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback)
|
||||
{
|
||||
nsRefPtr<MediaDataDecoder> decoder =
|
||||
@ -41,7 +41,7 @@ GonkDecoderModule::CreateVideoDecoder(const VideoInfo& aConfig,
|
||||
|
||||
already_AddRefed<MediaDataDecoder>
|
||||
GonkDecoderModule::CreateAudioDecoder(const AudioInfo& aConfig,
|
||||
FlushableMediaTaskQueue* aAudioTaskQueue,
|
||||
FlushableTaskQueue* aAudioTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback)
|
||||
{
|
||||
nsRefPtr<MediaDataDecoder> decoder =
|
||||
|
@ -21,13 +21,13 @@ public:
|
||||
CreateVideoDecoder(const VideoInfo& aConfig,
|
||||
mozilla::layers::LayersBackend aLayersBackend,
|
||||
mozilla::layers::ImageContainer* aImageContainer,
|
||||
FlushableMediaTaskQueue* aVideoTaskQueue,
|
||||
FlushableTaskQueue* aVideoTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback) override;
|
||||
|
||||
// Decode thread.
|
||||
virtual already_AddRefed<MediaDataDecoder>
|
||||
CreateAudioDecoder(const AudioInfo& aConfig,
|
||||
FlushableMediaTaskQueue* aAudioTaskQueue,
|
||||
FlushableTaskQueue* aAudioTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback) override;
|
||||
|
||||
static void Init();
|
||||
|
@ -21,7 +21,7 @@ using namespace android;
|
||||
namespace mozilla {
|
||||
|
||||
GonkMediaDataDecoder::GonkMediaDataDecoder(GonkDecoderManager* aManager,
|
||||
FlushableMediaTaskQueue* aTaskQueue,
|
||||
FlushableTaskQueue* aTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback)
|
||||
: mTaskQueue(aTaskQueue)
|
||||
, mCallback(aCallback)
|
||||
|
@ -56,7 +56,7 @@ protected:
|
||||
class GonkMediaDataDecoder : public MediaDataDecoder {
|
||||
public:
|
||||
GonkMediaDataDecoder(GonkDecoderManager* aDecoderManager,
|
||||
FlushableMediaTaskQueue* aTaskQueue,
|
||||
FlushableTaskQueue* aTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback);
|
||||
|
||||
~GonkMediaDataDecoder();
|
||||
@ -87,7 +87,7 @@ private:
|
||||
// all available output.
|
||||
void ProcessDrain();
|
||||
|
||||
RefPtr<FlushableMediaTaskQueue> mTaskQueue;
|
||||
RefPtr<FlushableTaskQueue> mTaskQueue;
|
||||
MediaDataDecoderCallback* mCallback;
|
||||
|
||||
android::sp<android::MediaCodecProxy> mDecoder;
|
||||
|
@ -66,7 +66,7 @@ already_AddRefed<MediaDataDecoder>
|
||||
WMFDecoderModule::CreateVideoDecoder(const VideoInfo& aConfig,
|
||||
layers::LayersBackend aLayersBackend,
|
||||
layers::ImageContainer* aImageContainer,
|
||||
FlushableMediaTaskQueue* aVideoTaskQueue,
|
||||
FlushableTaskQueue* aVideoTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback)
|
||||
{
|
||||
nsRefPtr<MediaDataDecoder> decoder =
|
||||
@ -81,7 +81,7 @@ WMFDecoderModule::CreateVideoDecoder(const VideoInfo& aConfig,
|
||||
|
||||
already_AddRefed<MediaDataDecoder>
|
||||
WMFDecoderModule::CreateAudioDecoder(const AudioInfo& aConfig,
|
||||
FlushableMediaTaskQueue* aAudioTaskQueue,
|
||||
FlushableTaskQueue* aAudioTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback)
|
||||
{
|
||||
nsRefPtr<MediaDataDecoder> decoder =
|
||||
|
@ -23,12 +23,12 @@ public:
|
||||
CreateVideoDecoder(const VideoInfo& aConfig,
|
||||
layers::LayersBackend aLayersBackend,
|
||||
layers::ImageContainer* aImageContainer,
|
||||
FlushableMediaTaskQueue* aVideoTaskQueue,
|
||||
FlushableTaskQueue* aVideoTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback) override;
|
||||
|
||||
virtual already_AddRefed<MediaDataDecoder>
|
||||
CreateAudioDecoder(const AudioInfo& aConfig,
|
||||
FlushableMediaTaskQueue* aAudioTaskQueue,
|
||||
FlushableTaskQueue* aAudioTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback) override;
|
||||
|
||||
bool SupportsMimeType(const nsACString& aMimeType) override;
|
||||
|
@ -18,7 +18,7 @@ PRLogModuleInfo* GetDemuxerLog();
|
||||
namespace mozilla {
|
||||
|
||||
WMFMediaDataDecoder::WMFMediaDataDecoder(MFTManager* aMFTManager,
|
||||
FlushableMediaTaskQueue* aTaskQueue,
|
||||
FlushableTaskQueue* aTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback)
|
||||
: mTaskQueue(aTaskQueue)
|
||||
, mCallback(aCallback)
|
||||
|
@ -55,7 +55,7 @@ public:
|
||||
class WMFMediaDataDecoder : public MediaDataDecoder {
|
||||
public:
|
||||
WMFMediaDataDecoder(MFTManager* aOutputSource,
|
||||
FlushableMediaTaskQueue* aAudioTaskQueue,
|
||||
FlushableTaskQueue* aAudioTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback);
|
||||
~WMFMediaDataDecoder();
|
||||
|
||||
@ -91,7 +91,7 @@ private:
|
||||
|
||||
void ProcessShutdown();
|
||||
|
||||
RefPtr<FlushableMediaTaskQueue> mTaskQueue;
|
||||
RefPtr<FlushableTaskQueue> mTaskQueue;
|
||||
MediaDataDecoderCallback* mCallback;
|
||||
|
||||
RefPtr<MFTDecoder> mDecoder;
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include "H264Converter.h"
|
||||
#include "ImageContainer.h"
|
||||
#include "MediaTaskQueue.h"
|
||||
#include "TaskQueue.h"
|
||||
#include "MediaInfo.h"
|
||||
#include "mp4_demuxer/AnnexB.h"
|
||||
#include "mp4_demuxer/H264.h"
|
||||
@ -18,7 +18,7 @@ H264Converter::H264Converter(PlatformDecoderModule* aPDM,
|
||||
const VideoInfo& aConfig,
|
||||
layers::LayersBackend aLayersBackend,
|
||||
layers::ImageContainer* aImageContainer,
|
||||
FlushableMediaTaskQueue* aVideoTaskQueue,
|
||||
FlushableTaskQueue* aVideoTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback)
|
||||
: mPDM(aPDM)
|
||||
, mCurrentConfig(aConfig)
|
||||
|
@ -25,7 +25,7 @@ public:
|
||||
const VideoInfo& aConfig,
|
||||
layers::LayersBackend aLayersBackend,
|
||||
layers::ImageContainer* aImageContainer,
|
||||
FlushableMediaTaskQueue* aVideoTaskQueue,
|
||||
FlushableTaskQueue* aVideoTaskQueue,
|
||||
MediaDataDecoderCallback* aCallback);
|
||||
virtual ~H264Converter();
|
||||
|
||||
@ -52,7 +52,7 @@ private:
|
||||
VideoInfo mCurrentConfig;
|
||||
layers::LayersBackend mLayersBackend;
|
||||
nsRefPtr<layers::ImageContainer> mImageContainer;
|
||||
nsRefPtr<FlushableMediaTaskQueue> mVideoTaskQueue;
|
||||
nsRefPtr<FlushableTaskQueue> mVideoTaskQueue;
|
||||
MediaDataDecoderCallback* mCallback;
|
||||
nsRefPtr<MediaDataDecoder> mDecoder;
|
||||
bool mNeedAVCC;
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include "gfxPrefs.h"
|
||||
#include "MediaSystemResourceManagerChild.h"
|
||||
#include "MediaTaskQueue.h"
|
||||
#include "TaskQueue.h"
|
||||
#include "mozilla/layers/ImageBridgeChild.h"
|
||||
|
||||
#include "MediaSystemResourceManager.h"
|
||||
|
@ -24,7 +24,7 @@ class MediaSystemResourceManagerChild;
|
||||
|
||||
class MediaSystemResourceClient;
|
||||
class MediaSystemResourceReservationListener;
|
||||
class MediaTaskQueue;
|
||||
class TaskQueue;
|
||||
class ReentrantMonitor;
|
||||
|
||||
/**
|
||||
|
@ -33,7 +33,7 @@ BufferDecoder::~BufferDecoder()
|
||||
}
|
||||
|
||||
void
|
||||
BufferDecoder::BeginDecoding(MediaTaskQueue* aTaskQueueIdentity)
|
||||
BufferDecoder::BeginDecoding(TaskQueue* aTaskQueueIdentity)
|
||||
{
|
||||
MOZ_ASSERT(!mTaskQueueIdentity && aTaskQueueIdentity);
|
||||
mTaskQueueIdentity = aTaskQueueIdentity;
|
||||
|
@ -8,7 +8,7 @@
|
||||
#define BUFFER_DECODER_H_
|
||||
|
||||
#include "AbstractMediaDecoder.h"
|
||||
#include "MediaTaskQueue.h"
|
||||
#include "TaskQueue.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/ReentrantMonitor.h"
|
||||
|
||||
@ -28,7 +28,7 @@ public:
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
|
||||
// This has to be called before decoding begins
|
||||
void BeginDecoding(MediaTaskQueue* aTaskQueueIdentity);
|
||||
void BeginDecoding(TaskQueue* aTaskQueueIdentity);
|
||||
|
||||
virtual ReentrantMonitor& GetReentrantMonitor() final override;
|
||||
|
||||
@ -78,7 +78,7 @@ private:
|
||||
// It's just there in order for us to be able to override
|
||||
// GetReentrantMonitor correctly.
|
||||
ReentrantMonitor mReentrantMonitor;
|
||||
nsRefPtr<MediaTaskQueue> mTaskQueueIdentity;
|
||||
nsRefPtr<TaskQueue> mTaskQueueIdentity;
|
||||
nsRefPtr<MediaResource> mResource;
|
||||
};
|
||||
|
||||
|
@ -507,7 +507,7 @@ AsyncDecodeWebAudio(const char* aContentType, uint8_t* aBuffer,
|
||||
// task->Reader()->OwnerThread()->Dispatch(task.forget())
|
||||
// we might evaluate the task.forget() before calling Reader(). Enforce
|
||||
// a non-crashy order-of-operations.
|
||||
MediaTaskQueue* taskQueue = task->Reader()->OwnerThread();
|
||||
TaskQueue* taskQueue = task->Reader()->OwnerThread();
|
||||
taskQueue->Dispatch(task.forget());
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "gfx2DGlue.h"
|
||||
#include "Layers.h"
|
||||
#include "MediaResource.h"
|
||||
#include "MediaTaskQueue.h"
|
||||
#include "TaskQueue.h"
|
||||
#include "mozilla/dom/HTMLMediaElement.h"
|
||||
#include "nsError.h"
|
||||
#include "SharedThreadPool.h"
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include "MediaInfo.h"
|
||||
#include "MediaData.h"
|
||||
|
||||
class MediaTaskQueue;
|
||||
class TaskQueue;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
@ -70,7 +70,7 @@ private:
|
||||
|
||||
// TaskQueue on which decoder can choose to decode.
|
||||
// Only non-null up until the decoder is created.
|
||||
nsRefPtr<FlushableMediaTaskQueue> mTaskQueue;
|
||||
nsRefPtr<FlushableTaskQueue> mTaskQueue;
|
||||
|
||||
// Monitor that protects all non-threadsafe state; the primitives
|
||||
// that follow.
|
||||
|
@ -144,7 +144,7 @@ static void webm_log(nestegg * context,
|
||||
static bool sIsIntelDecoderEnabled = false;
|
||||
#endif
|
||||
|
||||
WebMReader::WebMReader(AbstractMediaDecoder* aDecoder, MediaTaskQueue* aBorrowedTaskQueue)
|
||||
WebMReader::WebMReader(AbstractMediaDecoder* aDecoder, TaskQueue* aBorrowedTaskQueue)
|
||||
: MediaDecoderReader(aDecoder, aBorrowedTaskQueue)
|
||||
, mContext(nullptr)
|
||||
, mVideoTrack(0)
|
||||
@ -209,7 +209,7 @@ nsresult WebMReader::Init(MediaDecoderReader* aCloneDonor)
|
||||
|
||||
InitLayersBackendType();
|
||||
|
||||
mVideoTaskQueue = new FlushableMediaTaskQueue(
|
||||
mVideoTaskQueue = new FlushableTaskQueue(
|
||||
SharedThreadPool::Get(NS_LITERAL_CSTRING("IntelVP8 Video Decode")));
|
||||
NS_ENSURE_TRUE(mVideoTaskQueue, NS_ERROR_FAILURE);
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ public:
|
||||
class WebMReader : public MediaDecoderReader
|
||||
{
|
||||
public:
|
||||
explicit WebMReader(AbstractMediaDecoder* aDecoder, MediaTaskQueue* aBorrowedTaskQueue = nullptr);
|
||||
explicit WebMReader(AbstractMediaDecoder* aDecoder, TaskQueue* aBorrowedTaskQueue = nullptr);
|
||||
|
||||
protected:
|
||||
~WebMReader();
|
||||
@ -205,7 +205,7 @@ public:
|
||||
int64_t GetLastVideoFrameTime();
|
||||
void SetLastVideoFrameTime(int64_t aFrameTime);
|
||||
layers::LayersBackend GetLayersBackendType() { return mLayersBackendType; }
|
||||
FlushableMediaTaskQueue* GetVideoTaskQueue() { return mVideoTaskQueue; }
|
||||
FlushableTaskQueue* GetVideoTaskQueue() { return mVideoTaskQueue; }
|
||||
uint64_t GetCodecDelay() { return mCodecDelay; }
|
||||
|
||||
protected:
|
||||
@ -293,7 +293,7 @@ private:
|
||||
layers::LayersBackend mLayersBackendType;
|
||||
|
||||
// For hardware video decoding.
|
||||
nsRefPtr<FlushableMediaTaskQueue> mVideoTaskQueue;
|
||||
nsRefPtr<FlushableTaskQueue> mVideoTaskQueue;
|
||||
|
||||
// Booleans to indicate if we have audio and/or video data
|
||||
bool mHasVideo;
|
||||
|
Loading…
Reference in New Issue
Block a user