-
Notifications
You must be signed in to change notification settings - Fork 705
Description
Version
Media3 main branch(any version with scrubbingMode)
More version details
Description: When using any Player with setVideoEffects (GL processing) or setVideoSurface() (custom surface) and scrubbing rapidly (calling seekTo frequently), the app crashes with java.util.NoSuchElementException inside ExternalTextureManager.
It appears to be a race condition:
Main Thread calls seekTo, which flushes the internal video buffer.
GL Thread (simultaneously) attempts to process a frame in ExternalTextureManager.
ExternalTextureManager calls pendingFrames.element() or remove() on an empty queue (because it was just flushed) instead of using peek() or checking isEmpty().
Stack Trace:
Caused by: java.util.NoSuchElementException
at java.util.AbstractQueue.element(AbstractQueue.java:136)
at androidx.media3.effect.ExternalTextureManager.maybeQueueFrameToExternalShaderProgram(ExternalTextureManager.java:410)
Request: Please change element()/remove() calls to safe peek()/poll() checks in ExternalTextureManager to handle cases where the queue is flushed concurrently by a seek operation.
Devices that reproduce the issue
Any android device
Devices that do not reproduce the issue
None
Reproducible in the demo app?
Unknown
Reproduction steps
-Load a video and set the surface to a custom BaseGlShaderProgram() class that draws frames
-SetScrubbingModeEnabled(true)
-try seeking every 50-200ms(reasonable)
Expected result
Successful seeks just like without scrubbing mode enabled
Actual result
Player gets stuck and that specific error gets thrown
Media
Not Applicable
Bug Report
- You will email the zip file produced by
adb bugreportto android-media-github@google.com after filing this issue.