shaka-player icon indicating copy to clipboard operation
shaka-player copied to clipboard

Stream halts when transition from dynamic to static

Open OrenMe opened this issue 4 years ago • 22 comments

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

What version of Shaka Player are you using? 3.0.13 and 3.2.0

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

Can you reproduce the issue with the latest code from master? NA

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

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

What browser and OS are you using? Chrome on Mac

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

What are the manifest and license server URIs?

I can't share the manifest url because nature of issue is dynamic, here is sample of dynamic manifest and static manifest where transition between dynamic to static causes the issue:

Dynamic manifest
<?xml version="1.0" encoding="utf-8"?>
<MPD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:mpeg:dash:schema:mpd:2011" xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 http://standards.iso.org/ittf/PubliclyAvailableStandards/MPEG-DASH_schema_files/DASH-MPD.xsd" id="201" type="dynamic" publishTime="2021-08-05T14:32:51" minimumUpdatePeriod="PT4S" availabilityStartTime="2021-04-05T01:32:10.829000+00:00" minBufferTime="PT12S" suggestedPresentationDelay="PT20.000S" timeShiftBufferDepth="PT620.000S" profiles="urn:mpeg:dash:profile:isoff-live:2011">
  <Period start="PT0.000S" id="1">
    <AdaptationSet mimeType="video/mp4" segmentAlignment="true" startWithSAP="1" subsegmentAlignment="true" subsegmentStartsWithSAP="1" bitstreamSwitching="true">
      <Representation id="1" width="640" height="360" frameRate="25/1" bandwidth="736000" codecs="avc1.4D401E">
        <SegmentTemplate timescale="25000" media="manifest_video_2_0_$Number$.mp4?m=1616463675" initialization="manifest_video_2_0_init.mp4?m=1616463675" startNumber="2645811">
          <SegmentTimeline>
            <S t="264675416533" d="100000" r="156"/>
          </SegmentTimeline>
        </SegmentTemplate>
      </Representation>
      <Representation id="2" width="854" height="480" frameRate="25/1" bandwidth="1312000" codecs="avc1.4D401E">
        <SegmentTemplate timescale="25000" media="manifest_video_3_0_$Number$.mp4?m=1616463675" initialization="manifest_video_3_0_init.mp4?m=1616463675" startNumber="2645811">
          <SegmentTimeline>
            <S t="264675416533" d="100000" r="156"/>
          </SegmentTimeline>
        </SegmentTemplate>
      </Representation>
      <Representation id="3" width="1280" height="720" frameRate="25/1" bandwidth="2800000" codecs="avc1.4D401F">
        <SegmentTemplate timescale="25000" media="manifest_video_4_0_$Number$.mp4?m=1616463675" initialization="manifest_video_4_0_init.mp4?m=1616463675" startNumber="2645811">
          <SegmentTimeline>
            <S t="264675416533" d="100000" r="156"/>
          </SegmentTimeline>
        </SegmentTemplate>
      </Representation>
      <Representation id="4" width="1920" height="1080" frameRate="25/1" bandwidth="4499968" codecs="avc1.4D4028">
        <SegmentTemplate timescale="25000" media="manifest_video_5_0_$Number$.mp4?m=1616463675" initialization="manifest_video_5_0_init.mp4?m=1616463675" startNumber="2645811">
          <SegmentTimeline>
            <S t="264675416533" d="100000" r="156"/>
          </SegmentTimeline>
        </SegmentTemplate>
      </Representation>
    </AdaptationSet>
    <AdaptationSet mimeType="audio/mp4" segmentAlignment="0" lang="und">
      <Label>und</Label>
      <Representation id="5" bandwidth="96123" audioSamplingRate="48000" codecs="mp4a.40.2">
        <AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"></AudioChannelConfiguration>
        <SegmentTemplate timescale="48000" media="manifest_audio_1_0_$Number$.mp4?m=1616463675" initialization="manifest_audio_1_0_init.mp4?m=1616463675" startNumber="2645811">
          <SegmentTimeline>
            <S t="508176800192" d="192512"/>
            <S t="508176992704" d="191488"/>
            <S t="508177184192" d="192512"/>
            <S t="508177376704" d="191488"/>
            <S t="508177568192" d="192512"/>
            <S t="508177760704" d="191488"/>
            <S t="508177952192" d="192512"/>
            <S t="508178144704" d="191488"/>
            <S t="508178336192" d="192512"/>
            <S t="508178528704" d="191488"/>
            <S t="508178720192" d="192512"/>
            //removed some lines here to reduce length...
            <S t="508206176704" d="191488"/>
            <S t="508206368192" d="192512"/>
            <S t="508206560704" d="191488"/>
            <S t="508206752192" d="192512"/>
          </SegmentTimeline>
        </SegmentTemplate>
      </Representation>
    </AdaptationSet>
    <AdaptationSet mimeType="application/mp4" codecs="stpp" segmentAlignment="true" startWithSAP="1" bitstreamSwitching="true" lang="en">
      <Label>English</Label>
      <Representation id="6" bandwidth="0">
        <SegmentTemplate timescale="90000" media="manifest_subtitles_6_0_$Number$.mp4?m=1616463675" initialization="manifest_subtitles_6_0_init.mp4?m=1616463675" startNumber="2645811">
          <SegmentTimeline>
            <S t="952831499520" d="360000" r="156"/>
          </SegmentTimeline>
        </SegmentTemplate>
      </Representation>
    </AdaptationSet>
    <SupplementalProperty schemeIdUri="urn:scte:dash:utc-time" value="2021-04-05T01:32:04.025Z"></SupplementalProperty>
  </Period>
