Commit Graph

4 Commits

Author SHA1 Message Date
Romain Vimont
6a43a68800 Optionally do not delay the first frame
A delay buffer delayed all the frames except the first one, to open the
scrcpy window immediately and get a picture.

Make this feature optional, so that the delay buffer might also be used
for audio.
2023-03-03 01:18:17 +01:00
Romain Vimont
f42a320690 Accept clock estimation with a single point
If there is only one point, assume the slope is 1.
2023-03-03 01:18:17 +01:00
Romain Vimont
711f7b7693 Use delay buffer as a frame source/sink
The components needing delayed frames (sc_screen and sc_v4l2_sink)
managed a sc_video_buffer instance, which itself embedded a
sc_frame_buffer instance (to keep only the most recent frame).

In theory, these components should not be aware of delaying: they should
just receive AVFrames later, and only handle a sc_frame_buffer.

Therefore, refactor sc_delay_buffer as a frame source (it consumes)
frames) and a frame sink (it produces frames, after some delay), and
plug an instance in the pipeline only when a delay is requested.

This also removes the need for a specific sc_video_buffer.
2023-03-03 01:18:17 +01:00
Romain Vimont
3e06105f59 Extract sc_delay_buffer
A video buffer had 2 responsibilities:
 - handle the frame delaying mechanism (queuing packets and pushing them
   after the expected delay);
 - keep only the most recent frame (using a sc_frame_buffer).

In order to reuse only the frame delaying mechanism, extract it to a
separate component, sc_delay_buffer.
2023-03-03 01:18:17 +01:00