[ffmpeg] branch master updated. 4811518143 avformat/whip: set the first sequence number for video and audio
The branch, master has been updated via 48115181438b4d7258f38c7083b5def083ee345a (commit) from db2af6fd42e986367f629ec499dd3f1fabde79b7 (commit) - Log ----------------------------------------------------------------- commit 48115181438b4d7258f38c7083b5def083ee345a Author: Jack Lau <jacklau1222@qq.com> AuthorDate: Mon Aug 25 05:52:34 2025 +0800 Commit: stevenliu <lingjiujianke@gmail.com> CommitDate: Tue Aug 26 02:36:06 2025 +0000 avformat/whip: set the first sequence number for video and audio simply whip->audio_first_seq + 1 for video could be faster than generating a new one. 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> diff --git a/libavformat/whip.c b/libavformat/whip.c index 69f1010ee8..1fcf19aaa3 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 = whip->audio_first_seq + 1; + 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) { ----------------------------------------------------------------------- Summary of changes: libavformat/whip.c | 7 +++++++ 1 file changed, 7 insertions(+) hooks/post-receive --
participants (1)
-
ffmpeg-git@ffmpeg.org