Skip to content

External SubRip subtitles are loaded multiple times during playback #2556

Open
@akavrt

Description

@akavrt

After upgrading from pre-1.4.0 to the latest 1.7.1 version of the Media3 library I found that external SubRip subtitles are loaded multiple times during playback. Basically every position discontinuity caused by a seek results in subtitles being reloaded through the corresponding network request.

As I understand this change in behaviour is related to revamped subtitle pipeline as there was no such problem in pre-1.4.0 version of the library. So the question is whether it's an intended behaviour or a bug?

To reproduce this problem I implemented onLoadStarted() and onLoadCompleted() methods in the existing EventLogger and used BBC's publicly available DASH test stream accompanied with external SubRip subtitles:

adb shell am start -a androidx.media3.demo.main.action.VIEW \
    -d https://rdmedia.bbc.co.uk/bbb/2/client_manifest-common_init.mpd \
    --es subtitle_uri https://raw.githubusercontent.com/demuxed/big-buck-captions/refs/heads/main/big-buck-bunny.srt \
    --es subtitle_mime_type application/x-subrip

Logcat output filtered with tag:eventlogger (positionDiscontinuity | srt):

15:56:52.961 EventLogger              D  loadStarted [eventTime=0.63, mediaPos=0.00, window=0, period=0, uri = https://raw.githubusercontent.com/demuxed/big-buck-captions/refs/heads/main/big-buck-bunny.srt]
15:56:53.644 EventLogger              D  loadCompleted [eventTime=1.31, mediaPos=0.11, window=0, period=0, uri = https://raw.githubusercontent.com/demuxed/big-buck-captions/refs/heads/main/big-buck-bunny.srt]
15:56:57.533 EventLogger              D  positionDiscontinuity [eventTime=5.20, mediaPos=139.82, window=0, period=0, reason=SEEK, PositionInfo:old [mediaItem=0, period=0, pos=3975], PositionInfo:new [mediaItem=0, period=0, pos=139820]]
15:56:57.553 EventLogger              D  loadStarted [eventTime=5.22, mediaPos=139.82, window=0, period=0, uri = https://raw.githubusercontent.com/demuxed/big-buck-captions/refs/heads/main/big-buck-bunny.srt]
15:56:57.754 EventLogger              D  loadCompleted [eventTime=5.42, mediaPos=139.82, window=0, period=0, uri = https://raw.githubusercontent.com/demuxed/big-buck-captions/refs/heads/main/big-buck-bunny.srt]
15:56:59.824 EventLogger              D  positionDiscontinuity [eventTime=7.49, mediaPos=293.71, window=0, period=0, reason=SEEK, PositionInfo:old [mediaItem=0, period=0, pos=140852], PositionInfo:new [mediaItem=0, period=0, pos=293706]]
15:56:59.846 EventLogger              D  loadStarted [eventTime=7.52, mediaPos=293.71, window=0, period=0, uri = https://raw.githubusercontent.com/demuxed/big-buck-captions/refs/heads/main/big-buck-bunny.srt]
15:56:59.903 EventLogger              D  loadCompleted [eventTime=7.57, mediaPos=293.71, window=0, period=0, uri = https://raw.githubusercontent.com/demuxed/big-buck-captions/refs/heads/main/big-buck-bunny.srt]
15:57:01.723 EventLogger              D  positionDiscontinuity [eventTime=9.39, mediaPos=404.98, window=0, period=0, reason=SEEK, PositionInfo:old [mediaItem=0, period=0, pos=295009], PositionInfo:new [mediaItem=0, period=0, pos=404983]]
15:57:01.748 EventLogger              D  loadStarted [eventTime=9.42, mediaPos=404.98, window=0, period=0, uri = https://raw.githubusercontent.com/demuxed/big-buck-captions/refs/heads/main/big-buck-bunny.srt]
15:57:01.788 EventLogger              D  loadCompleted [eventTime=9.46, mediaPos=404.98, window=0, period=0, uri = https://raw.githubusercontent.com/demuxed/big-buck-captions/refs/heads/main/big-buck-bunny.srt]
15:57:06.346 EventLogger              D  positionDiscontinuity [eventTime=14.02, mediaPos=495.99, window=0, period=0, reason=SEEK, PositionInfo:old [mediaItem=0, period=0, pos=408502], PositionInfo:new [mediaItem=0, period=0, pos=495990]]
15:57:06.368 EventLogger              D  loadStarted [eventTime=14.04, mediaPos=495.99, window=0, period=0, uri = https://raw.githubusercontent.com/demuxed/big-buck-captions/refs/heads/main/big-buck-bunny.srt]
15:57:06.406 EventLogger              D  loadCompleted [eventTime=14.08, mediaPos=495.99, window=0, period=0, uri = https://raw.githubusercontent.com/demuxed/big-buck-captions/refs/heads/main/big-buck-bunny.srt]
15:57:09.388 EventLogger              D  positionDiscontinuity [eventTime=17.06, mediaPos=83.15, window=0, period=0, reason=SEEK, PositionInfo:old [mediaItem=0, period=0, pos=498407], PositionInfo:new [mediaItem=0, period=0, pos=83147]]
15:57:09.415 EventLogger              D  loadStarted [eventTime=17.08, mediaPos=83.15, window=0, period=0, uri = https://raw.githubusercontent.com/demuxed/big-buck-captions/refs/heads/main/big-buck-bunny.srt]
15:57:09.501 EventLogger              D  loadCompleted [eventTime=17.17, mediaPos=83.15, window=0, period=0, uri = https://raw.githubusercontent.com/demuxed/big-buck-captions/refs/heads/main/big-buck-bunny.srt]

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions