web-platform-tests / wpt

Test suites for Web platform specs — including WHATWG, W3C, and others
https://web-platform-tests.org/
Other
5k stars 3.1k forks source link

[eme] drm-mp4-playback-temporary-multikey-sequential.https.html failed due to event order #28985

Open junhoseo opened 3 years ago

junhoseo commented 3 years ago

Hi,

On my testing user agent, 'waitingforkey' event was dispatched earlier than 'canplay' event. This hits assertion failure in OnCanPlay() function.

function onCanPlay(event) { _canplayCount++; assert_equals(_mediaKeySessions.length, _canplayCount, "Should get one 'canplay' event per key / session added"); // --> assert_equals(2, 1) .... }

I have a question: In the test case, 'canplay' event must be dispatched earlier than 'waitingforkey' event? I think 'canplay' event can be delayed if changing ready state is delayed for some reason. So I wonder my user agent did incorrect behavior or not.

anawhj commented 3 years ago

@foolip, @zcorpan Hello! How could we get some opinion or answer on Junho's question above? Thanks. :)

foolip commented 3 years ago

@junhoseo can you say which browser and version you tested this on? It's possible the test assumes too much and the event order actually isn't guaranteed, but it's hard to say without knowing more.

junhoseo commented 3 years ago

Hi @foolip , Thanks for your comment. I tested with chromium based custom browser, running on embedded device, the version was 8X. We used different video decoder, instead of internal video decoder in chromium(ffmpeg or something like that). Our decoder changed its ready state little bit lately in the test, then we caught by the assertion.

foolip commented 3 years ago

I see, Chromium-based with a different media backend. In Chromium's WebMediaPlayer abstraction the readyState is decided by the backend, so it does seem possible this is actually an issue there. Getting media element ready states right is hard, and requires a certain amount of "pretending" in my experience.

Anyway, the assert you're hitting is this one then: https://github.com/web-platform-tests/wpt/blob/b7ea86c5012703a698f90311bc630b4798c46ac9/encrypted-media/scripts/playback-temporary-multikey-sequential.js#L77-L81

And here are the test results from other browsers: https://wpt.fyi/results/encrypted-media/drm-mp4-playback-temporary-multikey-sequential.https.html?run_id=5656817369612288&run_id=5692782217789440&run_id=5675845416910848&run_id=5694527182471168

The fact that this test doesn't pass anywhere makes we not trust it very much. Maybe a good first step would be to see if you can tweak the test to get it passing in some browser. If that still doesn't pass with your implementation that would be cause for concern and worth digging deeper in.

foolip commented 3 years ago

cc @mwatson2 who wrote this test back in https://github.com/web-platform-tests/wpt/pull/3752, and the reviewers @jdsmith3000 and @AlexeyKor.