bluetooth/gst: Determine PA input/output caps in generic code

Make the code ever so slightly more generic by not using appsrc and
appsink in codec-specific logic when assigning caps specific to the raw
(PCM) format provided by or returned to PA.

Note that caps have to be set (= event) after starting, can't send
events in flushing state.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/484>
This commit is contained in:
Marijn Suijten 2021-01-21 09:43:16 +01:00
parent db73004a3a
commit da1600eb61
3 changed files with 53 additions and 30 deletions

View file

@ -201,7 +201,6 @@ static uint8_t fill_preferred_configuration(const pa_sample_spec *default_sample
bool gst_init_ldac(struct gst_info *info, pa_sample_spec *ss, bool for_encoding) {
GstElement *rtpldacpay;
GstElement *enc;
GstCaps *caps;
GstPad *pad;
if (!for_encoding) {
@ -264,16 +263,6 @@ bool gst_init_ldac(struct gst_info *info, pa_sample_spec *ss, bool for_encoding)
goto fail;
}
caps = gst_caps_new_simple("audio/x-raw",
"format", G_TYPE_STRING, "S32LE",
"rate", G_TYPE_INT, (int) ss->rate,
"channels", G_TYPE_INT, (int) ss->channels,
"channel-mask", G_TYPE_INT, 0,
"layout", G_TYPE_STRING, "interleaved",
NULL);
g_object_set(info->enc_src, "caps", caps, NULL);
gst_caps_unref(caps);
rtpldacpay = gst_element_factory_make("rtpldacpay", "rtp_ldac_pay");
if (!rtpldacpay) {
pa_log_error("Could not create RTP LDAC payloader element");