$ git clone http://tcclient.ion.nu/tc_client.git
commit 18779e3a6e303beb5043cc3b231db4db61642fe4
Author: Alicia <...>
Date:   Sun Sep 11 21:10:26 2016 +0200

    Fixed RTMP extended timestamps (read extended timestamps for subsequent format 3 chunks with the same chunk ID)

diff --git a/ChangeLog b/ChangeLog
index 8da0425..f05a866 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@
 Added a /closecam command to stop receiving a cam stream.
 Use uintX_t for endianness functions instead of unsigned long*x int.
 Implemented RTMP acknowledgement on outgoing data, with dropping video packets if necessary.
+Fixed RTMP extended timestamps (read extended timestamps for subsequent format 3 chunks with the same chunk ID)
 bugfix: brought back announcing when a cam stream ends.
 modbot: only use youtube-dl's 'ytsearch:' for --get-id, and only if it doesn't appear to be an ID already.
 tc_client-gtk: handle only one sendmessage event at a time, and don't send empty lines.
diff --git a/rtmp.c b/rtmp.c
index be0cecd..5541761 100644
--- a/rtmp.c
+++ b/rtmp.c
@@ -30,6 +30,7 @@ struct chunk
   unsigned int streamid;
   unsigned int pos;
   void* buf;
+  char exttimestamp;
 };
 struct chunk* chunks=0;
 unsigned int chunkcount=0;
@@ -77,6 +78,7 @@ struct chunk* chunk_get(unsigned int id)
   chunks[i].timestamp=0;
   chunks[i].length=0;
   chunks[i].type=0;
+  chunks[i].exttimestamp=0;
   return &chunks[i];
 }
 
@@ -101,6 +103,7 @@ char rtmp_get(int sock, struct rtmp* rtmp)
     x=0;
     fullread(sock, ((void*)&x)+1, 3);
     chunk->timestamp=be32(x);
+    chunk->exttimestamp=(chunk->timestamp==0xffffff);
     if(fmt<2)
     {
       // Length
@@ -122,7 +125,7 @@ char rtmp_get(int sock, struct rtmp* rtmp)
     }
   }
   // Extended timestamp
-  if(chunk->timestamp==0xffffff)
+  if(chunk->exttimestamp)
   {
     fullread(sock, &x, sizeof(x));
     chunk->timestamp=be32(x);