From 5fa3a7186110cf45d44e8884e81e72dcbdd341af Mon Sep 17 00:00:00 2001 From: Paul Kerr Date: Wed, 8 Nov 2023 11:22:02 -0800 Subject: [PATCH 1/2] Test for a rejected or unknown code in subscription offer generation. A codec rejection generated by a publisher offer leaves a null codec in the publisher stream description. Do not add to the sub offer. --- src/plugins/janus_videoroom.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/plugins/janus_videoroom.c b/src/plugins/janus_videoroom.c index a9840e7494..1dbeb3e4c3 100644 --- a/src/plugins/janus_videoroom.c +++ b/src/plugins/janus_videoroom.c @@ -3162,6 +3162,12 @@ static json_t *janus_videoroom_subscriber_offer(janus_videoroom_subscriber *subs } } if(stream->type != JANUS_VIDEOROOM_MEDIA_DATA) { + if((stream->type == JANUS_VIDEOROOM_MEDIA_AUDIO && stream->acodec == JANUS_AUDIOCODEC_NONE) || + (stream->type == JANUS_VIDEOROOM_MEDIA_VIDEO && stream->vcodec == JANUS_VIDEOCODEC_NONE)) { + // Publisher stream codec unsupported or rejected. Do not add to the offer. + temp = temp->next; + continue; + } pt = stream->pt; codec = (stream->type == JANUS_VIDEOROOM_MEDIA_AUDIO ? janus_audiocodec_name(stream->acodec) : janus_videocodec_name(stream->vcodec)); From fdd896fd04bb8783884dd1144e49212d4be46806 Mon Sep 17 00:00:00 2001 From: Paul Kerr Date: Fri, 17 Nov 2023 11:31:23 -0500 Subject: [PATCH 2/2] Incorporate review comment. --- src/plugins/janus_videoroom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/janus_videoroom.c b/src/plugins/janus_videoroom.c index 1dbeb3e4c3..3f6b55ab88 100644 --- a/src/plugins/janus_videoroom.c +++ b/src/plugins/janus_videoroom.c @@ -3164,7 +3164,7 @@ static json_t *janus_videoroom_subscriber_offer(janus_videoroom_subscriber *subs if(stream->type != JANUS_VIDEOROOM_MEDIA_DATA) { if((stream->type == JANUS_VIDEOROOM_MEDIA_AUDIO && stream->acodec == JANUS_AUDIOCODEC_NONE) || (stream->type == JANUS_VIDEOROOM_MEDIA_VIDEO && stream->vcodec == JANUS_VIDEOCODEC_NONE)) { - // Publisher stream codec unsupported or rejected. Do not add to the offer. + /* Publisher stream codec unsupported or rejected. Do not add to the offer. */ temp = temp->next; continue; }