You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02:00
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>
This commit is contained in:
committed by
Marvin Scholz
parent
87808e38a8
commit
f8a9d9473b
@ -732,10 +732,18 @@ static int exchange_sdp(AVFormatContext *s)
|
|||||||
URLContext *whip_uc = NULL;
|
URLContext *whip_uc = NULL;
|
||||||
AVDictionary *opts = NULL;
|
AVDictionary *opts = NULL;
|
||||||
char *hex_data = NULL;
|
char *hex_data = NULL;
|
||||||
|
const char *proto_name = avio_find_protocol_name(s->url);
|
||||||
|
|
||||||
/* To prevent a crash during cleanup, always initialize it. */
|
/* To prevent a crash during cleanup, always initialize it. */
|
||||||
av_bprint_init(&bp, 1, MAX_SDP_SIZE);
|
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)) {
|
if (!whip->sdp_offer || !strlen(whip->sdp_offer)) {
|
||||||
av_log(whip, AV_LOG_ERROR, "WHIP: No offer to exchange\n");
|
av_log(whip, AV_LOG_ERROR, "WHIP: No offer to exchange\n");
|
||||||
ret = AVERROR(EINVAL);
|
ret = AVERROR(EINVAL);
|
||||||
|
Reference in New Issue
Block a user