From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 6D6FB4005D for ; Thu, 18 Sep 2025 01:38:11 +0000 (UTC) Authentication-Results: ffbox; dkim=fail (body hash mismatch (got b'+TTnrzkHjN0zQbSxdIO6nksGOTCMoFfydTHGx8BxgqE=', expected b'vFErgS0yxVn4kCJqYQF0E3opkpooOBrshzEgfk7xB8A=')) header.d=ffmpeg.org header.i=@ffmpeg.org header.a=rsa-sha256 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1758159470; h=mime-version : to : date : message-id : reply-to : subject : list-id : list-archive : list-archive : list-help : list-owner : list-post : list-subscribe : list-unsubscribe : from : cc : content-type : content-transfer-encoding : from; bh=+TTnrzkHjN0zQbSxdIO6nksGOTCMoFfydTHGx8BxgqE=; b=O775SoFsuaVFHW+TqtvaD5xIcGDvYtlWdhLnrD+3w/wO4LXobBxuFcnIYb+qxGu9aqmMw Xf59tidr0Zo3DSLtb5iYbHyXPmDvimk7fLgbjZLDd8wIOcRkpQrmWJ/Zf92kWVoh3h3BBIK 31X1XKN07JmJ60EkYdyZA2b/KYlKpi6bl8B4TxnIelm5ljLuFNDHbyPFuIWHqSeJQuQJn0K pKXnX4ITc948jjSz3i3W1fMrBr+JA1gU8HOuL7PjSoMDJWj91KJjzsaNzoGSZ/VBBHGVPkv ULT8o5HCzDmhUNJXsEcjsdsnmSY61hEyAVlWVEj4/GuotcOyb+Qp4/1nQC9g== Received: from [172.19.0.4] (unknown [172.19.0.4]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 7A77368E820; Thu, 18 Sep 2025 04:37:50 +0300 (EEST) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=ffmpeg.org; s=arc; t=1758159468; b=PxQj9tTtnfwkYeHw2cacriaMxlETn16YkZC2m5z5DLSixupQFaO9UjR9TgOTFYNnRERrN LywYuGzE2H7np87VMG+urRLAm3D8Q0v1rON/CJIIKHG0UJQyONK0FWKBS2zmGegPNy0lkqw GRNHocLkCMi2UbKBKpaFVJQGAMqwAQ/cnvRDuhpy1MS4s9bprY0Mps52I7wI3yo6Fctggyu FwybgLuvJPLv2WPjxkurqKm4FHLM1v0z9H4QOdvUC9XrNeb3n7tHKTWG5YIEEQnvttqbI5p UyaSYRfosuYfJ4WRXrPm4rIxpSKl9w1m/GcwY7rTdFEtz10hCY3SPAXhgcrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=ffmpeg.org; s=arc; t=1758159468; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=dfYQFptFpfYklexL8mpI+2s4drY9RDmKSaeVPG3pFWg=; b=lI4VR9B2T4JpAwjQZdnZzr5AKsfHWFaVAd1ti9YzWzs9YEDyVq7S7HT0VTX/K6k7Igx+I JNVskKuf/TGpQ3bMhsCFvcuEF1DpeuBezGTcc/8hTvPaciuBx9flWrdwDfyEzjhrDw6/Nxy CzwdQww0N61W0kMEGfllgod90YIAo/IlzCBeHSlMAaCFjAwA/foI4gJDt2VofIloIFWaQ8I CfwdHn+4vcV4uAlC3pN2pksze1qwAN6C6/BZ4/Iahaq96/snZ5WQ+d1iEEjTv1lOljD+ghP vi6wTF2O00/Gjfo38QIEPNJ4stB7CwT7T8F5isjM3tGWZq2EsZBP+eNIZbRg== ARC-Authentication-Results: i=1; ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none; dmarc=none Authentication-Results: ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none (Message is not ARC signed); dmarc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1758159455; h=content-type : mime-version : content-transfer-encoding : from : to : reply-to : subject : date : from; bh=vFErgS0yxVn4kCJqYQF0E3opkpooOBrshzEgfk7xB8A=; b=nUZchHQ5tNGRtBn66mNklcpUKkuVee7bCB09S1dt7zxYprx4zI4BNkHEPaCUJu1OYhlME YFeZpqJtuJ2Om+FeyuDJ8625xjUJgbTrcoAxLKTK+nSjlhxO/bivDB0h2BgU3n3gNQshmP+ tb1oklb9KqP1rhbukGMCF1zkzj/lX9Zrqgf/6OLLEzbiRo0D5c/i9BJhH/e5p8S3zmRMbZr VE44j1je5/T62pRWeKnpHmMtxbzlLAlMWwlNgT2NwLoAV5qX3+ZBe7KsuY1B6LO3LX8yO+l DUcV3myA9RHW5350Id1tOJk9zJJHD7UIJDUuRrJ8pR58yzw0vA/e2sVfx00w== Received: from ed19c606a818 (code.ffmpeg.org [188.245.149.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 8DBCB68E73E for ; Thu, 18 Sep 2025 04:37:35 +0300 (EEST) MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Date: Thu, 18 Sep 2025 01:37:35 -0000 Message-ID: <175815945585.25.6716196539207711920@463a07221176> Message-ID-Hash: SWTCLKUYZ6REEKKLKT4WHNMKJOT5P3FD X-Message-ID-Hash: SWTCLKUYZ6REEKKLKT4WHNMKJOT5P3FD X-MailFrom: code@ffmpeg.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-ffmpeg-devel.ffmpeg.org-0; header-match-ffmpeg-devel.ffmpeg.org-1; header-match-ffmpeg-devel.ffmpeg.org-2; header-match-ffmpeg-devel.ffmpeg.org-3; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list Reply-To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PATCH] avformat/whip: add RTX initial support (PR #20544) List-Id: FFmpeg development discussions and patches Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Jack Lau via ffmpeg-devel Cc: Jack Lau Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Archived-At: List-Archive: List-Post: PR #20544 opened by Jack Lau (JackLau) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20544 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20544.patch Refer to RFC 4588. Add and set the basic param of RTX like ssrc, payload_type, srtp. Modify the SDP to add RTX info so that the peer be able to parse the RTX packet. There are more pateches to make RTX really work. Signed-off-by: Jack Lau >>From 3c0be07aa6eb29d135401b14b58c1d1baee33b4f Mon Sep 17 00:00:00 2001 From: Jack Lau Date: Thu, 18 Sep 2025 09:23:31 +0800 Subject: [PATCH] avformat/whip: add RTX initial support Refer to RFC 4588. Add and set the basic param of RTX like ssrc, payload_type, srtp. Modify the SDP to add RTX info so that the peer be able to parse the RTX packet. There are more pateches to make RTX really work. Signed-off-by: Jack Lau --- libavformat/whip.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/libavformat/whip.c b/libavformat/whip.c index cfdc861c5b..472c6dbf16 100644 --- a/libavformat/whip.c +++ b/libavformat/whip.c @@ -122,6 +122,7 @@ /* Referring to Chrome's definition of RTP payload types. */ #define WHIP_RTP_PAYLOAD_TYPE_H264 106 #define WHIP_RTP_PAYLOAD_TYPE_OPUS 111 +#define WHIP_RTP_PAYLOAD_TYPE_VIDEO_RTX 105 /** * The STUN message header, which is 20 bytes long, comprises the @@ -229,12 +230,14 @@ typedef struct WHIPContext { /* The SSRC of the audio and video stream, generated by the muxer. */ uint32_t audio_ssrc; uint32_t video_ssrc; + uint32_t video_rtx_ssrc; uint16_t audio_first_seq; uint16_t video_first_seq; /* The PT(Payload Type) of stream, generated by the muxer. */ uint8_t audio_payload_type; uint8_t video_payload_type; + uint8_t video_rtx_payload_type; /** * This is the SDP offer generated by the muxer based on the codec parameters, * DTLS, and ICE information. @@ -290,6 +293,7 @@ typedef struct WHIPContext { /* The SRTP send context, to encrypt outgoing packets. */ SRTPContext srtp_audio_send; SRTPContext srtp_video_send; + SRTPContext srtp_video_rtx_send; SRTPContext srtp_rtcp_send; /* The SRTP receive context, to decrypt incoming packets. */ SRTPContext srtp_recv; @@ -602,9 +606,11 @@ static int generate_sdp_offer(AVFormatContext *s) whip->audio_ssrc = av_lfg_get(&whip->rnd); whip->video_ssrc = whip->audio_ssrc + 1; + whip->video_rtx_ssrc = whip->video_ssrc + 1; whip->audio_payload_type = WHIP_RTP_PAYLOAD_TYPE_OPUS; whip->video_payload_type = WHIP_RTP_PAYLOAD_TYPE_H264; + whip->video_rtx_payload_type = WHIP_RTP_PAYLOAD_TYPE_VIDEO_RTX; av_bprintf(&bp, "" "v=0\r\n" @@ -657,7 +663,7 @@ static int generate_sdp_offer(AVFormatContext *s) } av_bprintf(&bp, "" - "m=video 9 UDP/TLS/RTP/SAVPF %u\r\n" + "m=video 9 UDP/TLS/RTP/SAVPF %u %u\r\n" "c=IN IP4 0.0.0.0\r\n" "a=ice-ufrag:%s\r\n" "a=ice-pwd:%s\r\n" @@ -671,9 +677,13 @@ static int generate_sdp_offer(AVFormatContext *s) "a=rtpmap:%u %s/90000\r\n" "a=fmtp:%u level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=%02x%02x%02x\r\n" "a=rtcp-fb%u nack\r\n" + "a=rtpmap:%u rtx/90000\r\n" + "a=fmtp:%u apt=%u\r\n" + "a=ssrc-group:FID %u %u\r\n" "a=ssrc:%u cname:FFmpeg\r\n" "a=ssrc:%u msid:FFmpeg video\r\n", whip->video_payload_type, + whip->video_rtx_payload_type, whip->ice_ufrag_local, whip->ice_pwd_local, whip->dtls_fingerprint, @@ -684,6 +694,11 @@ static int generate_sdp_offer(AVFormatContext *s) profile_iop, level, whip->video_payload_type, + whip->video_rtx_payload_type, + whip->video_rtx_payload_type, + whip->video_payload_type, + whip->video_ssrc, + whip->video_rtx_ssrc, whip->video_ssrc, whip->video_ssrc); } @@ -1408,6 +1423,12 @@ static int setup_srtp(AVFormatContext *s) goto end; } + ret = ff_srtp_set_crypto(&whip->srtp_video_rtx_send, suite, buf); + if (ret < 0) { + av_log(whip, AV_LOG_ERROR, "Failed to set crypto for video rtx send\n"); + goto end; + } + ret = ff_srtp_set_crypto(&whip->srtp_rtcp_send, suite, buf); if (ret < 0) { av_log(whip, AV_LOG_ERROR, "Failed to set crypto for rtcp send\n"); @@ -1924,6 +1945,7 @@ static av_cold void whip_deinit(AVFormatContext *s) av_freep(&whip->key_file); ff_srtp_free(&whip->srtp_audio_send); ff_srtp_free(&whip->srtp_video_send); + ff_srtp_free(&whip->srtp_video_rtx_send); ff_srtp_free(&whip->srtp_rtcp_send); ff_srtp_free(&whip->srtp_recv); ffurl_close(whip->dtls_uc); -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org