Bug 1124139 - Don't use mPlaybackStream for CameraPreview. r=jesup
From db346795ad1a0ae33e7496df893288eb1fbf7699 Mon Sep 17 00:00:00 2001 --- dom/camera/CameraPreviewMediaStream.h | 1 + dom/html/HTMLMediaElement.cpp | 29 +++++++++++++++++------------ dom/html/HTMLMediaElement.h | 6 +++++- dom/media/MediaStreamGraph.h | 2 ++ 4 files changed, 25 insertions(+), 13 deletions(-)
This commit is contained in:
@@ -2893,19 +2893,22 @@ void HTMLMediaElement::SetupSrcMediaStreamPlayback(DOMMediaStream* aStream)
|
||||
return;
|
||||
}
|
||||
|
||||
// Now that we have access to |mSrcStream| we can pipe it to our shadow
|
||||
// version |mPlaybackStream|. If two media elements are playing the
|
||||
// same realtime DOMMediaStream, this allows them to pause playback
|
||||
// independently of each other.
|
||||
mPlaybackStream = DOMMediaStream::CreateTrackUnionStream(window);
|
||||
mPlaybackStreamInputPort = mPlaybackStream->GetStream()->AsProcessedStream()->
|
||||
AllocateInputPort(mSrcStream->GetStream(), MediaInputPort::FLAG_BLOCK_OUTPUT);
|
||||
// XXX Remove this if with CameraPreviewMediaStream per bug 1124630.
|
||||
if (!mSrcStream->GetStream()->AsCameraPreviewStream()) {
|
||||
// Now that we have access to |mSrcStream| we can pipe it to our shadow
|
||||
// version |mPlaybackStream|. If two media elements are playing the
|
||||
// same realtime DOMMediaStream, this allows them to pause playback
|
||||
// independently of each other.
|
||||
mPlaybackStream = DOMMediaStream::CreateTrackUnionStream(window);
|
||||
mPlaybackStreamInputPort = mPlaybackStream->GetStream()->AsProcessedStream()->
|
||||
AllocateInputPort(mSrcStream->GetStream(), MediaInputPort::FLAG_BLOCK_OUTPUT);
|
||||
|
||||
nsRefPtr<nsIPrincipal> principal = GetCurrentPrincipal();
|
||||
mPlaybackStream->CombineWithPrincipal(principal);
|
||||
nsRefPtr<nsIPrincipal> principal = GetCurrentPrincipal();
|
||||
mPlaybackStream->CombineWithPrincipal(principal);
|
||||
|
||||
// Let |mSrcStream| decide when the stream has finished.
|
||||
GetSrcMediaStream()->AsProcessedStream()->SetAutofinish(true);
|
||||
// Let |mSrcStream| decide when the stream has finished.
|
||||
GetSrcMediaStream()->AsProcessedStream()->SetAutofinish(true);
|
||||
}
|
||||
|
||||
nsRefPtr<MediaStream> stream = mSrcStream->GetStream();
|
||||
if (stream) {
|
||||
@@ -2953,7 +2956,9 @@ void HTMLMediaElement::EndSrcMediaStreamPlayback()
|
||||
}
|
||||
mSrcStream->DisconnectTrackListListeners(AudioTracks(), VideoTracks());
|
||||
|
||||
mPlaybackStreamInputPort->Destroy();
|
||||
if (mPlaybackStreamInputPort) {
|
||||
mPlaybackStreamInputPort->Destroy();
|
||||
}
|
||||
|
||||
// Kill its reference to this element
|
||||
mSrcStreamListener->Forget();
|
||||
|
||||
Reference in New Issue
Block a user