videojs / mux.js

Lightweight utilities for inspecting and manipulating video container formats.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CaptionStream fails if parseSei returns undefined payload

bradoutlaw opened this issue · 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.

We believe this is fixed as part of #336 and is available in the latest mux.js release.

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.

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

Does #348 fix this issue for you?

Yes, #348 is the fix I was recommending.