Bug 1411152 Comment 64 Edit History

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

This is an occurrence of a "dataavailable" event after the "stop" event (illegal by spec). The trigger of this seems to be the really short timeslice this test is using (1ms).

[With bug 1514158 the rate of this went up significantly](https://treeherder.mozilla.org/#/jobs?repo=try&revision=bd35c402387b24707d617151349c926f5aa936ca), so I'd like to fix it at the root source to allow bug 1514158 to land.

I have a run there with some logging enabled, and it appears we hit a race like so:

Contestant 1 | Contestant 2
---------------|---------------
Stop() (main) | _
Listeners removed (graph) | _
Listener removal processed (encoder) | _
NotifyEndOfStream (encoder) (causing the DataAvailable event synchronously) | _
_ | MediaEncoderDataAvailable (encoder)
_ | Extract(false) (encoder)
_ | GetEncodedData() (encoder) (causing the Shutdown event synchronously)
MediaEncoderShutdown() (encoder) | _
Dispatch(DoSessionEndTask(NS_OK)) (encoder) | _
_ | (still in Extract) Dispatch(StoreEncodedBufferRunnable()) (encoder)
_ | (still in Extract) InvokeAsync(GatherBlob) (encoder)
DoSessionEndTask(NS_OK) (main) | _
GatherBlob() (main) | _
Dispatch("dataavailable") (main) | _
Dispatch("stop") (main) | _
_ | GatherBlob() (main)
_ | Dispatch("dataavailable") (main) **unexpected!**
This is an occurrence of a "dataavailable" event after the "stop" event (illegal by spec). The trigger of this seems to be the really short timeslice this test is using (1ms).

[With bug 1514158 the rate of this went up significantly](https://treeherder.mozilla.org/#/jobs?repo=try&revision=bd35c402387b24707d617151349c926f5aa936ca), so I'd like to fix it at the root source to allow bug 1514158 to land.

I have a run there with some logging enabled, and it appears we hit a race like so (not entirely sure about the GatherBlob order):

Contestant 1 | Contestant 2
---------------|---------------
Stop() (main) | _
Listeners removed (graph) | _
Listener removal processed (encoder) | _
NotifyEndOfStream (encoder) (causing the DataAvailable event synchronously) | _
_ | MediaEncoderDataAvailable (encoder)
_ | Extract(false) (encoder)
_ | GetEncodedData() (encoder) (causing the Shutdown event asynchronously)
_ | (still in Extract) Dispatch(StoreEncodedBufferRunnable()) (encoder)
_ | (still in Extract) InvokeAsync(GatherBlob) (encoder)
MediaEncoderShutdown() (encoder) | _
Dispatch(DoSessionEndTask(NS_OK)) (encoder) | _
_ | GatherBlob() (main)
DoSessionEndTask(NS_OK) (main) | _
GatherBlob() (main) | _
GatherBlob()->Then Dispatch (main) | _
_ | GatherBlob->Then Dispatch (main)
Dispatch("dataavailable") (main) | _
Dispatch("stop") (main) | _
_ | Dispatch("dataavailable") (main) **unexpected!**

Back to Bug 1411152 Comment 64