Skip to content

WIP: gst-plugin: Add dedicated thread for appsrc_capture

This work-in-progress MR introduces a dedicated thread for pipelining the frame capture and encoding, in the GStreamer plugin.

I will improve object aspect (private methods) later on.

Currently, the framerate speed improvement is around 1.5ms, whereas the capture time is around 4ms. I cannot explain why ...

See this plot for the time measurements of each operation:

  • Capture thread does "Capture -> Pull -> (loop)"
  • Main thread does "Pull -> Send -> (Sleep) -> (loop)"

The pipeline logs look like this (with the timestamp prefix in us) [see this branch for the record() annotations]:

267477 |  Encode.pulling
271170 |            Capture.done
271352 |            Capture.capturing ...
274978 |            Capture.pushing ...
286844 |  Encode.sleeping ...
286972 |  Encode.done
286983 |  Captured frame
286992 |  Frame of 1709 bytes
287048 |  Sent frame

287066 |  Encode.pulling
293740 |            Capture.done
293886 |            Capture.capturing ...
297049 |            Capture.pushing ...
310283 |  Encode.sleeping ...
310401 |  Encode.done
310411 |  Captured frame
310420 |  Frame of 666 bytes
310468 |  Sent frame

310486 |  Encode.pulling
314471 |            Capture.done
314597 |            Capture.capturing ...
317828 |            Capture.pushing ...
334474 |  Encode.sleeping ...
334612 |  Encode.done
334644 |  Captured frame
334655 |  Frame of 1070 bytes
334726 |  Sent frame

Merge request reports