зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 14b8c2f4764f (bug 1264694)
This commit is contained in:
Родитель
68d5be6b79
Коммит
2963660445
|
@ -111,6 +111,7 @@ TrackBuffersManager::TrackBuffersManager(MediaSourceDecoder* aParentDecoder,
|
|||
|
||||
TrackBuffersManager::~TrackBuffersManager()
|
||||
{
|
||||
CancelAllTasks();
|
||||
ShutdownDemuxers();
|
||||
}
|
||||
|
||||
|
@ -203,6 +204,43 @@ TrackBuffersManager::ProcessTasks()
|
|||
GetTaskQueue()->Dispatch(NewRunnableMethod(this, &TrackBuffersManager::ProcessTasks));
|
||||
}
|
||||
|
||||
// A PromiseHolder will assert upon destruction if it has a pending promise
|
||||
// that hasn't been completed. It is possible that a task didn't get processed
|
||||
// due to the owning SourceBuffer having shutdown.
|
||||
// We resolve/reject all pending promises and remove all pending tasks from the
|
||||
// queue.
|
||||
void
|
||||
TrackBuffersManager::CancelAllTasks()
|
||||
{
|
||||
typedef SourceBufferTask::Type Type;
|
||||
|
||||
if (mCurrentTask) {
|
||||
mQueue.Push(mCurrentTask);
|
||||
mCurrentTask = nullptr;
|
||||
}
|
||||
|
||||
RefPtr<SourceBufferTask> task;
|
||||
while ((task = mQueue.Pop())) {
|
||||
switch (task->GetType()) {
|
||||
case Type::AppendBuffer:
|
||||
task->As<AppendBufferTask>()->mPromise.RejectIfExists(NS_ERROR_ABORT, __func__);
|
||||
break;
|
||||
case Type::RangeRemoval:
|
||||
task->As<RangeRemovalTask>()->mPromise.ResolveIfExists(false, __func__);
|
||||
break;
|
||||
case Type::EvictData:
|
||||
break;
|
||||
case Type::Abort:
|
||||
// not handled yet, and probably never.
|
||||
break;
|
||||
case Type::Reset:
|
||||
break;
|
||||
default:
|
||||
NS_WARNING("Invalid Task");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The MSE spec requires that we abort the current SegmentParserLoop
|
||||
// which is then followed by a call to ResetParserState.
|
||||
// However due to our asynchronous design this causes inherent difficulties.
|
||||
|
|
|
@ -35,10 +35,6 @@ public:
|
|||
SourceBufferTaskQueue()
|
||||
: mMonitor("SourceBufferTaskQueue")
|
||||
{}
|
||||
~SourceBufferTaskQueue()
|
||||
{
|
||||
MOZ_ASSERT(mQueue.IsEmpty(), "All tasks must have been processed");
|
||||
}
|
||||
|
||||
void Push(SourceBufferTask* aTask)
|
||||
{
|
||||
|
@ -383,6 +379,7 @@ private:
|
|||
// SourceBuffer Queues and running context.
|
||||
SourceBufferTaskQueue mQueue;
|
||||
void ProcessTasks();
|
||||
void CancelAllTasks();
|
||||
// Set if the TrackBuffersManager is currently processing a task.
|
||||
// At this stage, this task is always a AppendBufferTask.
|
||||
RefPtr<SourceBufferTask> mCurrentTask;
|
||||
|
|
Загрузка…
Ссылка в новой задаче