androidx / media

Jetpack Media3 support libraries for media use cases, including ExoPlayer, an extensible media player for Android
https://developer.android.com/media/media3
Apache License 2.0
1.73k stars 416 forks source link

Do not select embedded metadata tracks by default without their primary track #620

Open arathivanchi opened 1 year ago

arathivanchi commented 1 year ago

Version

Media3 1.1.1

More version details

commit 3f366109b7e5cbf7b7e5b46e8b923e167e9ae893 (HEAD -> p-disabled-renderer-still-fetches-media-hls, tag: 1.1.1, tivo-public/release, origin/release, origin/HEAD, release)

Devices that reproduce the issue

SEI Robotics

Devices that do not reproduce the issue

None

Reproducible in the demo app?

Yes

Reproduction steps

1) Play the Apple HLS test stream, https://devstreaming-cdn.apple.com/videos/streaming/examples/img_bipbop_adv_example_ts/master.m3u8 2) Disable video and subtitles (select "None") in the track selection dialog

Expected result

No video tracks are downloaded once video and subtitles tracks are disabled.

Actual result

Video tracks are downloaded.

Media

HLS > Apple multivariant playlist advanced (TS)

"uri": "https://devstreaming-cdn.apple.com/videos/streaming/examples/img_bipbop_adv_example_ts/master.m3u8"

Bug Report

stevemayhew commented 1 year ago

Looks to me like this is caused by the ID3 track, which has no UI controls to enable/disable it.

Look at the logging added by: https://github.com/TiVo/androidx-media/tree/p-disabled-renderer-still-fetches-media-hls, the video stream is the source for the ID3 track, so it stays enabled:

