http-streaming icon indicating copy to clipboard operation
http-streaming copied to clipboard

Playback stalls/fails when an audio segment resets its PTS

Open amtins opened this issue 2 years ago • 3 comments

Description

The table below shows 5 segments to demonstrate the problem. These segments were extracted from an AOD that was generated from live audio with a 6-hour DVR window.

X represents an indeterminate number of segments before X+1.

segment x+1 segment x+2 segment x+3 segment x+4 segment x+5
pts 8587610092 8588520172 8589430252 405740 1315820
cueTime 10.112 20.224 30.336 4.508222222222222 14.620222222222223
privateData [0,0,0,1,255,220,135,236] [0,0,0,1,255,234,106,236] [0,0,0,1,255,248,77,236] [0,0,0,0,0,6,48,236] [0,0,0,0,0,20,19,236]

In an HLS audio only, when the PTS of a segment is reset, the seek does not work properly in two cases:

  1. In an AOD, seeking from segment 1 to 4, the player displays the spinning wheel and after a few seconds falls in error
    • However, if no seek is made the player is able to play the media until the end
  2. In a live with DVR, where the live edge is represented by segment 5, seeking from segment 5 to 3 displays the spinning wheel
    • However, the problem tend to disappear over time as new segments are added/removed from the playlist

Sources

Unfortunately, I can't share the test URL publicly for copyright reasons. However, I can share the link privately via Slack.

Steps to reproduce

  1. Open the videojs-http-streaming
  2. Paste the test url
  3. Start the playback
  4. Seek to player.currentTime(6250);
  5. Try to seek after the position 6250

Results

Expected

Seeking on a media where the PTS of a segment is reset should work.

Error output

When seeking to 6250 will show the following warning message in the console, eventhough the EXT-X-TARGETDURATION is correct in the m3u8.

VIDEOJS: DEBUG: VHS: SegmentLoader[main] > READY -> WAITING
VIDEOJS: DEBUG: VHS: SourceUpdater > Removing 0 to 6220.480395 from audioBuffer
VIDEOJS: DEBUG: VHS: SegmentLoader[main] > Requesting segment [7858280/7859787] segment start/end [undefined => undefined] startOfSegment [6309.887999999992] duration [10.112] timeline [0] selected by [mediaIndex/partIndex increment] playlist [0-url/issue.m3u8]
VIDEOJS: DEBUG: VHS: SegmentLoader[main] > timinginfo: audio - start - 4.508222222222222
VIDEOJS: DEBUG: VHS: SegmentLoader[main] > timinginfo: audio - end - 95458.33791111111
VIDEOJS: DEBUG: VHS: SourceUpdater > Appending segment 624's 121882 bytes to audioBuffer
VIDEOJS: DEBUG: VHS: SegmentLoader[main] > WAITING -> APPENDING

VIDEOJS: WARN: Segment with index 624 from playlist 0-url/issue.m3u8 has a duration of 95453.82968888889 when the reported duration is 10.112 and the target duration is 11. For HLS content, a duration in excess of the target duration may result in playback issues. See the HLS specification section on EXT-X-TARGETDURATION for more details: https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1

VIDEOJS: DEBUG: VHS: SegmentLoader[main] > APPENDING -> READY
VIDEOJS: DEBUG: VHS: SegmentLoader[main] > Appended segment [7858280/7859787] segment start/end [-89133.82968888889 => 6320] startOfSegment [6309.887999999992] duration [10.112] timeline [0] selected by [mediaIndex/partIndex increment] playlist [0-url/issue.m3u8]

When seeking after 6250 will fail with the error VIDEOJS: ERROR: (CODE:3 MEDIA_ERR_DECODE)

VIDEOJS: DEBUG: VHS: SegmentLoader[main] > READY -> WAITING
VIDEOJS: DEBUG: VHS: SegmentLoader[main] > Requesting segment [7858650/7859787] segment start/end [-85392.38968888888 => -85382.27768888889] startOfSegment [10051.328000000018] duration [10.112] timeline [0] selected by [getMediaInfoForTime (currentTime 10056.96063523568)] playlist [0-url/issue.m3u8]
VIDEOJS: DEBUG: VHS: SegmentLoader[main] > timinginfo: audio - start - 3745.9482222222223
VIDEOJS: DEBUG: VHS: SegmentLoader[main] > timinginfo: audio - end - 3756.0602222222224
VIDEOJS: DEBUG: VHS: SourceUpdater > Appending segment 994's 122417 bytes to audioBuffer
VIDEOJS: DEBUG: VHS: SegmentLoader[main] > WAITING -> APPENDING
VIDEOJS: DEBUG: VHS: PlaybackWatcher > found #10 main appends that did not increase buffer (possible stalled download)
VIDEOJS: DEBUG: VHS: PlaybackWatcher > main loader stalled download exclusion
VIDEOJS: DEBUG: VHS: PlaybackWatcher > resetting possible stalled download count for main loader
VIDEOJS: DEBUG: VHS: PlaylistSelector > could not choose a playlist with options 
Object { bandwidth: 48796615, width: 640, height: 264, limitRenditionByPlayerDimensions: true }

VIDEOJS: ERROR: (CODE:3 MEDIA_ERR_DECODE) Playback cannot continue. No available working or supported playlists. 

Additional Information

I dug around in the mux.js but I got lost on the way.

videojs-http-streaming version

Affects version 3 and 2.

videojs version

Tested on videojs version 7.21.1, also affects version 8 and can be experienced since version 7.10.1

Browsers

Chrome, Firefox

Platforms

Windows, Linux

amtins avatar Feb 13 '23 15:02 amtins