From: Zhao Zhili via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Cc: 树 <shenshuyu1991@qq.com>, "Zhao Zhili" <quinkblack@foxmail.com>
Subject: [FFmpeg-devel] Re: [PATCH] libavformat/rtpenc_h264_hevc: Use original TID value from NAL unit header in HEVC FU packets
Date: Mon, 24 Nov 2025 10:29:40 +0800
Message-ID: <tencent_3352ABE34E0A70E52D729A9340FA9AAE9F08@qq.com> (raw)
In-Reply-To: <tencent_B348C313C1835F5263424C7B178010065508@qq.com>
> On Nov 21, 2025, at 12:37, 树 via ffmpeg-devel <ffmpeg-devel@ffmpeg.org> wrote:
>
> Dear FFmpeg developers,
>
>
> Currently, when fragmenting HEVC NAL units for RTP transmission, the code
> forces the Temporal ID (TID) field to 1 in the FU payload header, regardless
> of the original TID value in the NAL unit header. This violates RFC 7798
> section 4.4.3 which states that "the fields F, LayerId, and TID MUST be equal
> to the fields F, LayerId, and TID, respectively, of the fragmented NAL unit."
>
>
> This patch modifies the HEVC fragmentation unit handling to preserve the
> original TID value from the NAL unit header, ensuring standards compliance
> and proper temporal layer signaling.
>
>
> ## Problem Description
> In the current implementation, HEVC FU packets always set TID=1, which:
> - Violates RFC 7798 requirements
> - Breaks temporal scalability information
> - May cause compatibility issues with standards-compliant decoders
>
>
> ## Solution
> Extract the original TID value (bits 0-2 of the second NAL header byte)
> and use it in the FU payload header instead of hardcoding to 1.
>
>
> ## Patch
> The change is minimal and focused:
>
>
> --- a/libavformat/rtpenc_h264_hevc.c
> +++ b/libavformat/rtpenc_h264_hevc.c
> @@ -138,7 +138,7 @@ static void nal_send(AVFormatContext *s1, const uint8_t *buf, int size, int last
> * TID = 1
> */
> s->buf[0] = 49 << 1;
> - s->buf[1] = 1;
> + s->buf[1] = buf[1] & 0x7;
Corrupted text. Please note qq email web client doesn’t support plain text.
Could you send a PR on https://code.ffmpeg.org/FFmpeg/FFmpeg?
>
>
> ## Testing
> - Verified with HEVC streams containing various TID values
> - Confirmed RFC 7798 compliance
> - No regression in existing functionality
>
>
> ## Impact
> This change improves standards compliance while maintaining backward
> compatibility for streams where TID=1.
>
>
> Signed-off-by: shenshuyu <shenshuyu1991@qq.com>
> _______________________________________________
> ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
> To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
prev parent reply other threads:[~2025-11-24 2:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-21 4:37 [FFmpeg-devel] " 树 via ffmpeg-devel
2025-11-24 2:29 ` Zhao Zhili via ffmpeg-devel [this message]
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=tencent_3352ABE34E0A70E52D729A9340FA9AAE9F08@qq.com \
--to=ffmpeg-devel@ffmpeg.org \
--cc=quinkblack@foxmail.com \
--cc=shenshuyu1991@qq.com \
/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