> On Nov 21, 2025, at 12:37, 树 via ffmpeg-devel <[email protected]> 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 <[email protected]> > _______________________________________________ > ffmpeg-devel mailing list -- [email protected] > To unsubscribe send an email to [email protected] _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
