[simplify] Make GStreamer encoder/decoder synchronous
Fixes #1115 (closed)
Run GStreamer in PA's IO thread, without extra threads, semaphores and buffer copies.
As outlined in #1115 (closed) synchronization primitives might incur overhead - not to speak of all the extra code/maintenance overhead. As per the commit message:
Handling multiple threads does not come without overhead, especially when the end-goal is to ping-pong them making the whole system run serially. This patch rips out all that thread handling and instead "chains" buffers to be encoded/decoded directly into the pipeline, making them execute their work on the current thread. The resulting buffer can be pulled out from appsink immediately without require extra locking and signalling. While the overhead on modern systems is found to be negligible or unnoticable, code complexity of such locking and signalling systems is prevalent making it the main drive behind this refactor.
Unfortunately it seems GStreamer isn't built to support fully synchronous behaviour; I really want to map output_buffer
as WRITEONLY
in GStreamer and somehow shove that into the src
pad of the transcoder GstBin
before or during pad chaining, but haven't found the right API for that. Is it possible?