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

Consider making the bandwidth attribute in a manifest optional #938

Closed
ericmatthys opened this issue Jul 21, 2017 · 2 comments
Closed

Consider making the bandwidth attribute in a manifest optional #938

ericmatthys opened this issue Jul 21, 2017 · 2 comments
Assignees
Labels
status: archived Archived and locked; will not be updated status: bad content Caused by invalid, broken, or unsupported content type: enhancement New feature or request
Milestone

Comments

@ericmatthys
Copy link

There are cases where there may not always be a useful value for the bandwidth attribute when converting user videos on-the-fly with DASH without multiple qualities. Shaka is asserting that bandwidth be defined, and non-zero.

https://github.com/google/shaka-player/blob/310e48f8cc2fe5ef4efac808716a93bfb9a2091d/lib/dash/dash_parser.js#L1061

When parsing the manifest, it is forcing bandwidth to either be a number greater than zero, or it will be undefined.

However, streams without a bandwidth attribute or bandwidth="0" in the manifest were otherwise working until a more recent change. a452c24 is the change that actually broke playback when bandwidth is missing or zero. It is expecting bandwidth to be a number, and if it is not, it results in an averageBandwidth of NaN and it will not choose codecs.

<?xml version="1.0" encoding="utf-8"?>
<MPD
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns="urn:mpeg:dash:schema:mpd:2011"
  xmlns:xlink="http://www.w3.org/1999/xlink"
  xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 http://standards.iso.org/ittf/PubliclyAvailableStandards/MPEG-DASH_schema_files/DASH-MPD.xsd"
  profiles="urn:mpeg:dash:profile:isoff-live:2011"
  type="static"
  mediaPresentationDuration="PT1H51M57.6758S"
  maxSegmentDuration="PT10S"
  minBufferTime="PT10S">
  <Period start="PT0S" duration="PT1H51M57.6758S">
    <AdaptationSet segmentAlignment="true">
      <SegmentTemplate timescale="1" duration="5" initialization="dash/osl17x74saioaf9c4rkzfyw6/$RepresentationID$/initial.mp4" media="dash/osl17x74saioaf9c4rkzfyw6/$RepresentationID$/$Number$.m4s" startNumber="0">
      </SegmentTemplate>
      <Representation id="0" mimeType="video/mp4" codecs="avc1.42c00d" bandwidth="1000" width="1912" height="792">
      </Representation>
    </AdaptationSet>
    <AdaptationSet segmentAlignment="true">
      <SegmentTemplate timescale="1" duration="5" initialization="dash/osl17x74saioaf9c4rkzfyw6/$RepresentationID$/initial.mp4" media="dash/osl17x74saioaf9c4rkzfyw6/$RepresentationID$/$Number$.m4s" startNumber="0">
      </SegmentTemplate>
      <Representation id="1" mimeType="audio/mp4" codecs="mp4a.40.2" bandwidth="0" audioSamplingRate="48000">
        <AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
      </Representation>
    </AdaptationSet>
  </Period>
</MPD>

I believe making bandwidth optional aligns with the ExoPlayer's expectations of the bandwidth attribute in the manifest, which appears to allow it to be optional.

https://github.com/google/ExoPlayer/blob/d979469659861f7fe1d39d153b90bdff1ab479cc/library/dash/src/main/java/com/google/android/exoplayer2/source/dash/manifest/DashManifestParser.java#L435

Otherwise, the manifest could have a fake bandwidth value of any number greater than zero and that should at least work around the issue.

@joeyparrish joeyparrish added the type: bug Something isn't working correctly label Jul 23, 2017
@joeyparrish
Copy link
Member

The use of the bandwidth attribute in Representation is mandatory in the DASH spec. So if the attribute is missing, the content is broken.

Further, the definition of the attribute in the spec is as follows (section 5.3.5.2, Table 7, "Semantics of Representation element"):

Consider a hypothetical constant bitrate channel of bandwidth with the value of this attribute in bits per second (bps). Then, if the Representation is continuously delivered at this bitrate, starting at any SAP that is indicated either by @startWithSAP or by any Segment Index box, a client can be assured of having enough data for continuous playout providing playout begins after @minBufferTime * @bandwidth bits have been received (i.e. at time @minBufferTime after the first bit is received).

If bandwidth is 0, this formula would state that playback can begin after 0 bits are received. This is clearly false, and therefore a bandwidth of 0 is clearly nonsensical.

That said, we can probably still play back in most cases. If the combination of audio and video bandwidth is always non-zero and accurate, adaptation should still work, even if one of the two numbers was zero. And if there is only one combination of audio + video, there are no adaptation choices to be made anyway.

So, in circumstances that either the sum of audio+video bandwidth is still accurate or that there is only one audio+video combination, we can make this work for you.

@joeyparrish joeyparrish added status: bad content Caused by invalid, broken, or unsupported content type: enhancement New feature or request and removed type: bug Something isn't working correctly labels Jul 23, 2017
@joeyparrish joeyparrish marked this as a duplicate of #940 Jul 23, 2017
@joeyparrish joeyparrish self-assigned this Jul 23, 2017
@joeyparrish joeyparrish modified the milestone: v2.3.0 Jul 24, 2017
@joeyparrish joeyparrish modified the milestones: v2.2.0, v2.3.0 Jul 24, 2017
joeyparrish added a commit that referenced this issue Jul 25, 2017
Although bandwidth is a required attribute in DASH and a bandwidth
value of 0 makes no sense, we can tolerate such content in many cases
and play it regardless.  This used to work in v2.0.x, but stopped
working in v2.1.0 through v2.1.5.

Closes #938
Closes #940

Change-Id: I0c9b8eba923971f00946282cd8c138f68827961f
@joeyparrish
Copy link
Member

The work-around has been cherry-picked for v2.1.6.

@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 status: bad content Caused by invalid, broken, or unsupported content type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants