From 7fe5cb7dade375bcec6df08b05dbcf2bcec34e30 Mon Sep 17 00:00:00 2001 From: James Hurley Date: Thu, 15 Jun 2023 15:17:24 -0700 Subject: [PATCH] librtmp: Add missing extended timestamp in Type 3 chunks According to https://rtmp.veriskope.com/docs/spec/#5313-extended-timestamp extended timestamps need to be present in Type 3 chunks (`RTMP_PACKET_SIZE_MINIMUM`) if the previous chunk also included an extended timestamp --- plugins/obs-outputs/librtmp/rtmp.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/obs-outputs/librtmp/rtmp.c b/plugins/obs-outputs/librtmp/rtmp.c index cfc7288a0..014a594d7 100644 --- a/plugins/obs-outputs/librtmp/rtmp.c +++ b/plugins/obs-outputs/librtmp/rtmp.c @@ -4250,6 +4250,7 @@ RTMP_SendPacket(RTMP *r, RTMPPacket *packet, int queue) buffer += nChunkSize; hSize = 0; + // prepare to send off remaining data in Type 3 chunks if (nSize > 0) { header = buffer - 1; @@ -4259,6 +4260,11 @@ RTMP_SendPacket(RTMP *r, RTMPPacket *packet, int queue) header -= cSize; hSize += cSize; } + if (t >= 0xffffff) + { + hSize += 4; + header -= 4; + } *header = (0xc0 | c); if (cSize) { @@ -4267,6 +4273,8 @@ RTMP_SendPacket(RTMP *r, RTMPPacket *packet, int queue) if (cSize == 2) header[2] = tmp >> 8; } + if (t >= 0xffffff) + AMF_EncodeInt32(header+hSize-4, header+hSize, t); } } if (tbuf)