Dash-Industry-Forum / dash.js

A reference client implementation for the playback of MPEG DASH via Javascript and compliant browsers.
http://reference.dashif.org/dash.js/nightly/samples/dash-if-reference-player/index.html
Other
5.15k stars 1.68k forks source link

Live MPD unplayable with empty segment timeline for text track #2708

Closed jakubvojacek closed 6 years ago

jakubvojacek commented 6 years ago
Steps to reproduce

The playback does not start in case of live content that has subtitle track with no subtitles available yet. Sample MPD is:

<?xml version="1.0" encoding="UTF-8"?>
<!--Generated with https://github.com/google/shaka-packager version 5f0868275a-release-->
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd" xmlns:cenc="urn:mpeg:cenc:2013" profiles="urn:mpeg:dash:profile:isoff-live:2011" minBufferTime="PT3.2S" type="dynamic" publishTime="2018-07-12T06:43:34Z" availabilityStartTime="2018-07-11T18:18:02Z" minimumUpdatePeriod="PT5S" timeShiftBufferDepth="PT15000S" suggestedPresentationDelay="PT5S">
  <Period id="0" start="PT0S">
    <AdaptationSet id="0" contentType="text" lang="cs" segmentAlignment="true">
      <Role schemeIdUri="urn:mpeg:dash:role:2011" value="subtitle"/>
      <Role schemeIdUri="urn:mpeg:dash:role:2011" value="main"/>
      <Representation id="0" bandwidth="0" codecs="wvtt" mimeType="application/mp4">
        <SegmentTemplate timescale="1000" initialization="ct-sport-8_subtitle_init.mp4" media="subtitle/ttv_$Number$.m4s" startNumber="1"/>
      </Representation>
    </AdaptationSet>
    <AdaptationSet id="1" contentType="video" maxWidth="1920" maxHeight="1080" frameRate="90000/3600" segmentAlignment="true" par="16:9">
      <Representation id="1" bandwidth="400000" codecs="avc1.4d401e" mimeType="video/mp4" sar="1:1" width="640" height="360">
        <SegmentTemplate timescale="90000" initialization="ct-sport-8_video_640_360.mp4" media="video_640_360/ct-sport-8-$Number$.mp4" startNumber="9287">
          <SegmentTimeline>
            <S t="2675297040" d="288000" r="4688"/>
          </SegmentTimeline>
        </SegmentTemplate>
      </Representation>
      <Representation id="2" bandwidth="2500000" codecs="avc1.4d4028" mimeType="video/mp4" sar="1:1" width="1920" height="1080">
        <SegmentTemplate timescale="90000" initialization="ct-sport-8_video_1920_1080.mp4" media="video_1920_1080/ct-sport-8-$Number$.mp4" startNumber="9287">
          <SegmentTimeline>
            <S t="2675297040" d="288000" r="4688"/>
          </SegmentTimeline>
        </SegmentTemplate>
      </Representation>
      <Representation id="3" bandwidth="1000000" codecs="avc1.4d401f" mimeType="video/mp4" sar="1:1" width="960" height="540">
        <SegmentTemplate timescale="90000" initialization="ct-sport-8_video_720_410.mp4" media="video_720_410/ct-sport-8-$Number$.mp4" startNumber="9287">
          <SegmentTimeline>
            <S t="2675297040" d="288000" r="4688"/>
          </SegmentTimeline>
        </SegmentTemplate>
      </Representation>
    </AdaptationSet>
    <AdaptationSet id="2" contentType="audio" lang="cs" segmentAlignment="true">
      <Role schemeIdUri="urn:mpeg:dash:role:2011" value="main"/>
      <Representation id="4" bandwidth="131745" codecs="mp4a.40.2" mimeType="audio/mp4" audioSamplingRate="48000">
        <AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
        <SegmentTemplate timescale="90000" initialization="ct-sport-8_audio_cs.mp4" media="audio_cs/ct-sport-8-$Number$.mp4" startNumber="9289">
          <SegmentTimeline>
            <S t="2675521778" d="288000" r="3684"/>
            <S t="3736801778" d="281955"/>
            <S t="3737089489" d="288000" r="54"/>
            <S t="3752929489" d="285935"/>
            <S t="3753217404" d="288000" r="804"/>
            <S t="3985057404" d="282036"/>
            <S t="3985345198" d="288000" r="140"/>
          </SegmentTimeline>
        </SegmentTemplate>
      </Representation>
    </AdaptationSet>
  </Period>
  <UTCTiming schemeIdUri="urn:mpeg:dash:utc:http-head:2014" value="https://mw.motv.eu/time.txt"/>
</MPD>
Observed behaviour

The playback is not started, ends up with an error instead. This issue was just recently resolved by the shaka player team in their player https://github.com/google/shaka-player/issues/1484 and you can sucecssfully test playing the MPD here https://nightly-dot-shaka-player-demo.appspot.com/

Console output
SegmentsUtils.js:238 Uncaught TypeError: Cannot read property 'start' of null
    at decideSegmentListRangeForTemplate (SegmentsUtils.js:238)
    at Object.getSegmentsFromTemplate [as getSegments] (TemplateSegmentsGetter.js:64)
    at Object.getSegments (SegmentsGetter.js:65)
    at updateSegments (DashHandler.js:218)
    at updateSegmentList (DashHandler.js:244)
    at Object.updateRepresentation (DashHandler.js:255)
    at Object.updateData (RepresentationController.js:192)
    at Object.updateData (DashAdapter.js:446)
    at Object.selectMediaInfo (StreamProcessor.js:250)
    at createStreamProcessor (Stream.js:390)
davemevans commented 6 years ago

It passes the validator, but I don't think this is valid - you state there is an empty SegmentTimeline, but that element is not included here, only a SegmentTemplate with no @duration.

The spec is clear that If the Representation contains more than one Media Segment, then either the attribute @duration or the element SegmentTimeline shall be present. Neither of those things is true. Additionally, the DASH-IF IOP are even clearer: exactly one of SegmentTemplate@duration or SegmentTemplate.SegmentTimeline must be present per Representation.

Regardless, it will still fail since media should be available for the entire @timeShiftBufferDepth. Personally, I think dash.js is behaving correctly and that the packager should be producing valid segments with empty samples.

Of course, there is the option to copy the Shaka Player functionality.

nicosang commented 6 years ago

Hi @jakubvojacek and @bbcrddave ,

I rather agree with David. However, the issue seems to be solved by adding a small test of availabilityWindow. @jakubvojacek could you, please, test it on your side?

thanks,

Nico

jakubvojacek commented 6 years ago

@nicosang thank you for the PR. I will try to talk to shaka packager team to fix this issue on their side.