这是indexloc提供的服务,不要输入任何密码
Skip to content

Decoder freezes on quality switch when playing HLS LL stream #2299

@strangesource

Description

@strangesource

Version

Media3 main branch

More version details

main, Tested with different versions, seems to be unrelated

Devices that reproduce the issue

Seems to be device unrelated. Can be reproduced on Android 14 emulator, Pixel 7a with Android 15 and other devices.
Emulators seem to reproduce the issue faster than physical devices though.

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

Yes

Reproduction steps

  1. modify AdaptiveTrackSelection to switch qualities often, e.g. by doing
Index: libraries/exoplayer/src/main/java/androidx/media3/exoplayer/trackselection/AdaptiveTrackSelection.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/trackselection/AdaptiveTrackSelection.java b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/trackselection/AdaptiveTrackSelection.java
--- a/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/trackselection/AdaptiveTrackSelection.java	(revision 10fd1ee2704e2e8b669ae0c3120cf37b62291759)
+++ b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/trackselection/AdaptiveTrackSelection.java	(date 1743068827615)
@@ -482,7 +482,15 @@
     reason =
         newSelectedIndex == previousSelectedIndex ? previousReason : C.SELECTION_REASON_ADAPTIVE;
     selectedIndex = newSelectedIndex;
+
+    if(lastCalledTimeStamp + 5_000 < System.currentTimeMillis()){
+      selectedIndex = 0;
+      lastCalledTimeStamp = System.currentTimeMillis();
+    }else {
+      selectedIndex = 1;
+    }
   }
+  private long lastCalledTimeStamp = System.currentTimeMillis();
   @Override
   public int getSelectedIndex() {
  1. play media shared via e-mail e.g. on android emulator Pixel 8 Pro Android 14
  2. observe freeze, usually within ~1 minute

Expected result

No freeze on quality switch OR freeze is reported as player error to enable recovery.

Actual result

After a quality switch the video frame freezes while audio and the playhead continue. This happens regardless of the quality being switched from/to.

  • after the freeze MediaCodedAdapter.dequeueInputBufferIndex always returns -1 indicating that the decoder is stuck
  • overwriting the decoder reuse evaluation on quality switch to REUSE_RESULT_NO fixes the problem but drops frames on every quality change reducing the overall quality of experience

Media

Will be send via e-mail

Bug Report

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions