From b454ec972f22dc22905657e1035cebfb3aaea07a Mon Sep 17 00:00:00 2001 From: Mathieu Duponchelle Date: Tue, 6 Sep 2022 18:49:02 +0200 Subject: [PATCH] webrtcbin: fix picking available payload types When picking an available payload type, we need to pick one that is available across all media. The previous code, when multiple media were present, looked at the first one, noticed it had pt 96 as the media pt, then simply looked at the next media, noticed it didn't, and decided 96 was available. Instead, check if the pt is used by any of the media, if it is, decide it is not available and go to the next pt. I'm fairly sure that was the original intent. Part-of: --- subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcbin.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcbin.c b/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcbin.c index b10a4bd..ea33864 100644 --- a/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcbin.c +++ b/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcbin.c @@ -2734,23 +2734,22 @@ _pick_available_pt (GArray * media_mapping, guint * ret) int i; for (i = 96; i <= 127; i++) { + gboolean available = TRUE; int j; for (j = 0; j < media_mapping->len; j++) { struct media_payload_map_item *item; item = &g_array_index (media_mapping, struct media_payload_map_item, j); - if (item->media_pt == i) - continue; - if (item->red_pt == i) - continue; - if (item->rtx_pt == i) - continue; - if (item->ulpfec_pt == i) - continue; - if (item->red_rtx_pt == i) - continue; + if (item->media_pt == i || item->red_pt == i || item->rtx_pt == i + || item->ulpfec_pt == i || item->red_rtx_pt == i) { + available = FALSE; + break; + } + } + + if (available) { *ret = i; return TRUE; } -- 2.7.4