Bug 1453127 - Clear output streams on shutdown. r=jya

This commit is contained in:
Andreas Pehrson 2018-05-30 10:44:56 +02:00
Родитель 6c6e70fcbc
Коммит 9d5b27393d
3 изменённых файлов: 13 добавлений и 0 удалений

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

@ -3448,6 +3448,10 @@ MediaDecoderStateMachine::FinishDecodeFirstFrame()
RefPtr<ShutdownPromise> RefPtr<ShutdownPromise>
MediaDecoderStateMachine::BeginShutdown() MediaDecoderStateMachine::BeginShutdown()
{ {
MOZ_ASSERT(NS_IsMainThread());
if (mOutputStreamManager) {
mOutputStreamManager->Clear();
}
return InvokeAsync(OwnerThread(), this, __func__, return InvokeAsync(OwnerThread(), this, __func__,
&MediaDecoderStateMachine::Shutdown); &MediaDecoderStateMachine::Shutdown);
} }

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

@ -125,6 +125,13 @@ OutputStreamManager::Remove(MediaStream* aStream)
} }
} }
void
OutputStreamManager::Clear()
{
MOZ_ASSERT(NS_IsMainThread());
mStreams.Clear();
}
TrackID TrackID
OutputStreamManager::NextAvailableTrackIDFor(MediaStream* aOutputStream) const OutputStreamManager::NextAvailableTrackIDFor(MediaStream* aOutputStream) const
{ {

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

@ -59,6 +59,8 @@ public:
bool aFinishWhenEnded); bool aFinishWhenEnded);
// Remove the output stream from the collection. // Remove the output stream from the collection.
void Remove(MediaStream* aStream); void Remove(MediaStream* aStream);
// Clear all output streams from the collection.
void Clear();
// The next TrackID that will not cause a collision in aOutputStream. // The next TrackID that will not cause a collision in aOutputStream.
TrackID NextAvailableTrackIDFor(MediaStream* aOutputStream) const; TrackID NextAvailableTrackIDFor(MediaStream* aOutputStream) const;
// Return true if the collection empty. // Return true if the collection empty.