Skip to content

Conversation

@lucas-viva
Copy link
Contributor

@lucas-viva lucas-viva commented Jun 28, 2025

When a video is played and the fbo size changes, fbo is recreated.

The field frame is set to null and after the first update() call, it is initialized with the fbo texture.

If update is called before fbo is re-initialized, frame will get the old fbo texture and it will result into a black screen video.

Proposed approach:

Check the frame against the current fbo texture instead of just checking if it is null.

First approach I had:

Remove the frame field, because we can get the texture directly from fbo and thus fixes the issue (and makes the code less brittle because we don't need to keep updating the frame field anymore). This solution has a caveat that until the first frame is available, the rendered texture will be black.

@SimonIT SimonIT requested a review from Copilot July 10, 2025 08:00
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Fixes a black video rendering issue when the FBO size changes by updating how the frame texture is tracked.

  • Replaced the null-check on frame with an identity comparison against fbo.getColorBufferTexture().
  • Ensures the filter is reset whenever a new texture instance is detected.
Comments suppressed due to low confidence (4)

gdx-video-android/src/com/badlogic/gdx/video/VideoPlayerAndroid.java:283

  • [nitpick] Add a brief comment explaining why we're comparing by object identity here (to detect FBO texture recreation) so future maintainers understand the rationale.
		if (frame != fbo.getColorBufferTexture()) {

gdx-video-android/src/com/badlogic/gdx/video/VideoPlayerAndroid.java:283

  • [nitpick] The variable name frame is somewhat ambiguous; consider renaming it to something like currentFrameTexture to clarify its purpose.
		if (frame != fbo.getColorBufferTexture()) {

gdx-video-android/src/com/badlogic/gdx/video/VideoPlayerAndroid.java:279

  • Consider adding a test case that simulates an FBO size change to ensure that the frame texture is updated correctly and the video no longer appears black.
		renderer.vertex(1, 1, 0);

@SimonIT SimonIT merged commit 101fa39 into libgdx:master Jul 14, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants