Skip to content

Commit bc25d47

Browse files
mondainclaude
andcommitted
Fix audio timestamp continuity issue with Type 3 RTMP headers
Restores missing timeDelta inheritance for Type 3 (HEADER_CONTINUE) headers that was inadvertently removed in recent extended timestamp handling updates. Issue: Audio timestamps were staying at zero when listeners were added to ClientBroadcastStream, while video timestamps continued to increment properly. Root cause: Recent commits ee0f546 and 0a89fdc fixed extended timestamp handling but accidentally broke Type 3 header processing by failing to inherit timeDelta from the previous header. Type 3 headers must inherit both timeBase and timeDelta to maintain proper RTMP timestamp continuity. Impact: Audio packets frequently use Type 3 headers for efficiency, so this affected audio synchronization more than video (which typically uses Type 0/1 headers with absolute timestamps). Fix: Added timeDelta = lastHeader.getTimerDelta() to restore proper inheritance as required by RTMP specification and librtmp compatibility. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 0db9345 commit bc25d47

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

common/src/main/java/org/red5/server/net/rtmp/codec/RTMPProtocolDecoder.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,8 @@ public Header decodeHeader(ChunkHeader chh, RTMPDecodeState state, IoBuffer in,
401401
if (lastHeader != null) {
402402
// time base from last header
403403
timeBase = lastHeader.getTimerBase();
404+
// inherit the time delta from last header (critical for Type 3 headers)
405+
timeDelta = lastHeader.getTimerDelta();
404406
// inherit the stream id from the last header
405407
header.setStreamId(lastHeader.getStreamId());
406408
// inherit the data type from the last header

0 commit comments

Comments
 (0)