From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id CD4884B28A for ; Mon, 24 Nov 2025 00:01:49 +0000 (UTC) Authentication-Results: ffbox; dkim=fail (body hash mismatch (got b'3QJVCtP36PRU5JLiJVib4vhLD0caM+urryEdBfzy/o4=', expected b'moYMxpZfj9ofMTs9MCTmW5KImkc80zCJDhal5jGkbxU=')) header.d=qq.com header.a=rsa-sha256 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1763942495; h=to : mime-version : date : message-id : reply-to : subject : list-id : list-archive : list-archive : list-help : list-owner : list-post : list-subscribe : list-unsubscribe : from : cc : content-type : content-transfer-encoding : from; bh=3QJVCtP36PRU5JLiJVib4vhLD0caM+urryEdBfzy/o4=; b=ZKJxobO2Pk+Br9yWusq3Z0i5TGRDlgeSXAK2TZWbWJyMOXeVHyK0Idf6tizBjUI06zsHQ +nn+bWiRolWg4cTlIrmBISGx+3cjXABHM51/vfcpOKqOrO1Z7X8qlJTTbom/G9clVQ08OG3 aWOvUvF8DQyU6tu5msg95LhU8pbxCDWHi0haZueft0ipdQbUHnz3HsmP3KrAdszj+Hz8K6X +DiRVA1ApBKEI3vD8YfmLoDgB3sQZqrcxEcjx7iR2q0zcgynaomT47pL0Z6KzUGHfz1772i Kivwlh1ijYARCoK7nMNmMRY7XFZZDeKVQAMks0Ux0GjyO9TFw8N6+UsuLd8g== Received: from [172.19.0.3] (unknown [172.19.0.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 3202A6900F6; Mon, 24 Nov 2025 02:01:35 +0200 (EET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=ffmpeg.org; s=arc; t=1763942470; b=GGBr1a5IRmcxNiBP1V7EX5HvGYnU5IEKcvmwvtB1t0s2Lu3tg86rSzeZ/DFX0A/aSyctW qzUdfc60wGheDE5XCTFZ+AhPvdJg8AZy7Kh7ECtQ0+e8xuLD0VRovnhvhkHkJjOhH7+h8K3 fgMQ+YF5hk6Jqd/DMj/rJNShrRewjIM0xBRpKuKN+aAWAW2vcGqNjVOOTqjaIruKEMOfPnI 8q0KUqp70CwcUMEdIfb91PGU6x7N1Psl0egyE2BvEEmwM3sKrLiLpRwCGgEa8Aae/dOlLWy GbbYdaM+WgWGJ/Sz+Ilo9/vCyHr9KQTkPcJbR9xhgsPuZSj32fCm+TyoLMqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=ffmpeg.org; s=arc; t=1763942470; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=3QJVCtP36PRU5JLiJVib4vhLD0caM+urryEdBfzy/o4=; b=EG0d7WQ2So2ec6yX75FG++xQcZm/6CcRYm07FmrlNbFhk3VV89/W57chcbUue43LZL0xK fm8v8sDTxhUlswkuCNVfyAYlUsSpJuGcJQcPzgjURI9/GrCsN5351ZvUNppkLtBw92nJ/i/ 7Sq1oMNhCRPyBbkd8Q0mUfDtVXDezgruCE8YVhlFsTDEZtA9G6wCQe99z0MTZSY7vP5oqr7 s12uDlbQXSN9wQcwzrhFcbEgVkMq9wikrt3WyoGB6OqbbwH57mdbONC4HvePW/Ftc0hJ7a8 zoqXM4WoZu3PeWrBo3DBqIbu9Bu0HaW5lAWIY0tQk8cLoOqmyUyY3lJ3jHLg== ARC-Authentication-Results: i=1; ffmpeg.org; dkim=pass header.d=qq.com; arc=none; dmarc=pass header.from=qq.com policy.dmarc=quarantine Authentication-Results: ffmpeg.org; dkim=pass header.d=qq.com; arc=none (Message is not ARC signed); dmarc=pass (Used From Domain Record) header.from=qq.com policy.dmarc=quarantine Received: from xmbghk7.mail.qq.com (xmbghk7.mail.qq.com [43.163.128.48]) by ffbox0-bg.ffmpeg.org (Postfix) with UTF8SMTPS id 8EB2668F68A for ; Fri, 21 Nov 2025 06:37:48 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1763699863; bh=moYMxpZfj9ofMTs9MCTmW5KImkc80zCJDhal5jGkbxU=; h=From:To:Subject:Date; b=WHj2S1GteWGzyCeKnK2uJgzR/yYBfV7TuFHHJ+GHfhTl7J+y6cyiOrtWPp6i7eEhn aVMUi8IaeXrRoDlgiuD3VSeMa6ckzoWATZoS74zAZ6bHgW+uUNvu3RcqvP9e854FaD mJ+4GqPEUBGf4fT0KekckmmHeqcDJd1tsk/45XPc= X-QQ-XMRINFO: MPJ6Tf5t3I/ycC2BItcBVIA= X-QQ-XMAILINFO: OfI1/dL5aeFQkUb5r7nmqfqJeCfGaiiX9s+lBiPNi1+9eCqHBM3FQm4qNKDHXz DL84OpJ9zLjv88TcOrGnMp42SZ2U6QieUFnsRTrZMnXWDEdRpW+StTBanI4SUxmiqbm14HPKXop8J rRC3h20KZi4CkHM9B/CPcFoexGrPXX8c3cC8W2Pv0NSmkhSti1NWkCcbmIV2JiZmMuLq6iqPvKYO4 o9/OXirRJTl/qcYEhHrl8+sg+CpX4VM/AJNgUzDrEVkJtSoTvML0nDu72z6QY0iXhWYa8zH51Rmub f/nQDkxOZeoGuahdjMETzNLyyDJMGGaT+W0boXaOte4NVo2Yi6ZHnXHTS9v/SWAXMNZNhHxCKNWqu asaSBWbuCh8oXDv8TsnHtHkb6NOXdImPn04mCbO2GA0cgBSEIy6XDRcRqyEtOtrLU1mySlXWRfi8K 0g/xnS7UyowGlGZsyj16exHzYFKgyKqcnVzlVi6Tc4mk8p9BSWv8CwAK4dOcRlE1wWrhwCEQyEJPH fC5AsF6LpnapboW4XnkjCsKLDbYtgWNP2shU+Xbu5sjWtDsNT3mlKZHIn9KJuyNpxphe3HuJsbnMP QRjSWAGBDZQqutLmCg4AhOMIEr9rlV1t1bVnpzoS2PZlezVRNtFF425yx3NfBUMQvxOt9Eob/DJh8 peY/kLoNesyJA2V5ir0SSrLl8uWjniGgTCU9l3s9LLvApJYi1mYCqcNr1qj/2hDC2VpGGq8hh+E6m RuVALe5ats3yriyQxUFs3ktXnJjVv06NuOEokyPlbdreCd3tE5aqxVCLSQeH7YB0K7+UFyQsuLEF7 Ms2huegKS1VuOYv+S4LZ2Fv9zPpdgKEI9neC0eF1TOSZ4/iMvgqhHVq3aQcVTB6+ygkxj24w8hZ5T /a+aHH7MFG1ExlvQCUHELG/l7IOVdvENfO8tSMIIu1/1MJD1kZCuILAKJCXbqd0XwK2sV4JqujEDZ PZZH5BZJ/AM9OmbHPK7lCDydz1LMqg4BgXWP8yjw== To: "=?utf-8?B?ZmZtcGVnLWRldmVs?=" Mime-Version: 1.0 Date: Fri, 21 Nov 2025 12:37:42 +0800 X-Priority: 3 Message-ID: X-QQ-MIME: TCMime 1.0 by Tencent X-Mailer: QQMail 2.x X-QQ-Mailer: QQMail 2.x X-QQ-mid: xmsepub7-0t1763699862t5k7ywps8 X-MailFrom: SRS0=9IDu=55=qq.com=shenshuyu1991@ffmpeg.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-ffmpeg-devel.ffmpeg.org-0; header-match-ffmpeg-devel.ffmpeg.org-1; header-match-ffmpeg-devel.ffmpeg.org-2; header-match-ffmpeg-devel.ffmpeg.org-3; emergency; member-moderation Message-ID-Hash: Q5PFLT6E7U4AMF2JP3UEZXVXUSEESMNY X-Message-ID-Hash: Q5PFLT6E7U4AMF2JP3UEZXVXUSEESMNY X-Mailman-Approved-At: Mon, 24 Nov 2025 00:00:24 +0000 X-Content-Filtered-By: Mailman/MimeDel 3.3.10 X-Mailman-Version: 3.3.10 Precedence: list Reply-To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PATCH] libavformat/rtpenc_h264_hevc: Use original TID value from NAL unit header in HEVC FU packets List-Id: FFmpeg development discussions and patches Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: =?utf-8?q?=E6=A0=91_via_ffmpeg-devel?= Cc: =?utf-8?B?5qCR?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Archived-At: List-Archive: List-Post: 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; ## 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