Skip to content

Conversation

AradiPatrik
Copy link
Contributor

When using MultipleInputVideoGraph with sequences containing multiple
media items, the compositor would deadlock when transitioning between
items within a sequence. This prevented other sequences from reaching
their end-of-stream signal, causing the entire composition to freeze.

The root cause was getFramesToComposite() returning an empty list
whenever ANY input source had an empty frame queue. During media item
transitions, the transitioning sequence's queue becomes temporarily
empty while the decoder reinitializes (~200ms). This blocked all
composition, preventing other sequences from compositing their final
frames needed to signal end-of-stream.

This change introduces frame caching to maintain composition continuity:

  • Added lastAvailableFrames cache to store the most recent frame from
    each input source
  • Modified getFramesToComposite() to use cached frames when an input's
    queue is temporarily empty
  • Updated selectSecondaryFrame() to use single available frames instead
    of waiting for buffering
  • Ensured primary frame is only released after being cached

With these changes, composition continues using the last available frame
from transitioning sequences, allowing other sequences to properly reach
end-of-stream while maintaining visual continuity (no black frames).

Fixes: #2742

@AradiPatrik
Copy link
Contributor Author

Here's the manual test result. The sequences transition without deadlock in demo-composition.

test.mov

@tonihei
Copy link
Collaborator

tonihei commented Sep 5, 2025

@ychaparov Could you take a look or reassign as needed?

@ychaparov ychaparov assigned kggibson and unassigned ychaparov Sep 5, 2025
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.

4 participants