Bug 1521964 Comment 10 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

(In reply to Mike Conley (:mconley) (:⚙️) from comment #7)
> 
>   If I understand correctly, once a <video> loads a new resource, in the worst case, we end up spawning a brand new MediaDecoder. I suspect that means a brand new MediaDecoderStateMachine and a new VideoSink. If we've got a clone sitting around, we'll need to detect this case, and hook up the secondary VideoFrameContainer on the new VideoSink. I'm not sure what the best hooks are for doing something like that.

HTMLMediaElement might be a good place to control it. HTMLMediaElement creates MediaDecoder and holds at most one MediaDecoder. It is set by HTMLMediaElement::SetDecoder().

https://searchfox.org/mozilla-central/rev/fcd461352655be83000062a2166722abc8f16768/dom/html/HTMLMediaElement.cpp#7157

Though it is a bit tricky to set secondary VideoFrameContainer to VideoSink, since when MediaDecoderStateMachine is created, VideoSink does not exist yet. VideoSink is created asynchronously via MediaDecoder::SetSink().

https://searchfox.org/mozilla-central/rev/6e1c6f8946af98a631219ee8125dd4bef834effb/dom/media/MediaDecoder.cpp#173
(In reply to Mike Conley (:mconley) (:⚙️) from comment #7)
> 
>   If I understand correctly, once a <video> loads a new resource, in the worst case, we end up spawning a brand new MediaDecoder. I suspect that means a brand new MediaDecoderStateMachine and a new VideoSink. If we've got a clone sitting around, we'll need to detect this case, and hook up the secondary VideoFrameContainer on the new VideoSink. I'm not sure what the best hooks are for doing something like that.

HTMLMediaElement might be a good place to control it. HTMLMediaElement creates MediaDecoder, holds at most one MediaDecoder and control the playback. It is set by HTMLMediaElement::SetDecoder().

https://searchfox.org/mozilla-central/rev/fcd461352655be83000062a2166722abc8f16768/dom/html/HTMLMediaElement.cpp#7157

Though it is a bit tricky to set secondary VideoFrameContainer to VideoSink, since when MediaDecoderStateMachine is created, VideoSink does not exist yet. VideoSink is created asynchronously via MediaDecoder::SetSink().

https://searchfox.org/mozilla-central/rev/6e1c6f8946af98a631219ee8125dd4bef834effb/dom/media/MediaDecoder.cpp#173

Back to Bug 1521964 Comment 10