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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2984>
This commit is contained in:
Mathieu Duponchelle 2022-09-06 18:49:02 +02:00 committed by GStreamer Marge Bot
parent 0c96e838e8
commit b454ec972f

View file

@ -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;
}