Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add shortcut to reset video capture/encoding #5432

Merged
merged 3 commits into from
Nov 3, 2024
Merged

Add shortcut to reset video capture/encoding #5432

merged 3 commits into from
Nov 3, 2024

Commits on Nov 3, 2024

  1. Handle capture reset via listener

    When the capture source becomes "invalid" (because the display size
    changes for example), a reset request is performed to restart the
    encoder.
    
    The reset state was stored in SurfaceCapture. The capture implementation
    set the flag, and the encoder consumed it.
    
    However, this mechanism did not allow a reset request to _interrupt_ the
    encoder, which may be waiting on a blocking call (until a new frame is
    produced).
    
    To be able to interrupt the encoder, a reset request must not only set a
    flag, but run a callback provided by the encoder. For that purpose,
    introduce the CaptureListener interface, which is notified by the
    SurfaceCapture implementation whenever the capture is invalidated.
    
    For now, the listener implementation just set a flag as before, so the
    behavior is unchanged. It lays the groundwork for the next commits.
    
    PR #5432 <#5432>
    rom1v committed Nov 3, 2024
    Configuration menu
    Copy the full SHA
    69b8369 View commit details
    Browse the repository at this point in the history
  2. Interrupt MediaCodec blocking call on reset

    When the MediaCodec input is a Surface, no EOS (end-of-stream) will
    never occur automatically: it may only be triggered manually by
    MediaCodec.signalEndOfInputStream().
    
    Use this signal to interrupt the blocking call to dequeueOutputBuffer()
    immediately on reset, without waiting for the next frame to be dequeued.
    
    PR #5432 <#5432>
    rom1v committed Nov 3, 2024
    Configuration menu
    Copy the full SHA
    9958302 View commit details
    Browse the repository at this point in the history
  3. Add shortcut to reset video capture/encoding

    Reset video capture/encoding on MOD+Shift+r.
    
    Like on device rotation, this starts a new encoding session which
    produces a video stream starting by a key frame.
    
    PR #5432 <#5432>
    rom1v committed Nov 3, 2024
    Configuration menu
    Copy the full SHA
    104195f View commit details
    Browse the repository at this point in the history