Dash-Industry-Forum / dash.js

A reference client implementation for the playback of MPEG DASH via Javascript and compliant browsers.
http://reference.dashif.org/dash.js/nightly/samples/dash-if-reference-player/index.html
Other
5.13k stars 1.68k forks source link

CBCS + InbandEventStream crash, CENC + InbandEventStream is ok, NoDrm + InbandEventStream is ok. #4139

Closed Murmur closed 1 year ago

Murmur commented 1 year ago

( Nightly Dashjs, Win10 Edge Playready )

CBCS drm and InbandEventStream xml field combination crash, using the same segments but no event xml field in a manifest works fine. Same happens with Widevine(Chrome, Firefox, Edge) drm as well.

CBCS + InbandEventStream crash, see error message below. https://refapp.hbbtv.org/videos/dashtest/test4/cbcs/manifest_evtib.mpd https://test.playready.microsoft.com/service/rightsmanager.asmx?cfg=(kid:header,sl:2000,persist:false,contentkey:EjQSNBI0EjQSNBI0EjQSNw==,ckt:aescbc)

CBCS without InbandEventStream xml element is ok https://refapp.hbbtv.org/videos/dashtest/test4/cbcs/manifest.mpd https://test.playready.microsoft.com/service/rightsmanager.asmx?cfg=(kid:header,sl:2000,persist:false,contentkey:EjQSNBI0EjQSNBI0EjQSNw==,ckt:aescbc)

CENC + InbandEventStream is ok https://refapp.hbbtv.org/videos/dashtest/test4/cenc/manifest_evtib.mpd https://test.playready.microsoft.com/service/rightsmanager.asmx?cfg=(kid:header,sl:2000,persist:false,contentkey:EjQSNBI0EjQSNBI0EjQSNw==)

NoDrm + InbandEventStream is ok https://refapp.hbbtv.org/videos/dashtest/test4/manifest_evtib.mpd

Error from CBCS+InbandEventStream playback.
[678613327][FragmentController] RangeError: Offset is outside the bounds of the DataView 
Uncaught (in promise) RangeError: Offset is outside the bounds of the DataView
  at DataView.getUint16 (<anonymous>)
  at ISOBox._readUint (iso_boxer.js:408:1)
  at ISOBox._readField (iso_boxer.js:358:1)
  at ISOBox._procEntryField (iso_boxer.js:326:1)
  at ISOBox.<anonymous> (MssFragmentProcessor.js:77:18)
  at ISOBox._procEntries (iso_boxer.js:298:1)
  at ISOBox.sencProcessor (MssFragmentProcessor.js:74:10)
  at ISOBox._parseBox (iso_boxer.js:520:1)
  at ISOBox.parse (iso_boxer.js:244:1)
  at ISOBox._parseContainerBox (iso_boxer.js:539:1)

Segments cbcs/v1/1.m4s, cbcs/v1/5.m4s | cenc/v1/1.m4s, cenc/v1/5.m4s has EMSG message box.

Murmur commented 1 year ago

ClearKeyDRM CBCS + InbandEventStream crash as well https://refapp.hbbtv.org/videos/dashtest/test4/cbcs/manifest_clearkey_evtib.mpd

ClearKeyDRM CBCS without InbandEventStream xml field is ok https://refapp.hbbtv.org/videos/dashtest/test4/cbcs/manifest_clearkey.mpd

ClearKeyDRM CENC + InbandEventStream is ok https://refapp.hbbtv.org/videos/dashtest/test4/cenc/manifest_clearkey_evtib.mpd

Kid: QyFWeBI0EjQSNBI0EjQSNw Key: EjQSNBI0EjQSNBI0EjQSNw

davemevans commented 1 year ago

The inclusion of an InbandEventStream in the manifest causes the whole segment to be parsed in order to extract the emsg.

The problem is that the existing senc parser in dashjs assumes that there is always a per-sample IV, and that the length of that is 8 bytes. In the CBCS example there are no per-sample IVs in use, so the senc parser over-reads for each entry, causing it to overrun its buffer.

Since the senc parser is (currently) useful only when playing MSS streams, an easy fix might be to make a quick change to only add the MSS-specific parsers when MSS is actively in use. In that case, the senc box won't be parsed - it just gets read opaquely.

(Note: fixing the senc parser is non-trivial because it requires additional context from other boxes)

Murmur commented 1 year ago

CENC: SampleIV 8 bytes, CBCS: ConstantIV 16 bytes

I made a simple standalone player and both CENC+CBCS works with EMSG inband events. It's something DashjsDemoUI do in a default player settings? https://refapp.hbbtv.org/dash/dashjs/index.html?video=cbcsevtib https://refapp.hbbtv.org/dash/dashjs/index.html?video=cencevtib

Event message is printed at 0s,15s timestamps. Test player use a playready drm.

dsilhavy commented 1 year ago

As @davemevans the demo UI includes the Smooth Streaming files: <script src="../../dist/dash.mss.debug.js"></script>

So your example page is probably missing: ISOBoxer.addBoxProcessor('senc', sencProcessor);

dsilhavy commented 1 year ago

@Murmur Can you please do a quick check if #4147 solves this issue

Murmur commented 1 year ago

@Murmur Can you please do a quick check if #4147 solves this issue

@dsilhavy All good. Win10Edge Playready CBCS+EMSG ok, ClearKey CBCS+EMSG ok. CENC+EMSG still ok, Nodrm+EMSG still ok.

dsilhavy commented 1 year ago

Thanks @Murmur