[FFmpeg-devel] [PATCH 2/2] avformat/whip: check the exchange sdp url is start with http

Jack Lau jacklau1222gm at gmail.com
Mon Jun 9 06:21:54 EEST 2025



> On Jun 6, 2025, at 11:02, Steven Liu <lq at chinaffmpeg.org> wrote:
> 
> Make sure the WHIP protocol performs the SDP offer/answer
> exchange with the WebRTC peer over HTTP.
> 
> Signed-off-by: Steven Liu <lq at chinaffmpeg.org>
> ---
> libavformat/whip.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
> 
> diff --git a/libavformat/whip.c b/libavformat/whip.c
> index ce06a66bc4..b78ad27858 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);
> -- 
> 2.39.3 (Apple Git-146)
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe”.

patchset LGTM

Thanks
Jack





More information about the ffmpeg-devel mailing list