Bug 1402681 - part1 : do not queue the task without task queue. r=jya

Since the source buffer is a wrapped native, it would be unlinked twice and then the
TrackBuffersManager::Detach() would also be called twice.

The first detach task would clear the task queue of TrackBuffersManager, and then we
won't accept any new task without task queue. The second detach task should not be
executed.

MozReview-Commit-ID: AWTzVbRH5B1

--HG--
extra : rebase_source : 557e22f56f8541b06174e41604ca57cb01325d61
This commit is contained in:
Alastor Wu 2017-09-26 17:48:19 +08:00
Родитель a1a7652547
Коммит eaf6e2d76e
1 изменённых файлов: 9 добавлений и 0 удалений

Просмотреть файл

@ -145,6 +145,15 @@ TrackBuffersManager::DoAppendData(already_AddRefed<MediaByteBuffer> aData,
void
TrackBuffersManager::QueueTask(SourceBufferTask* aTask)
{
// The source buffer is a wrapped native, it would be unlinked twice and so
// the TrackBuffersManager::Detach() would also be called twice. Since the
// detach task has been done before, we could ignore this task.
if (!GetTaskQueue()) {
MOZ_ASSERT(aTask->GetType() == SourceBufferTask::Type::Detach,
"only detach task could happen here!");
return;
}
if (!OnTaskQueue()) {
GetTaskQueue()->Dispatch(NewRunnableMethod<RefPtr<SourceBufferTask>>(
"TrackBuffersManager::QueueTask",