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 <jacklau1...@qq.com> >From 3109374df9e00e1c8c5e199809ffc2a95c4a9b6e Mon Sep 17 00:00:00 2001 From: Jack Lau <jacklau1...@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 <jacklau1...@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-requ...@ffmpeg.org with subject "unsubscribe".