08-29 11:03:52.220 18341 18543 D HlsMediaPeriod: selection index: 1 groupId: audio:spa-Stereo (ac3) formats: 1 format[0]: id=frumos.tivo.com-multi-audio:spa-Stereo (ac3), mimeType=audio/ac3, codecs=ac-3, channels=2, language=es, label=spa-Stereo (ac3), selectionFlags=[auto,default] selectionChild[]: 1
08-29 11:03:52.220 18341 18543 D HlsMediaPeriod: selection index: 3 groupId: main:id3 formats: 1 format[0]: id=ID3, mimeType=application/id3 selectionChild[]: 0
08-29 11:03:52.221 18341 18543 D HlsMediaPeriod: enabled wrapper 0 wrapper: androidx.media3.exoplayer.hls.HlsSampleStreamWrapper@22ce8ca uid: main chunkSource: androidx.media3.exoplayer.hls.HlsChunkSource@248da3b playlistUrl: .../_video_1800kbps_480p_1_8_Mbps-1.m3u8
08-29 11:03:52.221 18341 18543 D HlsMediaPeriod: enabled wrapper 1 wrapper: androidx.media3.exoplayer.hls.HlsSampleStreamWrapper@251558 uid: audio:spa-Stereo (ac3) chunkSource: androidx.media3.exoplayer.hls.HlsChunkSource@65b16b1 playlistUrl: .../audio_384kbps_2_0_AC3-10.m3u8
08-29 11:03:52.276 18341 18341 D EventLogger: videoDisabled [eventTime=37.89, mediaPos=3580.24, window=0, period=0]
08-29 11:03:52.277 18341 18341 D EventLogger: videoSize [eventTime=37.89, mediaPos=3580.24, window=0, period=0, 0, 0]
08-29 11:03:52.309 18341 18341 D EventLogger: videoDecoderReleased [eventTime=37.92, mediaPos=3580.24, window=0, period=0, OMX.amlogic.avc.decoder.awesome2]
08-29 11:03:52.311 18341 18341 D EventLogger: tracks [eventTime=37.92, mediaPos=3580.33, window=0, period=0
08-29 11:03:52.311 18341 18341 D EventLogger:   group [
08-29 11:03:52.311 18341 18341 D EventLogger:     [ ] Track:0, id=0, mimeType=video/avc, bitrate=2441443, codecs=avc1.64001F, res=720x480, fps=59.94, supported=YES
08-29 11:03:52.311 18341 18341 D EventLogger:     [ ] Track:1, id=1, mimeType=video/avc, bitrate=3728491, codecs=avc1.640020, res=1280x720, fps=59.94, supported=YES
08-29 11:03:52.311 18341 18341 D EventLogger:     [ ] Track:2, id=2, mimeType=video/avc, bitrate=5337696, codecs=avc1.640020, res=1280x720, fps=59.94, supported=YES
08-29 11:03:52.311 18341 18341 D EventLogger:     [ ] Track:3, id=3, mimeType=video/avc, bitrate=1800000, codecs=avc1.64001F, res=720x480, roleFlags=[trick-play], supported=YES
08-29 11:03:52.311 18341 18341 D EventLogger:   ]
08-29 11:03:52.312 18341 18341 D EventLogger:   group [
08-29 11:03:52.312 18341 18341 D EventLogger:     [X] Track:0, id=frumos.tivo.com-multi-audio:spa-Stereo (ac3), mimeType=audio/ac3, codecs=ac-3, channels=2, language=es, label=spa-Stereo (ac3), selectionFlags=[auto,default], supported=YES
08-29 11:03:52.312 18341 18341 D EventLogger:   ]
08-29 11:03:52.312 18341 18341 D EventLogger:   group [
08-29 11:03:52.312 18341 18341 D EventLogger:     [ ] Track:0, id=frumos.tivo.com-multi-audio:eng-Surround (ac3), mimeType=audio/ac3, codecs=ac-3, channels=6, language=en, label=eng-Surround (ac3), supported=YES
08-29 11:03:52.312 18341 18341 D EventLogger:   ]
08-29 11:03:52.312 18341 18341 D EventLogger:   group [
08-29 11:03:52.312 18341 18341 D EventLogger:     [ ] Track:0, id=CC:SERVICE1, mimeType=application/cea-708, label=SERVICE1, supported=YES
08-29 11:03:52.312 18341 18341 D EventLogger:   ]
08-29 11:03:52.312 18341 18341 D EventLogger:   group [
08-29 11:03:52.312 18341 18341 D EventLogger:     [ ] Track:0, id=CC:SERVICE2, mimeType=application/cea-708, label=SERVICE2, supported=YES
08-29 11:03:52.312 18341 18341 D EventLogger:   ]
08-29 11:03:52.312 18341 18341 D EventLogger:   group [
08-29 11:03:52.312 18341 18341 D EventLogger:     [ ] Track:0, id=CC:SERVICE3, mimeType=application/cea-708, label=SERVICE3, supported=YES
08-29 11:03:52.312 18341 18341 D EventLogger:   ]
08-29 11:03:52.312 18341 18341 D EventLogger:   group [
08-29 11:03:52.312 18341 18341 D EventLogger:     [X] Track:0, id=ID3, mimeType=application/id3, supported=YES
08-29 11:03:52.312 18341 18341 D EventLogger:   ]
08-29 11:03:52.312 18341 18341 D EventLogger:   Metadata [
08-29 11:03:52.312 18341 18341 D EventLogger:     HlsTrackMetadataEntry [frumos.tivo.com-multi-audio, spa-Stereo (ac3)]
08-29 11:03:52.312 18341 18341 D EventLogger:   ]
08-29 11:03:52.312 18341 18341 D EventLogger: ]

There was an old issue in ExoPlayer (https://github.com/google/ExoPlayer/issues/2553) for disabling for MP3. @icbaker do you know of hand how to do this for regular MPEG-TS extractor?

tonihei commented 1 year ago

Thanks for reporting. This is very similar to the problem described in https://github.com/androidx/media/issues/294, where the ID3 track was selected from a different adaptation set. The proposed solution for that issue is to mark embedded tracks with their primary track group id. Once this is done, we can also improve the logic for this case to not select embedded metadata tracks when the primary track is not also selected. Happy to accept PRs for the planned changes in #294 or this one if you are in a rush. Otherwise we'll have to see when we get around to it ourselves.