Closed Bug 882537 Opened 7 years ago Closed 5 years ago

MFCreateSourceReaderFromByteStream() sometimes fails on Windows 7


(Core :: Audio/Video, defect)

Windows 7
Not set





(Reporter: cpearce, Assigned: cpearce)




(1 file)

MFCreateSourceReaderFromByteStream() sometimes fails. This causes the media load to abort and thrown an error event.

I can reproduce this on Windows 7 when I run test_too_many_elements on an MP3/M4A file, after about 60 decoders have reached loadeddata.

MFCreateSourceReaderFromByteStream() failing is also the reason for the random failure in the WMF backend in bug 707777 and bug 857424. I'm not sure if that's caused by hitting this 60-decoder limit, or for some other reason.
Blocks: 864682
I've given up trying to do a clever solution, it's taking too much time to stabilize. So instead of trying to make the WMF backend release its resource when its document becomes inactive, this patch just changes the tests to force the decoders to be released. This fixes the failure that becomes almost perma-orange when I land the patch from bug 875644 (test_bug493187 timing out due to the decoder not being able to start up).

I get a pretty frequent failure with this patch:

149269 ERROR TEST-UNEXPECTED-FAIL | /tests/content/media/test/test_play_events.html | Last event should be canplaythrough for http://mochi.test:8888/tests/content/media/test/gizmo.mp4 - got playing, expected canplaythrough 

But that's fixed by Roc's patches in bug 879717 and bug 833731, but those have other oranges that need to be fixed too?
Attachment #767475 - Flags: review?(roc)
Blocks: 875644
Depends on: 879717, 833731
I sympathise with your frustration here but patching all these tests worries me a lot. We might miss bugs related to video elements lingering in the bfcache (of which we've had a few!). I suggest a couple of things:

1) Always-on instrumentation to track the number of native decoders we currently are keeping alive --- dumping those stats when we fail to create a native object. Then, when we hit failures, we'll be able to tell whether efforts to reduce those numbers worked or not. (We might even decide to add those to about:memory at some point.)

2) When we fail to create a native object, dispatch a runnable to the main thread that does
(see nsJSEnvironmentObserver::Observe), and when that has completed, retry creating the native decoder. It won't really have completed synchronously, since MediaDecoder shutdown is asynchronous, so I suggest keeping a count of the number of MediaDecoders that have entered MediaDecoder::Shutdown but not been destroyed yet, and delay retrying creation of the native decoder until that count is zero.
It seems that there's still a bug somewhere in my IMFByteStream implementation. I took Chris Double's patches from bug 860599 to create a network proxy, and used that to feed data into WMF, and the orange that happens when I include the patches for bug 875644 go away:

Presumably the bug in WMFByteStream is causing connections/resources not to close properly, and that's causing resource contention issues, which causes this failure.
Attachment #767475 - Flags: review?(roc)
Depends on: 908503
I can reliably reproduce this on Windows 7 by constantly creating autoplaying short audio elements:

1. Set pref media.directshow.enabled to false.
2. Load
3. Lots of short sounds will play, eventually they will fail to be created and error will be reported at the top of the page.
No longer blocks: 857424
Depends on: 1057879
In theory this is fixed by bug 1057879...
Closed: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.