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

Đang mở
#3,534 0 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 4 ngày

@claincly đang làm issue này rồi.

Từ ngày 10/11/2026.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

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.
Ngôn ngữ chính
Java
Star
3.1k
Fork
1k
Merge trung bình
8 ngày 8 giờ
Pull request đã merge (30 ngày)
4

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của androidx/media

Tất cả issue của androidx/media

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.