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 5BCC74BC20 for ; Sun, 24 Aug 2025 22:01:02 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 9CECC68D816; Mon, 25 Aug 2025 01:00:55 +0300 (EEST) Received: from 0f4167fb2350 (code.ffmpeg.org [188.245.149.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 0636568D337 for ; Mon, 25 Aug 2025 01:00:53 +0300 (EEST) MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] =?utf-8?q?=5BPATCH=5D_avformat/whip=3A_set_the_fi?= =?utf-8?q?rst_sequence_number_for_video_and_audio_=28PR_=2320332=29?= X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Jack Lau via ffmpeg-devel Reply-To: FFmpeg development discussions and patches Cc: Jack Lau Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Message-Id: <20250824220055.9CECC68D816@ffbox0-bg.ffmpeg.org> Date: Mon, 25 Aug 2025 01:00:55 +0300 (EEST) Archived-At: List-Archive: List-Post: PR #20332 opened by Jack Lau (JackLau) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20332 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20332.patch this patch will make whip be able to get the first rtp seq easily and compute something sequence-based (e.g. NACK and RTX handling) Signed-off-by: Jack Lau >From 3109374df9e00e1c8c5e199809ffc2a95c4a9b6e Mon Sep 17 00:00:00 2001 From: Jack Lau Date: Mon, 25 Aug 2025 05:52:34 +0800 Subject: [PATCH] avformat/whip: set the first sequence number for video and audio this patch will make whip be able to get the first rtp seq easily and compute something sequence-based (e.g. NACK and RTX handling) Signed-off-by: Jack Lau --- libavformat/whip.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libavformat/whip.c b/libavformat/whip.c index 69f1010ee8..ae0e98052b 100644 --- a/libavformat/whip.c +++ b/libavformat/whip.c @@ -219,6 +219,9 @@ typedef struct WHIPContext { /* The SSRC of the audio and video stream, generated by the muxer. */ uint32_t audio_ssrc; uint32_t video_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; @@ -379,6 +382,9 @@ static av_cold int initialize(AVFormatContext *s) seed = av_get_random_seed(); av_lfg_init(&whip->rnd, seed); + whip->audio_first_seq = av_lfg_get(&whip->rnd) & 0x0fff; + whip->video_first_seq = av_lfg_get(&whip->rnd) & 0x0fff; + if (whip->pkt_size < ideal_pkt_size) av_log(whip, AV_LOG_WARNING, "pkt_size=%d(<%d) is too small, may cause packet loss\n", whip->pkt_size, ideal_pkt_size); @@ -1536,6 +1542,7 @@ static int create_rtp_muxer(AVFormatContext *s) av_dict_set(&opts, "payload_type", buf, 0); snprintf(buf, sizeof(buf), "%d", is_video? whip->video_ssrc : whip->audio_ssrc); av_dict_set(&opts, "ssrc", buf, 0); + av_dict_set_int(&opts, "seq", is_video ? whip->video_first_seq : whip->audio_first_seq, 0); ret = avformat_write_header(rtp_ctx, &opts); if (ret < 0) { -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".