</MPD>
Static manifest
<?xml version="1.0" encoding="utf-8"?>
<MPD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:mpeg:dash:schema:mpd:2011" xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 http://standards.iso.org/ittf/PubliclyAvailableStandards/MPEG-DASH_schema_files/DASH-MPD.xsd" id="201" type="static" mediaPresentationDuration="PT632.000S" minBufferTime="PT12S" profiles="urn:mpeg:dash:profile:isoff-main:2011">
  <Period start="PT0.000S" id="1" duration="PT10587648.661S">
    <AdaptationSet mimeType="video/mp4" segmentAlignment="true" startWithSAP="1" subsegmentAlignment="true" subsegmentStartsWithSAP="1" bitstreamSwitching="true">
      <Representation id="1" width="640" height="360" frameRate="25/1" bandwidth="736000" codecs="avc1.4D401E">
        <SegmentTemplate timescale="25000" media="manifest_video_2_0_$Number$.mp4?m=1616463675" initialization="manifest_video_2_0_init.mp4?m=1616463675" startNumber="2645811" presentationTimeOffset="264675416533">
          <SegmentTimeline>
            <S t="264675416533" d="100000" r="157"/>
          </SegmentTimeline>
        </SegmentTemplate>
      </Representation>
      <Representation id="2" width="854" height="480" frameRate="25/1" bandwidth="1312000" codecs="avc1.4D401E">
        <SegmentTemplate timescale="25000" media="manifest_video_3_0_$Number$.mp4?m=1616463675" initialization="manifest_video_3_0_init.mp4?m=1616463675" startNumber="2645811" presentationTimeOffset="264675416533">
          <SegmentTimeline>
            <S t="264675416533" d="100000" r="157"/>
          </SegmentTimeline>
        </SegmentTemplate>
      </Representation>
      <Representation id="3" width="1280" height="720" frameRate="25/1" bandwidth="2800000" codecs="avc1.4D401F">
        <SegmentTemplate timescale="25000" media="manifest_video_4_0_$Number$.mp4?m=1616463675" initialization="manifest_video_4_0_init.mp4?m=1616463675" startNumber="2645811" presentationTimeOffset="264675416533">
          <SegmentTimeline>
            <S t="264675416533" d="100000" r="157"/>
          </SegmentTimeline>
        </SegmentTemplate>
      </Representation>
      <Representation id="4" width="1920" height="1080" frameRate="25/1" bandwidth="4499968" codecs="avc1.4D4028">
        <SegmentTemplate timescale="25000" media="manifest_video_5_0_$Number$.mp4?m=1616463675" initialization="manifest_video_5_0_init.mp4?m=1616463675" startNumber="2645811" presentationTimeOffset="264675416533">
          <SegmentTimeline>
            <S t="264675416533" d="100000" r="157"/>
          </SegmentTimeline>
        </SegmentTemplate>
      </Representation>
    </AdaptationSet>
    <AdaptationSet mimeType="audio/mp4" segmentAlignment="0" lang="und">
      <Label>und</Label>
      <Representation id="5" bandwidth="96123" audioSamplingRate="48000" codecs="mp4a.40.2">
        <AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"></AudioChannelConfiguration>
        <SegmentTemplate timescale="48000" media="manifest_audio_1_0_$Number$.mp4?m=1616463675" initialization="manifest_audio_1_0_init.mp4?m=1616463675" startNumber="2645811" presentationTimeOffset="508176799744">
          <SegmentTimeline>
            <S t="508176800192" d="192512"/>
            <S t="508176992704" d="191488"/>
            <S t="508177184192" d="192512"/>
            <S t="508177376704" d="191488"/>
            //removed some lines here to reduce length...
            <S t="508205984192" d="192512"/>
            <S t="508206176704" d="191488"/>
            <S t="508206368192" d="192512"/>
            <S t="508206560704" d="191488"/>
            <S t="508206752192" d="192512"/>
            <S t="508206944704" d="191488"/>
          </SegmentTimeline>
        </SegmentTemplate>
      </Representation>
    </AdaptationSet>
    <AdaptationSet mimeType="application/mp4" codecs="stpp" segmentAlignment="true" startWithSAP="1" bitstreamSwitching="true" lang="en">
      <Label>English</Label>
      <Representation id="6" bandwidth="0">
        <SegmentTemplate timescale="90000" media="manifest_subtitles_6_0_$Number$.mp4?m=1616463675" initialization="manifest_subtitles_6_0_init.mp4?m=1616463675" startNumber="2645811" presentationTimeOffset="952831499520">
          <SegmentTimeline>
            <S t="952831499520" d="360000" r="157"/>
          </SegmentTimeline>
        </SegmentTemplate>
      </Representation>
    </AdaptationSet>
    <SupplementalProperty schemeIdUri="urn:scte:dash:utc-time" value="2021-04-05T01:32:04.025Z"></SupplementalProperty>
  </Period>
