bluetooth/gst: Use GStreamer synchronously within PA's IO thread

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.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/494>
This commit is contained in:
Marijn Suijten 2021-01-21 11:25:07 +01:00 committed by Arun Raghavan
parent 62deab21a3
commit 201dc6542b
2 changed files with 71 additions and 127 deletions

View file

@ -43,11 +43,12 @@ struct gst_info {
const a2dp_ldac_t *ldac_config;
} a2dp_codec_t;
GstElement *app_src, *app_sink;
GstElement *pipeline;
/* The appsink element that accumulates encoded/decoded buffers */
GstElement *app_sink;
GstElement *bin;
GstAdapter *sink_adapter;
pa_fdsem *sample_ready_fdsem;
/* The sink pad to push to-be-encoded/decoded buffers into */
GstPad *pad_sink;
uint16_t seq_num;
};