Fix DefaultVideoCompositor deadlock during media item transitions #2744
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
each input source
queue is temporarily empty
of waiting for buffering
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