Skip to content

MetadataRenderer sometimes does not render metadata with timestamps aligned with DASH period end in multi period streams #8710

@strangesource

Description

@strangesource

When playing a multi period dash stream where the first period has an EventStream associated that contains an event that is aligned with the period's duration and the next period does not have an EventStream similar to this:

<Period id="0-0-2" start="PT00.000S">
        <BaseURL>...</BaseURL>
        <AdaptationSet id="1" group="1" bitstreamSwitching="true" segmentAlignment="true" contentType="video" mimeType="video/mp4" maxWidth="1920" maxHeight="1080" par="16:9" maxFrameRate="30000/1001" startWithSAP="1">
...
</AdaptionSet>

        <EventStream schemeIdUri="urn:mpeg:dash:event:callback:2015" value="1" timescale="90000">
            <Event presentationTime="3600" duration="90000" id="0" messageData="..."/>
            <Event presentationTime="675000" duration="90000" id="1" messageData="..."/>
            <Event presentationTime="1350000" duration="90000" id="2" messageData="..."/>
            <Event presentationTime="2025000" duration="90000" id="3" messageData="..."/>
            <Event presentationTime="2700000" duration="90000" id="4" messageData="..."/>
        </EventStream>
    </Period>
<Period id="0-0" start="PT30.463S">
....

The event with the id 4 is sometime not surfaced. It is not 100% reliably reproducible with all device, but it does not seem to be device dependent but rather a timing issue. I was e.g. able to reproduce it every time on a Pixel 5 API 29 emulator.

When debugging, the following behaviour can be observed:

On period change in the MetadataRenderer.render function, result is equal to C.RESULT_BUFFER_READ as the stream was set to final (setCurrentStreamFinal) from the maybeUpdateReadingPeriod. This sets inputStreamEnded to false, ultimately disabling the renderer.

At the same time, positionUs is still smaller than the metadata's associated time stamp (and therefore the periods duration), which causes the rendere to not render that metadata.

Tested with ExoPlayer 2.12.0, 2.13.2

  • Android 9 & 10 (but should not matter)
  • OnePlus 5, Pixel 5 Emulator

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions