69b836930a
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 <https://github.com/Genymobile/scrcpy/pull/5432>