Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when playing SmoothStreaming with subtitles #1779

Open
1 task
marekl-ag opened this issue Oct 4, 2024 · 0 comments
Open
1 task

Error when playing SmoothStreaming with subtitles #1779

marekl-ag opened this issue Oct 4, 2024 · 0 comments

Comments

@marekl-ag
Copy link

Version

Media3 1.4.1

More version details

No response

Devices that reproduce the issue

AndroidTV STB with AndroidTV 12

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

Yes

Reproduction steps

Play SmoothStreaming media with subtitles in demo application.

Problem exists only in case of extraction phase subtitle parsing path - which is now default.
SmoothStreaming media source (DefaultSsChunkSource) uses FragmentedMp4Extractor with non-null sideloadedTrack which seems to be incorrecly handled in FragmentedMp4Extractor.init() which in turn causes subtitles to be decoded by CueDecoder without being first encoded.

Following change causes stream to play correctly:

diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/FragmentedMp4Extractor.java b/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/FragmentedMp4Extractor.java
--- a/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/FragmentedMp4Extractor.java	
+++ b/libraries/extractor/src/main/java/androidx/media3/extractor/mp4/FragmentedMp4Extractor.java	(date 1728030664226)
@@ -417,7 +417,7 @@
     if (sideloadedTrack != null) {
       TrackBundle bundle =
           new TrackBundle(
-              output.track(0, sideloadedTrack.type),
+              extractorOutput.track(0, sideloadedTrack.type),
               new TrackSampleTable(
                   sideloadedTrack,
                   /* offsets= */ new long[0],

Expected result

Media plays with subtitles rendered

Actual result

Playback error with following exception:

  playerFailed [eventTime=1.12, mediaPos=0.00, window=0, period=0, errorCode=ERROR_CODE_FAILED_RUNTIME_CHECK
    androidx.media3.exoplayer.ExoPlaybackException: Unexpected runtime error
      at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:720)
      at android.os.Handler.dispatchMessage(Handler.java:102)
      at android.os.Looper.loopOnce(Looper.java:201)
      at android.os.Looper.loop(Looper.java:288)
      at android.os.HandlerThread.run(HandlerThread.java:67)
    Caused by: java.lang.IllegalStateException: Bad magic number for Bundle: 0x6576206c
      at android.os.BaseBundle.readFromParcelInner(BaseBundle.java:1659)
      at android.os.BaseBundle.<init>(BaseBundle.java:143)
      at android.os.Bundle.<init>(Bundle.java:96)
      at android.os.Parcel.readBundle(Parcel.java:2658)
      at androidx.media3.extractor.text.CueDecoder.decode(CueDecoder.java:63)
      at androidx.media3.exoplayer.text.TextRenderer.readAndDecodeCuesWithTiming(TextRenderer.java:336)
      at androidx.media3.exoplayer.text.TextRenderer.renderFromCuesWithTiming(TextRenderer.java:295)
      at androidx.media3.exoplayer.text.TextRenderer.render(TextRenderer.java:263)
      at androidx.media3.exoplayer.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:1136)
      at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:561)
      at android.os.Handler.dispatchMessage(Handler.java:102)
      at android.os.Looper.loopOnce(Looper.java:201)
      at android.os.Looper.loop(Looper.java:288)
      at android.os.HandlerThread.run(HandlerThread.java:67)

Media

https://demo.unified-streaming.com/k8s/features/stable/video/tears-of-steel/tears-of-steel-multiple-subtitles.ism/Manifest

Bug Report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant