Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression in calculating live edge in 2.x vs 1.6.x #490

Closed
johanhil opened this issue Aug 17, 2016 · 2 comments
Closed

Regression in calculating live edge in 2.x vs 1.6.x #490

johanhil opened this issue Aug 17, 2016 · 2 comments
Assignees
Labels
status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Milestone

Comments

@johanhil
Copy link

I have a Manifest that looks something like this:

<?xml version="1.0" encoding="utf-8"?>
<!-- Created with Unified Streaming Platform(version=1.7.19) -->
<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"
  type="dynamic"
  availabilityStartTime="1970-01-01T00:00:00Z"
  publishTime="2016-08-17T14:36:56.591341Z"
  minimumUpdatePeriod="PT8S"
  timeShiftBufferDepth="PT27H6M44S"
  maxSegmentDuration="PT5S"
  minBufferTime="PT12S"
  profiles="urn:mpeg:dash:profile:isoff-live:2011,urn:com:dashif:dash264">
  <Period
    id="1"
    start="PT0S">
    <BaseURL>dash/</BaseURL>
    <AdaptationSet
      group="1"
      contentType="audio"
      lang="sv"
      minBandwidth="128000"
      maxBandwidth="128000"
      segmentAlignment="true"
      audioSamplingRate="48000"
      mimeType="audio/mp4"
      codecs="mp4a.40.2">
      <AudioChannelConfiguration
        schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011"
        value="2">
      </AudioChannelConfiguration>
      <SegmentTemplate
        timescale="48000"
        initialization="vsh-$RepresentationID$.dash"
        media="vsh-$RepresentationID$-$Time$.dash">
        <!-- 2016-08-16T11:29:58.309333Z / 1471346998 - 2016-08-17T14:36:45.904000Z -->
        <SegmentTimeline>
          <S t="70624655918848" d="192512" r="24336" />
        </SegmentTimeline>
      </SegmentTemplate>
      <Representation
        id="svenska=128000"
        bandwidth="128000">
      </Representation>
    </AdaptationSet>
    <AdaptationSet
      group="2"
      contentType="video"
      par="16:9"
      minBandwidth="500000"
      maxBandwidth="4500000"
      minWidth="480"
      maxWidth="1280"
      minHeight="270"
      maxHeight="720"
      minFrameRate="25"
      maxFrameRate="50"
      segmentAlignment="true"
      mimeType="video/mp4"
      startWithSAP="1">
      <Representation
        id="video=500000"
        bandwidth="500000"
        width="480"
        height="270"
        frameRate="25"
        codecs="avc1.4D4015"
        scanType="progressive">
        <SegmentTemplate
          timescale="25"
          initialization="vsh-$RepresentationID$.dash"
          media="vsh-$RepresentationID$-$Time$.dash">
          <!-- 2016-08-16T11:29:58Z / 1471346998 - 2016-08-17T14:36:42Z -->
          <SegmentTimeline>
            <S t="36783674950" d="100" r="24400" />
          </SegmentTimeline>
        </SegmentTemplate>
      </Representation>
      <Representation
        id="video=1000000"
        bandwidth="1000000"
        width="640"
        height="360"
        frameRate="25"
        codecs="avc1.4D401E"
        scanType="progressive">
        <SegmentTemplate
          timescale="25"
          initialization="vsh-$RepresentationID$.dash"
          media="vsh-$RepresentationID$-$Time$.dash">
          <!-- 2016-08-16T11:29:58Z / 1471346998 - 2016-08-17T14:36:42Z -->
          <SegmentTimeline>
            <S t="36783674950" d="100" r="24400" />
          </SegmentTimeline>
        </SegmentTemplate>
      </Representation>
      <Representation
        id="video=1800000"
        bandwidth="1800000"
        width="960"
        height="540"
        frameRate="25"
        codecs="avc1.4D401F"
        scanType="progressive">
        <SegmentTemplate
          timescale="25"
          initialization="vsh-$RepresentationID$.dash"
          media="vsh-$RepresentationID$-$Time$.dash">
          <!-- 2016-08-16T11:29:58Z / 1471346998 - 2016-08-17T14:36:42Z -->
          <SegmentTimeline>
            <S t="36783674950" d="100" r="24400" />
          </SegmentTimeline>
        </SegmentTemplate>
      </Representation>
      <Representation
        id="video=3000000"
        bandwidth="3000000"
        width="1280"
        height="720"
        frameRate="25"
        codecs="avc1.4D401F"
        scanType="progressive">
        <SegmentTemplate
          timescale="25"
          initialization="vsh-$RepresentationID$.dash"
          media="vsh-$RepresentationID$-$Time$.dash">
          <!-- 2016-08-16T11:29:58Z / 1471346998 - 2016-08-17T14:36:42Z -->
          <SegmentTimeline>
            <S t="36783674950" d="100" r="24400" />
          </SegmentTimeline>
        </SegmentTemplate>
      </Representation>
      <Representation
        id="video=4500000"
        bandwidth="4500000"
        width="1280"
        height="720"
        frameRate="50"
        codecs="avc1.640020"
        scanType="progressive">
        <SegmentTemplate
          timescale="50"
          initialization="vsh-$RepresentationID$.dash"
          media="vsh-$RepresentationID$-$Time$.dash">
          <!-- 2016-08-16T11:29:58Z / 1471346998 - 2016-08-17T14:36:42Z -->
          <SegmentTimeline>
            <S t="73567349900" d="200" r="24400" />
          </SegmentTimeline>
        </SegmentTemplate>
      </Representation>
    </AdaptationSet>
  </Period>
</MPD>

I downloaded it at at 14:36:56, and looking at the segments available for the stream with id video=4500000, my last video segment ends at 14:36:38 (73567349900 / 50 + (200/50)*24400 = 1471444598).

In Shaka 1.6.x, this stream plays as expected, but in Shaka 2 it will calculate live edge as being after 14:36:38, meaning the stream does not start until a few seconds have passed and the encoder spits out a segment that is at the live edge.

On the demos for 1.6.3 and for 2.0.0-beta3, this is quite apparent.

My initial findings points to the live edge in 1.6 being calculated using computeStreamLimits_ in stream_video_source, which looks at the segments.
In 2.x, the live edge seems to be calculated by getLiveEdge_ which doesn't take the last segment end time into account.

This particular manifest has quite a big time shift buffer, but I can reproduce with a time shift buffer of less than an hour, so it's unrelated as far as I can tell.

I tried writing a unit test, but I did not get very far, sorry.

Is this a problematic manifest that just happened to work on 1.6, or a regression between 1.6 and 2.0?

I can provide links so that you can test this locally, just email me at [email protected]

@joeyparrish joeyparrish added the type: bug Something isn't working correctly label Aug 24, 2016
@joeyparrish joeyparrish added this to the v2.0.0 milestone Aug 24, 2016
shaka-bot pushed a commit that referenced this issue Aug 24, 2016
When determining the starting time to play a live stream, we should
include the suggestedPresentationDelay.  Otherwise, we may try to fetch
segments that do not exist yet and remain in a buffering state for
much longer than needed.

Issue #490

Change-Id: I6372a4b210b2384ac2198df65b6f91c5a94dbb14
@TheModMaker
Copy link
Contributor

There are two problems here:

First, we do not account for suggestedPresentationDelay when determining where to start playing. So we want to play too close to the live edge and have to buffer until the segments become available. This has just been fixed on master.

Second, your manifest does not have a suggestedPresentationDelay. This means we use a default value of 5 seconds, which is too small for your setup. You should add a suggestedPresentationDelay attribute to your MPD element with about 20 seconds.

@joeyparrish
Copy link
Member

Since the regression (suggestedPresentationDelay) was fixed, I'm closing the issue.

@johanhil, let us know if there's anything else we can do for you.

@shaka-project shaka-project locked and limited conversation to collaborators Mar 22, 2018
@shaka-bot shaka-bot added the status: archived Archived and locked; will not be updated label Apr 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Projects
None yet
Development

No branches or pull requests

4 participants