Skip to content

Different role flags combined in one TrackGroup #2148

Closed

Description

@git1904

Hello
I have this Question to make for some time now about this error playing an MPD

``

java.lang.IllegalStateException: Different role flags combined in one TrackGroup: '0' (track 0) and '100000000000010' (track 1)
at androidx.media3.common.TrackGroup.logErrorMessage(TrackGroup.java:233)
at androidx.media3.common.TrackGroup.verifyCorrectness(TrackGroup.java:208)
at androidx.media3.common.TrackGroup.(TrackGroup.java:96)
at androidx.media3.exoplayer.dash.DashMediaPeriod.buildPrimaryAndEmbeddedTrackGroupInfos(DashMediaPeriod.java:708)
at androidx.media3.exoplayer.dash.DashMediaPeriod.buildTrackGroups(DashMediaPeriod.java:529)
at androidx.media3.exoplayer.dash.DashMediaPeriod.(DashMediaPeriod.java:160)
at androidx.media3.exoplayer.dash.DashMediaSource.createPeriod(DashMediaSource.java:580)
at androidx.media3.exoplayer.source.MaskingMediaPeriod.createPeriod(MaskingMediaPeriod.java:131)
at androidx.media3.exoplayer.source.MaskingMediaSource.onChildSourceInfoRefreshed(MaskingMediaSource.java:214)
at androidx.media3.exoplayer.source.WrappingMediaSource.onChildSourceInfoRefreshed(WrappingMediaSource.java:154)
at androidx.media3.exoplayer.source.WrappingMediaSource.onChildSourceInfoRefreshed(WrappingMediaSource.java:49)
at androidx.media3.exoplayer.source.CompositeMediaSource.lambda$prepareChildSource$0$androidx-media3-exoplayer-source-CompositeMediaSource(CompositeMediaSource.java:117)
at androidx.media3.exoplayer.source.CompositeMediaSource$$ExternalSyntheticLambda0.onSourceInfoRefreshed(D8$$SyntheticClass:0)
at androidx.media3.exoplayer.source.BaseMediaSource.refreshSourceInfo(BaseMediaSource.java:90)
at androidx.media3.exoplayer.dash.DashMediaSource.processManifest(DashMediaSource.java:937)
at androidx.media3.exoplayer.dash.DashMediaSource.onUtcTimestampResolved(DashMediaSource.java:864)
at androidx.media3.exoplayer.dash.DashMediaSource.access$500(DashMediaSource.java:99)
at androidx.media3.exoplayer.dash.DashMediaSource$1.onInitialized(DashMediaSource.java:852)
at androidx.media3.exoplayer.util.SntpClient$NtpTimeCallback.onLoadCompleted(SntpClient.java:325)
at androidx.media3.exoplayer.upstream.Loader$LoadTask.handleMessage(Loader.java:487)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.os.HandlerThread.run(HandlerThread.java:67)

The MPD xml have the following AdaptationSets, Representations and Roles ( removed some xml to make it better readable it contains DRM )

<MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:cenc="urn:mpeg:cenc:2013"
    xmlns:mspr="urn:microsoft:playready"
    profiles="urn:mpeg:dash:profile:isoff-live:2011"
    type="dynamic"
    availabilityStartTime="1970-01-01T00:00:00Z"
    publishTime="2025-02-15T01:56:56Z"
    timeShiftBufferDepth="PT20S"
    minimumUpdatePeriod="PT2S"
    maxSegmentDuration="PT2.006S"
    minBufferTime="PT6S">
    <Period id="1" start="PT0S">
        <AdaptationSet id="1" group="1" bitstreamSwitching="true" segmentAlignment="true" contentType="video" mimeType="video/mp4" maxWidth="1280" maxHeight="720" par="16:9" maxFrameRate="50" startWithSAP="1">
            <SegmentTemplate timescale="10000000" media="S!d2EPREFTSF9BVkNfRlVMTEhEEgJU.v...wEWBJ8_/QualityLevels($Bandwidth$)/Fragments(video=$Time$)">
                <SegmentTimeline>
                    <S t="17395845890304560" d="20000000" r="9"/>
                </SegmentTimeline>
            </SegmentTemplate>
            <Representation id="dzEUrgef" bandwidth="503316" codecs="avc1.4d4029" width="384" height="216" frameRate="25" sar="1:1"/>
            <Representation id="dzF6FA6f" bandwidth="922746" codecs="avc1.4d4029" width="640" height="360" frameRate="25" sar="1:1"/>
            <Representation id="dzHhehif" bandwidth="1604321" codecs="avc1.4d4029" width="704" height="396" frameRate="25" sar="1:1"/>
            <Representation id="dzEAADCf" bandwidth="3145728" codecs="avc1.640029" width="1280" height="720" frameRate="50" sar="1:1"/>
        </AdaptationSet>
        <AdaptationSet id="2" group="32" bitstreamSwitching="true" segmentAlignment="true" contentType="video" mimeType="video/mp4" maxWidth="1280" maxHeight="720" par="16:9" maxFrameRate="50" startWithSAP="1" codingDependency="false">
            <EssentialProperty schemeIdUri="http://dashif.org/guidelines/trickmode" value="1"/>
            <Role schemeIdUri="urn:mpeg:dash:role:2011" value="alternate"/>
            <SegmentTemplate timescale="10000000" media="S!d2EPREFTSF9BVkNfRlVMTEhEEgJU.v...wEWBJ8_/QualityLevels($Bandwidth$)/Fragments(trickmode=$Time$)">
                <SegmentTimeline>
                    <S t="17395845890304560" d="20000000" r="9"/>
                </SegmentTimeline>
            </SegmentTemplate>
            <Representation id="trickmodedzEUrgef" bandwidth="503316" codecs="avc1.4d4029" width="384" height="216" frameRate="1" sar="1:1" maxPlayoutRate="25"/>
            <Representation id="trickmodedzF6FA6f" bandwidth="922746" codecs="avc1.4d4029" width="640" height="360" frameRate="1" sar="1:1" maxPlayoutRate="25"/>
            <Representation id="trickmodedzHhehif" bandwidth="1604321" codecs="avc1.4d4029" width="704" height="396" frameRate="1" sar="1:1" maxPlayoutRate="25"/>
            <Representation id="trickmodedzEAADCf" bandwidth="3145728" codecs="avc1.640029" width="1280" height="720" frameRate="1" sar="1:1" maxPlayoutRate="50"/>
        </AdaptationSet>
        <AdaptationSet id="3" group="2" bitstreamSwitching="true" segmentAlignment="true" contentType="audio" mimeType="audio/mp4" lang="por">
            <AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
            <Role schemeIdUri="urn:mpeg:dash:role:2011" value="main"/>
            <SegmentTemplate timescale="48000" media="S!d2EPREFTSF9BVkNfRlVMTEhEEgJU.v...wEWBJ8_/QualityLevels($Bandwidth$)/Fragments(audio_482_por=$Time$)">
                <SegmentTimeline>
                    <S t="83500060274012" d="96256"/>
                    <S d="95232"/>
                    <S d="96256" r="2"/>
                    <S d="95232"/>
                    <S d="96256" r="2"/>
                    <S d="95232"/>
                </SegmentTimeline>
            </SegmentTemplate>
            <Representation id="dyHiAZ8." bandwidth="96000" codecs="mp4a.40.2" audioSamplingRate="48000"/>
        </AdaptationSet>
        <AdaptationSet id="4" group="2" bitstreamSwitching="true" segmentAlignment="true" contentType="audio" mimeType="audio/mp4" lang="AUD">
            <AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
            <Role schemeIdUri="urn:mpeg:dash:role:2011" value="alternate"/>
            <SegmentTemplate timescale="48000" media="S!d2EPREFTSF9BVkNfRlVMTEhEEgJU.v...wEWBJ8_/QualityLevels($Bandwidth$)/Fragments(audio_483_AUD=$Time$)">
                <SegmentTimeline>
                    <S t="83500060274012" d="96256"/>
                    <S d="95232"/>
                    <S d="96256" r="2"/>
                    <S d="95232"/>
                    <S d="96256" r="2"/>
                    <S d="95232"/>
                </SegmentTimeline>
            </SegmentTemplate>
            <Representation id="dyHjAZ8." bandwidth="96000" codecs="mp4a.40.2" audioSamplingRate="48000"/>
        </AdaptationSet>
        <AdaptationSet id="5" group="8" bitstreamSwitching="true" segmentAlignment="true" contentType="text" mimeType="application/mp4" lang="887">
            <Role schemeIdUri="urn:mpeg:dash:role:2011" value="alternate"/>
            <SegmentTemplate timescale="10000000" media="S!d2EPREFTSF9BVkNfRlVMTEhEEgJU.v...wEWBJ8_/QualityLevels($Bandwidth$)/Fragments(887_0=$Time$)">
                <SegmentTimeline>
                    <S t="17395845890304560" d="20000000" r="9"/>
                </SegmentTimeline>
            </SegmentTemplate>
            <Representation id="dxFknw.." bandwidth="100" codecs="stpp"/>
        </AdaptationSet>
        <AdaptationSet id="6" group="8" bitstreamSwitching="true" segmentAlignment="true" contentType="text" mimeType="application/mp4" lang="885">
            <Role schemeIdUri="urn:mpeg:dash:role:2011" value="alternate"/>
            <SegmentTemplate timescale="10000000" media="S!d2EPREFTSF9BVkNfRlVMTEhEEgJU.v...wEWBJ8_/QualityLevels($Bandwidth$)/Fragments(885_1=$Time$)">
                <SegmentTimeline>
                    <S t="17395845890304560" d="20000000" r="9"/>
                </SegmentTimeline>
            </SegmentTemplate>
            <Representation id="dxFlnw.." bandwidth="101" codecs="stpp"/>
        </AdaptationSet>
    </Period>
</MPD>

I don't understand exactly what the error means and if this can be "ignored"
I did search before come here and didnt find anything related to this, i saw that the expection is not throwing error it just print the error but the video is not playing.
I know that editing the mpd on-fly works by creating a custom datasource to remove the <Role tags... but is that the only way? :(

Activity

  1. tonihei commented on Feb 21, 2025

    @tonihei
    Collaborator

    This error is only logged to logcat and should not prevent playback. Can you confirm this doesn't prevent playback?

    Otherwise, the error is telling you that the AdaptationSets with id 1 and 2 are marked as the same content (by the trickmode EssentialProperty linking to the set with id=1), but they have different roles defined (the representations in the set with id=1 have no role, but the ones in the set with id=2 have the role "alternate"). This may cause issues during track selection because a single group that is meant to represent the same content no longer has a clear role definition.

  2. self-assigned this
    on Feb 21, 2025
  3. tonihei commented on Jun 30, 2025

    @tonihei
    Collaborator

    Submitted a change that avoids putting these two tracks in the same TrackGroup

  4. locked and limited conversation to collaborators on Aug 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions