mux.js icon indicating copy to clipboard operation
mux.js copied to clipboard

CaptionStream fails if parseSei returns undefined payload

Open bradoutlaw opened this issue 5 years ago • 5 comments

In CaptionStream, if the escapedRBSP payload passed into parseSei returns an undefined payload (as it would if it had DTG1 data only), then it will fail when parseUserData is called. The following function tries to access the payload by index.

Adding a simple check before parseUserData is called should remedy the issue. e.g. at line 64 in caption-stream.js

  // the sei should have a payload
  if (!sei.payload) {
    return;
  }

This use case should be covered by the "does not throw error if only invalid payloads" QUnit test in caption-stream.test.js since it doesn't return any GA94 captions data.

I can spin up a PR if you need. It should be a simple fix though.

bradoutlaw avatar May 18 '20 23:05 bradoutlaw

We believe this is fixed as part of https://github.com/videojs/mux.js/pull/336 and is available in the latest mux.js release.

gkatsev avatar May 27 '20 18:05 gkatsev

If there's only DTG1 data (and no GA94), it will meet the payload type "4" to enter the check for GA94, but result in an undefined payload per the code at line 77 and eventually exit out. The check for the country code in parseUserData is hitting a reference error due to the payload being undefined.

I have a customer who's hitting this in the wild. I made the patch in a local build and had them confirm, but it would be great if we could get this fixed in mainline. Thanks.

bradoutlaw avatar May 27 '20 21:05 bradoutlaw

So, this is a different issue than #336? If so, could you provide a PR? That would be helpful, thanks.

gkatsev avatar Jul 29 '20 18:07 gkatsev

Does #348 fix this issue for you?

brandonocasey avatar Jul 29 '20 18:07 brandonocasey

Yes, #348 is the fix I was recommending.

bradoutlaw avatar Jul 31 '20 18:07 bradoutlaw