opusdec: Try harder to negotiate the upstream channels/rate preferences
authorSebastian Dröge <sebastian@centricular.com>
Thu, 5 Jan 2023 15:59:41 +0000 (17:59 +0200)
committerSebastian Dröge <sebastian@centricular.com>
Thu, 5 Jan 2023 15:59:41 +0000 (17:59 +0200)
commit37f219bd57ae1bcc1d9c8250990e0da5ab0563d9
tree6c8eb9014c3e1122f3bda446fdba2356a5a9799f
parent516fe4ca584a9d79e8c64a7cbe3c5e713064db77
opusdec: Try harder to negotiate the upstream channels/rate preferences

It might be possible to fulfill those but not with the first caps
structure. Instead of just fixating the first caps structure, check if
the preference can be fulfilled by any of the structures as the first
step.

Without this the following pipeline negotiates to mono after the
decoder because opusenc only has a single channel in its first caps
structure.

    gst-launch-1.0 audiotestsrc ! audio/x-raw,channels=2 ! opusenc \
        ! queue ! opusdec ! queue ! opusenc ! fakesink

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3689>
subprojects/gst-plugins-base/ext/opus/gstopusdec.c