shaka-project / shaka-player

JavaScript player library / DASH & HLS client / MSE-EME player
Apache License 2.0
6.97k stars 1.32k forks source link

HLS failure with PRELOAD-HINT and low-latency mode disabled #4185

Closed avelad closed 2 years ago

avelad commented 2 years ago

Have you read the FAQ and checked for duplicate open issues? YEs

What version of Shaka Player are you using? 4.0.0

Can you reproduce the issue with our latest release version? Yes

Can you reproduce the issue with the latest code from main? Yes

Are you using the demo app or your own custom app? Demo

If custom app, can you reproduce the issue using our demo app? Yes

What browser and OS are you using? 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.41 Safari/537.36'

For embedded devices (smart TVs, etc.), what model and firmware version are you using?

What are the manifest and license server URIs?

https://pf5.broadpeak-vcdn.com/bpk-tv/tvrll/llcmaf/index.m3u8

What configuration are you using? What is the output of player.getConfiguration()?

Default

What did you do?

Load https://shaka-player-demo.appspot.com/demo/#audiolang=es-ES;textlang=es-ES;uilang=es-ES;asset=https://pf5.broadpeak-vcdn.com/bpk-tv/tvrll/llcmaf/index.m3u8;panel=CUSTOM%20CONTENT;build=uncompiled

What did you expect to happen? The stream works

What actually happened?

image

avelad commented 2 years ago

@theodab you are the HLS expert, can you take a look at it?

avelad commented 2 years ago

More examples: https://pf5.broadpeak-vcdn.com/bpk-tv/tvrll/llcmaf/index.m3u8 https://5d6e17f1ca731.streamlock.net/LowLatencyBBB/myStream/playlist.m3u8 https://d18lkalz24uryj.cloudfront.net/LLHLS.m3u8 https://ll-hls.softvelum.com/sldp/bbloop/playlist.m3u8 https://stream.mux.com/v69RSHhFelSm4701snP22dYz2jICy4E4FUyk02rW4gxRM.m3u8 https://llhls-demo.flussonic.com/flussonic/index.ll.m3u8

joeyparrish commented 2 years ago

From what I can tell in the debugger, it's not RENDITION-REPORT that triggers the issue, but PRELOAD-HINT.

The RENDITION-REPORT is attached to the last segment, which is generated from PRELOAD-HINT. I think without RENDITION-REPORT, the results would be the same.

This is what the HLS parser is doing when it throws that error:

    if (this.lowLatencyMode_ && hlsSegment.partialSegments.length) {
      // ...
    } else {
      // EXTINF tag must be available if the segment has no partial segments.
      if (!extinfTag) {
        throw new shaka.util.Error(
            shaka.util.Error.Severity.CRITICAL,
            shaka.util.Error.Category.MANIFEST,
            shaka.util.Error.Code.HLS_REQUIRED_TAG_MISSING, 'EXTINF');
      }
    }

Here hlsSegment.partialSegments.length is 1, but lowLatencyMode_ is false. I think the else should really be else if (hlsSegment.partialSegments.length == 0). The check for EXTINF should only occur if there are no partial segments, regardless of low-latency mode.

joeyparrish commented 2 years ago

Confirmed. Enabling low-latency mode makes the content play without modifying the source:

https://v4-0-0-dot-shaka-player-demo.appspot.com/demo/#audiolang=es-ES;textlang=es-ES;lowLatencyMode=true;uilang=es-ES;asset=https://pf5.broadpeak-vcdn.com/bpk-tv/tvrll/llcmaf/index.m3u8;panel=CUSTOM%20CONTENT;build=uncompiled

joeyparrish commented 2 years ago

I have what I think is a good fix (somewhat more detailed than my comments above), but I got distracted by other duties and haven't quite finished the PR. I still need to write a regression test, verify that it fails, then verify that the fix fixes it. Hopefully I'll finish that later tonight or more likely tomorrow (Wednesday America/Pacific time).