summaryrefslogtreecommitdiffstats
path: root/dom/media/MediaDecoderStateMachine.cpp
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-06-07 16:04:56 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-06-07 16:04:56 +0200
commitd7beb75aa889967780067ade8219b4a662f22e38 (patch)
tree05714e8825122be0cd5a7d5e185b40bd967ae2a2 /dom/media/MediaDecoderStateMachine.cpp
parent271f1ef600c06a74471665a040c9473d9f7a9a36 (diff)
downloadUXP-d7beb75aa889967780067ade8219b4a662f22e38.tar
UXP-d7beb75aa889967780067ade8219b4a662f22e38.tar.gz
UXP-d7beb75aa889967780067ade8219b4a662f22e38.tar.lz
UXP-d7beb75aa889967780067ade8219b4a662f22e38.tar.xz
UXP-d7beb75aa889967780067ade8219b4a662f22e38.zip
Media: harden TrackID handling.
Diffstat (limited to 'dom/media/MediaDecoderStateMachine.cpp')
-rw-r--r--dom/media/MediaDecoderStateMachine.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/dom/media/MediaDecoderStateMachine.cpp b/dom/media/MediaDecoderStateMachine.cpp
index f13e59b6c..c586139ad 100644
--- a/dom/media/MediaDecoderStateMachine.cpp
+++ b/dom/media/MediaDecoderStateMachine.cpp
@@ -2835,6 +2835,10 @@ MediaDecoderStateMachine::FinishDecodeFirstFrame()
RefPtr<ShutdownPromise>
MediaDecoderStateMachine::BeginShutdown()
{
+ MOZ_ASSERT(NS_IsMainThread());
+ if (mOutputStreamManager) {
+ mOutputStreamManager->Clear();
+ }
return InvokeAsync(OwnerThread(), this, __func__,
&MediaDecoderStateMachine::Shutdown);
}
@@ -3250,11 +3254,12 @@ MediaDecoderStateMachine::DumpDebugInfo()
}
void MediaDecoderStateMachine::AddOutputStream(ProcessedMediaStream* aStream,
+ TrackID aNextAvailableTrackID,
bool aFinishWhenEnded)
{
MOZ_ASSERT(NS_IsMainThread());
DECODER_LOG("AddOutputStream aStream=%p!", aStream);
- mOutputStreamManager->Add(aStream, aFinishWhenEnded);
+ mOutputStreamManager->Add(aStream, aNextAvailableTrackID, aFinishWhenEnded);
nsCOMPtr<nsIRunnable> r = NewRunnableMethod<bool>(
this, &MediaDecoderStateMachine::SetAudioCaptured, true);
OwnerThread()->Dispatch(r.forget());
@@ -3269,9 +3274,17 @@ void MediaDecoderStateMachine::RemoveOutputStream(MediaStream* aStream)
nsCOMPtr<nsIRunnable> r = NewRunnableMethod<bool>(
this, &MediaDecoderStateMachine::SetAudioCaptured, false);
OwnerThread()->Dispatch(r.forget());
+
}
}
+TrackID
+MediaDecoderStateMachine::NextAvailableTrackIDFor(MediaStream* aOutputStream) const
+{
+ MOZ_ASSERT(NS_IsMainThread());
+ return mOutputStreamManager->NextAvailableTrackIDFor(aOutputStream);
+}
+
size_t
MediaDecoderStateMachine::SizeOfVideoQueue() const
{