aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Liu <lq@chinaffmpeg.org>2025-06-06 11:02:06 +0800
committerMarvin Scholz <epirat07@gmail.com>2025-06-26 22:20:07 +0200
commitf8a9d9473b0af9e5769a669f5418361d6ac26ad8 (patch)
tree9d330a3e33faf8b35c61299f0c406acfc41df07e
parent87808e38a86ad3980115f97774ab53e781178767 (diff)
downloadffmpeg-f8a9d9473b0af9e5769a669f5418361d6ac26ad8.tar.gz
avformat/whip: check the exchange sdp url is start with http
Make sure the WHIP protocol performs the SDP offer/answer exchange with the WebRTC peer over HTTP. Signed-off-by: Steven Liu <lq@chinaffmpeg.org> Reviewed-by: Jack Lau <jacklau1222@qq.com>
-rw-r--r--libavformat/whip.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libavformat/whip.c b/libavformat/whip.c
index 7936eb1300..5fdbd6949d 100644
--- a/libavformat/whip.c
+++ b/libavformat/whip.c
@@ -732,10 +732,18 @@ static int exchange_sdp(AVFormatContext *s)
URLContext *whip_uc = NULL;
AVDictionary *opts = NULL;
char *hex_data = NULL;
+ const char *proto_name = avio_find_protocol_name(s->url);
/* To prevent a crash during cleanup, always initialize it. */
av_bprint_init(&bp, 1, MAX_SDP_SIZE);
+ if (!av_strstart(proto_name, "http", NULL)) {
+ av_log(whip, AV_LOG_ERROR, "WHIP: Protocol %s is not supported by RTC, choose http, url is %s\n",
+ proto_name, s->url);
+ ret = AVERROR(EINVAL);
+ goto end;
+ }
+
if (!whip->sdp_offer || !strlen(whip->sdp_offer)) {
av_log(whip, AV_LOG_ERROR, "WHIP: No offer to exchange\n");
ret = AVERROR(EINVAL);