DefaultFrameDroppingShaderProgram reuses a released previousTexture after end of stream, failing multi-item exports with GL 0x506

Abierto
#3,534 0 comentarios 0 reacciones 1 asignado Ver en GitHub

Los mantenedores suelen responder en 4 días

@claincly ya está trabajando en esto.

Desde el 10/11/2026.

Evaluación

Este issue todavía no se ha evaluado.

Descripción

bug editing
Version

Media3 1.10.1 (also present on main and release at the time of writing)

More version details

media3-effect / media3-transformer 1.10.1

Devices that reproduce the issue

Motorola moto g45 5G (Android 15). The bug is in GL object lifetime, so it should reproduce on any device.

Reproduction steps
  1. Build a Composition with one EditedMediaItemSequence holding two or more EditedMediaItems of the same resolution, e.g. two 90 fps clips.
  2. Add FrameDropEffect.createDefaultFrameDropEffect(30f) to the composition-level video effects (Composition.Builder.setEffects), so it is shared by every item in the sequence.
  3. Export with Transformer.
Expected result

The export completes at ~30 fps.

Actual result

The export fails as soon as the first frame of the second item reaches the effect:

androidx.media3.common.util.GlUtil$GlException: glError: 0x506 (GL_INVALID_FRAMEBUFFER_OPERATION)
  at androidx.media3.effect.DefaultFrameDroppingShaderProgram.copyTextureToPreviousFrame

A single-item export, or an export whose target rate is not below the source rate (so no frames are dropped), succeeds.

Cause

DefaultFrameDroppingShaderProgram.reset(), called from signalEndOfCurrentInputStream() and flush(), releases previousTexture but never sets it to null:

private void reset() {
  try {
    if (previousTexture != null) {
      previousTexture.release();   // GL texture + FBO deleted...
    }
  } ...
  // ...but previousTexture still points at them
}

When the next item registers, DefaultVideoFrameProcessor.registerInputStream calls inputSwitcher.signalEndOfCurrentInputStream(). The effect chain is reused, so the next stream's first frame goes into copyTextureToPreviousFrame. There previousTexture is non-null and the same size, so the code skips re-creating it and calls GlUtil.focusFramebufferUsingCurrentContext(previousTexture.fboId, ...) on the deleted framebuffer, which raises 0x506.

Suggested fix

Set previousTexture = null; after releasing it in reset(), and in release() too for symmetry.

Workaround

A GlEffect whose program extends PassthroughShaderProgram and either forwards the input texture or drops it (getInputListener().onInputFrameProcessed(texture); getInputListener().onReadyToAcceptInputFrame()). It owns no GL objects, so nothing can go stale across streams.

Media

Not attached. The steps above reproduce it with any two clips of the same resolution.

Bug Report
  • You will email the zip file produced by adb bugreport to [email protected] after filing this issue.
Lenguaje dominante
Java
Estrellas
3.1k
Forks
1k
Merge medio
8 d 8 h
PR fusionados (30 d)
4

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de androidx/media

Todos los issues de androidx/media

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.