</MPD>

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

default config, didn't change anything

What did you do?

play a live dynamic manifest seek to start of sliding window wait till it turns to static

What did you expect to happen? because I seek back then when manifest turned from dynamic to static I expect playback to continue until the end of the remaining duration of playback

What actually happened?

The playback stops immediately when manifest turn from dynamic to static A warning appears in the console There is a gap/overlap between Periods image

See manifest data for transition between dynamic to static in section above. The expectation is that it will behave like HLS event playlist where a user can watch a live event, seek back to the beginning and view it, in the meanwhile the even is over and level playlist gets appended with EXT-X-ENDLIST but playback keeps going cause user is in DVR part of the stream and only when it reaches the last segment playback stops like a VOD stream.

This is related to another issue that I asked in #3376

Maybe we need to apply same fix here that the reference duration will be taken from either maxSegmentEndTime_ and if not applicable then duration_ or just reset reference givenDuration to some value when manifest transitions from dynamic to static in DashParser.parsePeriods_?

OrenMe avatar Aug 05 '21 15:08 OrenMe

@joeyparrish any chance someone can look into this, I can provide more details if required

OrenMe avatar Aug 10 '21 11:08 OrenMe

Can anyone review this and help?

OrenMe avatar Aug 25 '21 17:08 OrenMe

Hi, any chance for someone to take a look?

OrenMe avatar Sep 12 '21 08:09 OrenMe

@joeyparrish can you please check this issue? I previously sent a test stream over email but I guess it is invalid now, I can provide another one if needed

OrenMe avatar Sep 20 '21 13:09 OrenMe

The problem is that the segments in the manifest change times with the manifest update. In the dynamic manifest, the segments have segment times near 10,000,000 seconds; but in the static manifest, they are shifted back to 0. Changing segment times in an update isn't supported. According to #3376, you should set the Period@start attribute of the first Period to adjust the first segment to appear at the same time as it did before.

TheModMaker avatar Sep 20 '21 17:09 TheModMaker

Thanks @TheModMaker, the linked ticket was the first issue we encountered and you can see I commented there as well. This fix actually solved the issue with loading the generated manifest after it transitioned from dynamic to static, but I missed the other part about changing the segments timing. I'll check that with the stream provider.

OrenMe avatar Sep 20 '21 19:09 OrenMe

@OrenMe, please accept our apologies for taking so long to respond to this issue the first time. We are working on our issue-handling process and tools to try to improve our response times.

To follow up on your previous comment, have you had a chance to check with the stream provider?

joeyparrish avatar Oct 01 '21 21:10 joeyparrish

Hi @joeyparrish, I'm sure you are extremely busy so appreciate that. I'm still waiting on a response from the vendor and will update as soon as I get an answer.

OrenMe avatar Oct 05 '21 03:10 OrenMe

Hi @joeyparrish , sorry it took so long, so this an AWS stream and according to the team they are spec compliant and shared some more details that seem to indicate I ned to manage this in the player side. I tried to test it in dash.if reference player and some additional ones not using shaka and it seems to handle it correctly, but I still don't know what is the issue.Would you be able to test this on your side as well if I'll share a test stream? I will share an email with a test stream which is available for you to try.

In addition, the stream I'm testing fails on latest version of the player, it works on 3.2.0, but not on 3.2.1 and also on 3.1.2 but not on 3.1.3 so it is possibly something in latest version, my initial suspicion is with this fix 'Fix tracking of active variant track in live streams'

OrenMe avatar Oct 28 '21 10:10 OrenMe

@joeyparrish does this help? were you able to review the email and test with the test link? I read a bit more and asked around in video-dev on it and stumbled on a link to discussion in exoplayer https://github.com/google/ExoPlayer/issues/4780 around that matter that led to another one in dash-if https://github.com/Dash-Industry-Forum/Guidelines-TimingModel/issues/31 but I'm still don't know if this also relates to how shaka handles this

OrenMe avatar Nov 01 '21 12:11 OrenMe

Hi @joeyparrish did you get a chance to review the details and test stream sent over the email?

OrenMe avatar Nov 08 '21 05:11 OrenMe

We are also having problems when a cloud DVR stream transitions from dynamic to static during playback. We have reproduced our problem with Shaka 3.1.2 and 3.2.1. Our problem does not occur with Shaka 2.5.22

caridley avatar Nov 12 '21 16:11 caridley

thanks for the feedback @caridley , @joeyparrish any chance to get this checked?

OrenMe avatar Nov 15 '21 06:11 OrenMe

I have also experienced this issue on my Chromecast receivers since the SDK was updated to use Shaka v3.0.13. My streams are generated by FFMPEG, and move from dynamic to static once encoding has been completed.

I think this may have been caused by #3567 or #3419, though I'm totally guessing here. Everything worked fine on v3.0.10. Haven't checked versions in between, but I'll do a few tests and get back to you asap!

rhyswilliamsza avatar Nov 17 '21 17:11 rhyswilliamsza

@joeyparrish would appreciate your feedback here, not sure where to even start looking

OrenMe avatar Nov 24 '21 19:11 OrenMe

@joeyparrish any update?

OrenMe avatar Dec 13 '21 10:12 OrenMe

@OrenMe Our specific problem with dynamic to static transitions has been fixed with the fix for https://github.com/google/shaka-player/issues/3675 in the 3.0.15, 3.1.4 and 3.2.2 releases

caridley avatar Jan 06 '22 21:01 caridley

Thanks @caridley ! Will check it as soon as I'm back in the office.

OrenMe avatar Jan 07 '22 18:01 OrenMe

The issue still exists on 3.3.0 version. @joeyparrish can you please check this issue?

yairans avatar Jan 18 '22 11:01 yairans

We faced the same issue when transition from 'dynamic' to 'static' content happens on Chromecast app (shaka version 3.0.13) and Web app with shaka (shaka version 3.2.1).

Could please someone share the latest status of this issue?

Thanks.

glhvta avatar Jul 22 '22 13:07 glhvta

Is the issue still present in the latest releases? (v3.2.10, v3.3.8, v4.0.4, v4.1.2)

joeyparrish avatar Jul 22 '22 15:07 joeyparrish

Hi @joeyparrish. I just checked behavior on the latest shaka release 3.2.10 and it looks like the issue is not reproduced.

On the same stream when switching from dynamic to static:

  • v3.2.1 stream halts
  • v3.2.10 stream continues to play till the end of asset

glhvta avatar Aug 04 '22 11:08 glhvta

Hello @joeyparrish. To update about the current state of the issue, our customer is using a set of manifests that transition from dynamic to static. I can't provide a working example currently, but these are examples of the enclosing mpd elements:

<MPD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:mpeg:dash:schema:mpd:2011" xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 http://standards.iso.org/ittf/PubliclyAvailableStandards/MPEG-DASH_schema_files/DASH-MPD.xsd" id="201" type="dynamic" publishTime="2022-11-08T08:08:18" minimumUpdatePeriod="PT4S" availabilityStartTime="2021-04-15T12:42:29.396000+00:00" minBufferTime="PT12S" suggestedPresentationDelay="PT20.000S" timeShiftBufferDepth="PT544.000S" profiles="urn:mpeg:dash:profile:isoff-live:2011">

<MPD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:mpeg:dash:schema:mpd:2011" xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 http://standards.iso.org/ittf/PubliclyAvailableStandards/MPEG-DASH_schema_files/DASH-MPD.xsd" id="201" type="static" mediaPresentationDuration="PT1324.000S" minBufferTime="PT12S" profiles="urn:mpeg:dash:profile:isoff-main:2011">

Shaka doesn't automatically set currentTime after the transition, which causes playback to immediately end, regardless of the currentTime position before the switch. In addition it looks like seeking after the switch is made can cause a stall, possibly similar to https://github.com/shaka-project/shaka-player/issues/3902 or https://github.com/shaka-project/shaka-player/issues/2581.

A solution of saving [shaka.seekRange.end - video.currentTime] and using it to set currentTime after the transition (using responseFilter handler) works pretty well on versions 3.3.0 to 3.3.2, however from version 3.3.3 and onwards (probably because of the fix in https://github.com/shaka-project/shaka-player/commit/11f998d97254a1b9ca27b2a461bf850db2c76eaa), calling shaka.seekRange.end in the response filter handler now returns the seekRange for the STATIC manifest, which means we can't set the currentTime correctly anymore.

My question is - is the problem with setting the currentTime caused by an issue on the manifest side, on Shaka side, or on our side ? The simplest fix would probably be for us to save the value of seekRange.end at a point before it changes, if that's possible.

Thanks, Sivan

SivanA-Kaltura avatar Nov 09 '22 15:11 SivanA-Kaltura

If the presentation timeline changes on transition, we can't support that. For example, if segment 12 has presentation time 48300 before the transition, but presentation time 500 after the transition, you've just broken the timeline, and everything Shaka has already buffered now disagrees with the manifest.

If the timeline is stable when transitioning from dynamic to static, it should work. If it doesn't, it's a bug in the player.

Since in https://github.com/shaka-project/shaka-player/issues/3567#issuecomment-1205104829, @glhvta confirmed that the original issue was fixed in v3.2.10, I think this issue should be closed. @SivanA-Kaltura, if your content timeline is stable as I described, please open a new issue and follow all the instructions in the issue template (including content links so that we can reproduce the issue). Thanks!

joeyparrish avatar Nov 09 '22 20:11 joeyparrish