androidx / androidx/media

Invalid NAL Length when adaptation set placement in mpd swaps

Open
#931 0 comments 0 reactions 1 assignee View on GitHub

@rohitjoins is already working on this.

Since Dec 29, 2023.

bug needs triage
Dominant language
Java
Stars
3k
Forks
955
Avg merge
12d 14h
Merged PRs (30d)
2

Description

Version

Media3 1.2.0

More version details

All versions since ExoPlayer 2.12 up to HEAD on main

Devices that reproduce the issue

Every device and emulator

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

Yes

Reproduction steps

In golang, when you iterate over map (associate array), the order in which you iterate changes everytime - this is an implemented feature of golang.

This golang's feature introduced a bug in our dash playlist generator, where sometimes, the order in which Adaptation Sets are written in xml was changing from request to request. Please be aware, that IDs of Adaptation Sets as well as IDs of representations were not changing. Just the order in mpd file.

So for example playlist from time N:

<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 DASH-MPD.xsd" type="dynamic" publishTime="2023-12-29T12:55:04Z" minimumUpdatePeriod="PT5S" availabilityStartTime="2023-12-29T11:24:00Z" minBufferTime="PT2S" timeShiftBufferDepth="PT5466.88S" profiles="urn:mpeg:dash:profile:isoff-live:2011">
  <Period start="PT0S" id="0">
    <AdaptationSet id="0" segmentAlignment="true" lang="pl" contentType="audio">
      <Representation id="0" bandwidth="197450" audioSamplingRate="48000" codecs="mp4a.40.2" mimeType="audio/mp4">
        [...]
      </Representation>
    </AdaptationSet>
    <AdaptationSet id="1" segmentAlignment="true" contentType="video" maxWidth="1920" maxHeight="1080" frameRate="90000/3600" par="16:9">
      <Representation id="1" width="1920" height="1080" sar="1:1" bandwidth="7217069" codecs="avc1.640028" mimeType="video/mp4">
        [...]
      </Representation>
    </AdaptationSet>
  </Period>
</MPD>

and playlist from time N+1:

<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 DASH-MPD.xsd" type="dynamic" publishTime="2023-12-29T12:55:04Z" minimumUpdatePeriod="PT5S" availabilityStartTime="2023-12-29T11:24:00Z" minBufferTime="PT2S" timeShiftBufferDepth="PT5466.88S" profiles="urn:mpeg:dash:profile:isoff-live:2011">
  <Period start="PT0S" id="0">
    <AdaptationSet id="1" segmentAlignment="true" contentType="video" maxWidth="1920" maxHeight="1080" frameRate="90000/3600" par="16:9">
      <Representation id="1" width="1920" height="1080" sar="1:1" bandwidth="7217069" codecs="avc1.640028" mimeType="video/mp4">
        [...]
      </Representation>
    </AdaptationSet>
    <AdaptationSet id="0" segmentAlignment="true" lang="pl" contentType="audio">
      <Representation id="0" bandwidth="197450" audioSamplingRate="48000" codecs="mp4a.40.2" mimeType="audio/mp4">
        [...]
      </Representation>
    </AdaptationSet>
  </Period>
</MPD>

This behaviour causes Invalid NAL length along with overriding unexpected non-sync sample for format warning. As far as I debugged, video instance of SampleQueue was recieving audio sample or vice versa.

Most likely the xml parser has a bug.

BR
Alex

Expected result

Player is correctly assigning SampleQueue to ID of representation

Actual result

ERROR Invalid NAL length due to SampleQueue video instance recieving audio sample.

Media

We can provide (though private channel) URL to our manifest generator if you guys want to fix it.

Bug Report
  • You will email the zip file produced by adb bugreport to android-media-github@google.com after filing this issue.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.