Closed Bug 1616175 Opened 4 years ago Closed 4 years ago

Allow MediaRecorder "stop" event dispatch when tracks end, even if still in MediaTrackGraph

Categories

(Core :: Audio/Video: Recording, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla75
Tracking Status
firefox-esr68 --- unaffected
firefox73 --- wontfix
firefox74 --- wontfix
firefox75 --- fixed

People

(Reporter: karlt, Assigned: karlt)

References

(Regression)

Details

(Keywords: regression)

Attachments

(2 files)

https://searchfox.org/mozilla-central/rev/0439db3a39faddb90197a87cc184c57dcbf0a770/dom/media/encoder/MediaEncoder.h#102
says "When all input tracks end, the MediaEncoder will automatically stop and shut down."

That's true as far as the fact that MediaEncoder::Shutdown() gets called, but resolution of the promise it returns and EncoderListener::Shutdown() are blocked on MediaEncoder::AudioTrackListener::mShutdownPromise, which waits for removal of its MediaTrack from the graph.

For bug 1596655, I would like the MediaTrack for AudioDestinationNode to remain in the graph well after the track ends. The blocked EncoderListener shutdown means that the "stop" event is not dispatched to the MediaRecorder until the AudioDestinationNode is destroyed.

This appears to be a consequence of a change in behavior introduced in https://hg.mozilla.org/mozilla-central/rev/509719f98963a8f1c2663dac01279a734d30e71a

(In reply to Karl Tomlinson (:karlt) from comment #0)

That's true as far as the fact that MediaEncoder::Shutdown() gets called, but resolution of the promise it returns and EncoderListener::Shutdown() are blocked on MediaEncoder::AudioTrackListener::mShutdownPromise,

The first promise in the chain returned from MediaEncoder::Shutdown() is waiting for the listeners to be removed from their tracks.
Removal of listeners from tracks would be triggered from MediaEncoder::Stop() from MediaEncoder::Cancel() after Session::Shutdown() after Session::DoSessionEndTask() after Session::MediaEncoderShutdown() from Session::EncoderListener::Shutdown(), which is not called until the promise resolves.

IsShutdown() is replaced with a AssertShutdownCalled() because testing
mShutdownPromise would race if the timing of Shutdown() is not known.

Depends on D65066

Pushed by ktomlinson@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/3a0f667c0908
update function name in NotifyRemoved() doc r=padenot
https://hg.mozilla.org/integration/autoland/rev/9f768142ce40
trigger track listener removal before waiting for removal r=bryce
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla75
Has Regression Range: --- → yes
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: