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

Bugfix: TypeError: Cannot read properties of null… payload.byteLength (timeline-controller)

Open mtoczko opened this issue 3 years ago • 8 comments

This PR will...

Adds check that payload is not null

Why is this Pull Request needed?

Prevents errors: Uncaught (in promise) TypeError: Cannot read properties of null (reading 'byteLength') Uncaught (in promise) TypeError: payload is null

Are there any points in the code the reviewer needs to double check?

    this.logEnabled = true;
    const result = this.softwareDecrypt(data, key, iv);
    if (result === null) {
+      this.reset();

Resolves issues:

#4898

Checklist

  • [x] changes have been done against master branch, and PR does not conflict
  • [ ] new unit / functional tests have been added (whenever applicable)
  • [ ] API or design changes are documented in API.md

mtoczko avatar Sep 13 '22 00:09 mtoczko

Hi @mtoczko,

Thanks for the fixes. I missed this one before cutting v1.2.3. However, I closed #4898 as I was not able to reproduce the payload exceptions using the stream or steps in the AES-128 VTT loop loading issue. Is this intermittent or are there additional steps needed to repro?

robwalch avatar Sep 13 '22 01:09 robwalch

Thanks for the fixes. I missed this one before cutting v1.2.3. However, I closed #4898 as I was not able to reproduce the payload exceptions using the stream or steps in the AES-128 VTT loop loading issue. Is this intermittent or are there additional steps needed to repro?

@robwalch - I can still repro the payload exceptions. But by now I believe they were/are caused by hard reloads of the demo page. In 'normal' use I cannot repro (famous last words).

phloxic avatar Sep 13 '22 10:09 phloxic

Hi @phloxic Do you have a longer test stream? (I mean more vtt segemnts)

mtoczko avatar Sep 14 '22 14:09 mtoczko

@robwalch There may also be some error with the key, because now it tries to download the fragment again if the payload was 'null'. And the error goes away after reloading the key. Zrzut ekranu 2022-09-14 o 17 54 27 Zrzut ekranu 2022-09-14 o 18 03 21

mtoczko avatar Sep 14 '22 16:09 mtoczko

Hi @phloxic Do you have a longer test stream? (I mean more vtt segemnts)

@mtoczko here you go: https://d12zt1n3pd4xhr.cloudfront.net/dev/aesx-s-cc-en.m3u8

phloxic avatar Sep 14 '22 21:09 phloxic

@phloxic What AES mode are you using?

mtoczko avatar Sep 17 '22 15:09 mtoczko

@phloxic What AES mode are you using?

Oh, in that version AES-128 for audio and subtitles, and Sample AES for the video. The original symptoms were the same when using AES-128 for everything. Do you need another one like that?

phloxic avatar Sep 17 '22 22:09 phloxic

@phloxic What AES mode are you using?

@mtoczko - here's a pure AES-128 version. HTH.

phloxic avatar Sep 17 '22 23:09 phloxic

Hi @robwalch Your PR #4861 solves the problem with webCryptoDecrypt, there must have been some conflict/race. I removed the attempt to reload the fragment, only a warning will be returned.

mtoczko avatar Oct 04 '22 15:10 mtoczko

@robwalch If you could resolve this conflict, that would be great.

mtoczko avatar Oct 05 '22 17:10 mtoczko