From: Jack Lau via ffmpeg-devel <ffmpeg-devel@ffmpeg.org> To: ffmpeg-devel@ffmpeg.org Cc: Jack Lau <code@ffmpeg.org> Subject: [FFmpeg-devel] [PATCH] avformat/whip: set the first sequence number for video and audio (PR #20332) Date: Mon, 25 Aug 2025 01:00:55 +0300 (EEST) Message-ID: <20250824220055.9CECC68D816@ffbox0-bg.ffmpeg.org> (raw) 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 <jacklau1222@qq.com> From 3109374df9e00e1c8c5e199809ffc2a95c4a9b6e Mon Sep 17 00:00:00 2001 From: Jack Lau <jacklau1222@qq.com> 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 <jacklau1222@qq.com> --- 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".
reply other threads:[~2025-08-24 22:01 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20250824220055.9CECC68D816@ffbox0-bg.ffmpeg.org \ --to=ffmpeg-devel@ffmpeg.org \ --cc=code@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git