]> granicus.if.org Git - rtmpdump/commitdiff
delete packet->m_nInfoField1, it's just the timestamp
authorhyc <hyc@400ebc74-4327-4243-bc38-086b20814532>
Tue, 23 Mar 2010 01:11:58 +0000 (01:11 +0000)
committerhyc <hyc@400ebc74-4327-4243-bc38-086b20814532>
Tue, 23 Mar 2010 01:11:58 +0000 (01:11 +0000)
git-svn-id: svn://svn.mplayerhq.hu/rtmpdump/trunk@394 400ebc74-4327-4243-bc38-086b20814532

librtmp/rtmp.c
librtmp/rtmp.h
rtmpsrv.c

index 974adbb0b5e1b8ccbb3aa7b1ef482a27f15f4243..7c13b4e048007a04a94d5a100d2b7d004f40dd38 100644 (file)
@@ -149,7 +149,7 @@ RTMPPacket_Reset(RTMPPacket *p)
   p->m_headerType = 0;
   p->m_packetType = 0;
   p->m_nChannel = 0;
-  p->m_nInfoField1 = 0;
+  p->m_nTimeStamp = 0;
   p->m_nInfoField2 = 0;
   p->m_hasAbsTimestamp = false;
   p->m_nBodySize = 0;
@@ -182,7 +182,7 @@ RTMPPacket_Dump(RTMPPacket *p)
 {
   RTMP_Log(RTMP_LOGDEBUG,
       "RTMP PACKET: packet type: 0x%02x. channel: 0x%02x. info 1: %d info 2: %d. Body size: %lu. body: 0x%02x",
-      p->m_packetType, p->m_nChannel, p->m_nInfoField1, p->m_nInfoField2,
+      p->m_packetType, p->m_nChannel, p->m_nTimeStamp, p->m_nInfoField2,
       p->m_nBodySize, p->m_body ? (unsigned char)p->m_body[0] : 0);
 }
 
@@ -1042,7 +1042,7 @@ SendConnectPacket(RTMP *r, RTMPPacket *cp)
   packet.m_nChannel = 0x03;    // control channel (invoke)
   packet.m_headerType = RTMP_PACKET_SIZE_LARGE;
   packet.m_packetType = 0x14;  // INVOKE
-  packet.m_nInfoField1 = 0;
+  packet.m_nTimeStamp = 0;
   packet.m_nInfoField2 = 0;
   packet.m_hasAbsTimestamp = 0;
   packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
@@ -1152,7 +1152,7 @@ SendBGHasStream(RTMP *r, double dId, AVal *playpath)
   packet.m_nChannel = 0x03;    // control channel (invoke)
   packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM;
   packet.m_packetType = 0x14;  // INVOKE
-  packet.m_nInfoField1 = 0;
+  packet.m_nTimeStamp = 0;
   packet.m_nInfoField2 = 0;
   packet.m_hasAbsTimestamp = 0;
   packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
@@ -1183,7 +1183,7 @@ RTMP_SendCreateStream(RTMP *r)
   packet.m_nChannel = 0x03;    // control channel (invoke)
   packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM;
   packet.m_packetType = 0x14;  // INVOKE
-  packet.m_nInfoField1 = 0;
+  packet.m_nTimeStamp = 0;
   packet.m_nInfoField2 = 0;
   packet.m_hasAbsTimestamp = 0;
   packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
@@ -1208,7 +1208,7 @@ SendFCSubscribe(RTMP *r, AVal *subscribepath)
   packet.m_nChannel = 0x03;    // control channel (invoke)
   packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM;
   packet.m_packetType = 0x14;  // INVOKE
-  packet.m_nInfoField1 = 0;
+  packet.m_nTimeStamp = 0;
   packet.m_nInfoField2 = 0;
   packet.m_hasAbsTimestamp = 0;
   packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
@@ -1239,7 +1239,7 @@ SendReleaseStream(RTMP *r)
   packet.m_nChannel = 0x03;    // control channel (invoke)
   packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM;
   packet.m_packetType = 0x14;  // INVOKE
-  packet.m_nInfoField1 = 0;
+  packet.m_nTimeStamp = 0;
   packet.m_nInfoField2 = 0;
   packet.m_hasAbsTimestamp = 0;
   packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
@@ -1268,7 +1268,7 @@ SendFCPublish(RTMP *r)
   packet.m_nChannel = 0x03;    // control channel (invoke)
   packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM;
   packet.m_packetType = 0x14;  // INVOKE
-  packet.m_nInfoField1 = 0;
+  packet.m_nTimeStamp = 0;
   packet.m_nInfoField2 = 0;
   packet.m_hasAbsTimestamp = 0;
   packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
@@ -1297,7 +1297,7 @@ SendFCUnpublish(RTMP *r)
   packet.m_nChannel = 0x03;    // control channel (invoke)
   packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM;
   packet.m_packetType = 0x14;  // INVOKE
-  packet.m_nInfoField1 = 0;
+  packet.m_nTimeStamp = 0;
   packet.m_nInfoField2 = 0;
   packet.m_hasAbsTimestamp = 0;
   packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
@@ -1328,7 +1328,7 @@ SendPublish(RTMP *r)
   packet.m_nChannel = 0x04;    // source channel (invoke)
   packet.m_headerType = RTMP_PACKET_SIZE_LARGE;
   packet.m_packetType = 0x14;  // INVOKE
-  packet.m_nInfoField1 = 0;
+  packet.m_nTimeStamp = 0;
   packet.m_nInfoField2 = r->m_stream_id;
   packet.m_hasAbsTimestamp = 0;
   packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
@@ -1362,7 +1362,7 @@ SendDeleteStream(RTMP *r, double dStreamId)
   packet.m_nChannel = 0x03;    // control channel (invoke)
   packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM;
   packet.m_packetType = 0x14;  // INVOKE
-  packet.m_nInfoField1 = 0;
+  packet.m_nTimeStamp = 0;
   packet.m_nInfoField2 = 0;
   packet.m_hasAbsTimestamp = 0;
   packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
@@ -1390,7 +1390,7 @@ RTMP_SendPause(RTMP *r, bool DoPause, double dTime)
   packet.m_nChannel = 0x08;    // video channel
   packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM;
   packet.m_packetType = 0x14;  // invoke
-  packet.m_nInfoField1 = 0;
+  packet.m_nTimeStamp = 0;
   packet.m_nInfoField2 = 0;
   packet.m_hasAbsTimestamp = 0;
   packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
@@ -1419,7 +1419,7 @@ RTMP_SendSeek(RTMP *r, double dTime)
   packet.m_nChannel = 0x08;    // video channel
   packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM;
   packet.m_packetType = 0x14;  // invoke
-  packet.m_nInfoField1 = 0;
+  packet.m_nTimeStamp = 0;
   packet.m_nInfoField2 = 0;
   packet.m_hasAbsTimestamp = 0;
   packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
@@ -1447,7 +1447,7 @@ RTMP_SendServerBW(RTMP *r)
   packet.m_nChannel = 0x02;    // control channel (invoke)
   packet.m_headerType = RTMP_PACKET_SIZE_LARGE;
   packet.m_packetType = 0x05;  // Server BW
-  packet.m_nInfoField1 = 0;
+  packet.m_nTimeStamp = 0;
   packet.m_nInfoField2 = 0;
   packet.m_hasAbsTimestamp = 0;
   packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
@@ -1467,7 +1467,7 @@ RTMP_SendClientBW(RTMP *r)
   packet.m_nChannel = 0x02;    // control channel (invoke)
   packet.m_headerType = RTMP_PACKET_SIZE_LARGE;
   packet.m_packetType = 0x06;  // Client BW
-  packet.m_nInfoField1 = 0;
+  packet.m_nTimeStamp = 0;
   packet.m_nInfoField2 = 0;
   packet.m_hasAbsTimestamp = 0;
   packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
@@ -1488,7 +1488,7 @@ SendBytesReceived(RTMP *r)
   packet.m_nChannel = 0x02;    // control channel (invoke)
   packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM;
   packet.m_packetType = 0x03;  // bytes in
-  packet.m_nInfoField1 = 0;
+  packet.m_nTimeStamp = 0;
   packet.m_nInfoField2 = 0;
   packet.m_hasAbsTimestamp = 0;
   packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
@@ -1513,7 +1513,7 @@ SendCheckBW(RTMP *r)
   packet.m_nChannel = 0x03;    // control channel (invoke)
   packet.m_headerType = RTMP_PACKET_SIZE_LARGE;
   packet.m_packetType = 0x14;  // INVOKE
-  packet.m_nInfoField1 = 0;    /* RTMP_GetTime(); */
+  packet.m_nTimeStamp = 0;     /* RTMP_GetTime(); */
   packet.m_nInfoField2 = 0;
   packet.m_hasAbsTimestamp = 0;
   packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
@@ -1540,7 +1540,7 @@ SendCheckBWResult(RTMP *r, double txn)
   packet.m_nChannel = 0x03;    // control channel (invoke)
   packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM;
   packet.m_packetType = 0x14;  // INVOKE
-  packet.m_nInfoField1 = 0x16 * r->m_nBWCheckCounter;  // temp inc value. till we figure it out.
+  packet.m_nTimeStamp = 0x16 * r->m_nBWCheckCounter;   // temp inc value. till we figure it out.
   packet.m_nInfoField2 = 0;
   packet.m_hasAbsTimestamp = 0;
   packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
@@ -1567,8 +1567,8 @@ SendPlay(RTMP *r)
   packet.m_nChannel = 0x08;    // we make 8 our stream channel
   packet.m_headerType = RTMP_PACKET_SIZE_LARGE;
   packet.m_packetType = 0x14;  // INVOKE
+  packet.m_nTimeStamp = 0;
   packet.m_nInfoField2 = r->m_stream_id;       //0x01000000;
-  packet.m_nInfoField1 = 0;
   packet.m_hasAbsTimestamp = 0;
   packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
 
@@ -1628,8 +1628,8 @@ SendSecureTokenResponse(RTMP *r, AVal *resp)
   packet.m_nChannel = 0x03;    /* control channel (invoke) */
   packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM;
   packet.m_packetType = 0x14;
+  packet.m_nTimeStamp = 0;
   packet.m_nInfoField2 = 0;
-  packet.m_nInfoField1 = 0;
   packet.m_hasAbsTimestamp = 0;
   packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
 
@@ -1674,7 +1674,7 @@ RTMP_SendCtrl(RTMP *r, short nType, unsigned int nObject, unsigned int nTime)
   packet.m_nChannel = 0x02;    // control channel (ping)
   packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM;
   packet.m_packetType = 0x04;  // ctrl
-  packet.m_nInfoField1 = 0;    /* RTMP_GetTime(); */
+  packet.m_nTimeStamp = 0;     /* RTMP_GetTime(); */
   packet.m_nInfoField2 = 0;
   packet.m_hasAbsTimestamp = 0;
   packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
@@ -2328,9 +2328,9 @@ RTMP_ReadPacket(RTMP *r, RTMPPacket *packet)
 
   if (nSize >= 3)
     {
-      packet->m_nInfoField1 = AMF_DecodeInt24(header);
+      packet->m_nTimeStamp = AMF_DecodeInt24(header);
 
-      //RTMP_Log(RTMP_LOGDEBUG, "%s, reading RTMP packet chunk on channel %x, headersz %i, timestamp %i, abs timestamp %i", __FUNCTION__, packet.m_nChannel, nSize, packet.m_nInfoField1, packet.m_hasAbsTimestamp);
+      //RTMP_Log(RTMP_LOGDEBUG, "%s, reading RTMP packet chunk on channel %x, headersz %i, timestamp %i, abs timestamp %i", __FUNCTION__, packet.m_nChannel, nSize, packet.m_nTimeStamp, packet.m_hasAbsTimestamp);
 
       if (nSize >= 6)
        {
@@ -2346,7 +2346,7 @@ RTMP_ReadPacket(RTMP *r, RTMPPacket *packet)
                packet->m_nInfoField2 = DecodeInt32LE(header + 7);
            }
        }
-      if (packet->m_nInfoField1 == 0xffffff)
+      if (packet->m_nTimeStamp == 0xffffff)
        {
          if (ReadN(r, header + nSize, 4) != 4)
            {
@@ -2354,7 +2354,7 @@ RTMP_ReadPacket(RTMP *r, RTMPPacket *packet)
                  __FUNCTION__);
              return false;
            }
-         packet->m_nInfoField1 = AMF_DecodeInt32(header + nSize);
+         packet->m_nTimeStamp = AMF_DecodeInt32(header + nSize);
          hSize += 4;
        }
     }
@@ -2405,8 +2405,6 @@ RTMP_ReadPacket(RTMP *r, RTMPPacket *packet)
 
   if (RTMPPacket_IsReady(packet))
     {
-      packet->m_nTimeStamp = packet->m_nInfoField1;
-
       // make packet's timestamp absolute
       if (!packet->m_hasAbsTimestamp)
        packet->m_nTimeStamp += r->m_channelTimestamp[packet->m_nChannel];      // timestamps seem to be always relative!!
@@ -2591,10 +2589,10 @@ RTMP_SendPacket(RTMP *r, RTMPPacket *packet, bool queue)
          && packet->m_headerType == RTMP_PACKET_SIZE_MEDIUM)
        packet->m_headerType = RTMP_PACKET_SIZE_SMALL;
 
-      if (prevPacket->m_nInfoField1 == packet->m_nInfoField1
+      if (prevPacket->m_nTimeStamp == packet->m_nTimeStamp
          && packet->m_headerType == RTMP_PACKET_SIZE_SMALL)
        packet->m_headerType = RTMP_PACKET_SIZE_MINIMUM;
-      last = prevPacket->m_nInfoField1;
+      last = prevPacket->m_nTimeStamp;
     }
 
   if (packet->m_headerType > 3)        // sanity
@@ -2607,7 +2605,7 @@ RTMP_SendPacket(RTMP *r, RTMPPacket *packet, bool queue)
   int nSize = packetSize[packet->m_headerType];
   int hSize = nSize, cSize = 0;
   char *header, *hptr, *hend, hbuf[RTMP_MAX_HEADER_SIZE], c;
-  uint32_t t = packet->m_nInfoField1 - last;
+  uint32_t t = packet->m_nTimeStamp - last;
 
   if (packet->m_body)
     {
@@ -3655,14 +3653,14 @@ RTMP_Write(RTMP *r, char *buf, int size)
          pkt->m_packetType = *buf++;
          pkt->m_nBodySize = AMF_DecodeInt24(buf);
          buf += 3;
-         pkt->m_nInfoField1 = AMF_DecodeInt24(buf);
+         pkt->m_nTimeStamp = AMF_DecodeInt24(buf);
          buf += 3;
-         pkt->m_nInfoField1 |= *buf++ << 24;
+         pkt->m_nTimeStamp |= *buf++ << 24;
          buf += 3;
          s2 -= 11;
 
          if (((pkt->m_packetType == 0x08 || pkt->m_packetType == 0x09) &&
-           !pkt->m_nInfoField1) || pkt->m_packetType == 0x12)
+           !pkt->m_nTimeStamp) || pkt->m_packetType == 0x12)
            {
              pkt->m_headerType = RTMP_PACKET_SIZE_LARGE;
              if (pkt->m_packetType == 0x12)
index 20e65b2dc5cbc5f263f9f92aeb0a981aca33487a..08766aed7954e3231163e24dda9e2f3be2548022 100644 (file)
@@ -92,9 +92,8 @@ extern "C"
     BYTE m_packetType;
     BYTE m_hasAbsTimestamp;    // timestamp absolute or relative?
     int m_nChannel;
-    uint32_t m_nInfoField1;    // 3 first bytes
-    int32_t m_nInfoField2;     // last 4 bytes in a long header, absolute timestamp for long headers, relative timestamp for short headers
     uint32_t m_nTimeStamp;     // absolute timestamp
+    int32_t m_nInfoField2;     // last 4 bytes in a long header
     uint32_t m_nBodySize;
     uint32_t m_nBytesRead;
     RTMPChunk *m_chunk;
index 9965ddbbed7814598e4e732ea4f89999cb6c4c9f..823cde4d2e2734d34e565687b4120d6ab82adc6f 100644 (file)
--- a/rtmpsrv.c
+++ b/rtmpsrv.c
@@ -171,7 +171,7 @@ SendConnectResult(RTMP *r, double txn)
   packet.m_nChannel = 0x03;     // control channel (invoke)
   packet.m_headerType = 1; /* RTMP_PACKET_SIZE_MEDIUM; */
   packet.m_packetType = 0x14;   // INVOKE
-  packet.m_nInfoField1 = 0;
+  packet.m_nTimeStamp = 0;
   packet.m_nInfoField2 = 0;
   packet.m_hasAbsTimestamp = 0;
   packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
@@ -232,7 +232,7 @@ SendResultNumber(RTMP *r, double txn, double ID)
   packet.m_nChannel = 0x03;     // control channel (invoke)
   packet.m_headerType = 1; /* RTMP_PACKET_SIZE_MEDIUM; */
   packet.m_packetType = 0x14;   // INVOKE
-  packet.m_nInfoField1 = 0;
+  packet.m_nTimeStamp = 0;
   packet.m_nInfoField2 = 0;
   packet.m_hasAbsTimestamp = 0;
   packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
@@ -266,7 +266,7 @@ SendPlayStart(RTMP *r)
   packet.m_nChannel = 0x03;     // control channel (invoke)
   packet.m_headerType = 1; /* RTMP_PACKET_SIZE_MEDIUM; */
   packet.m_packetType = 0x14;   // INVOKE
-  packet.m_nInfoField1 = 0;
+  packet.m_nTimeStamp = 0;
   packet.m_nInfoField2 = 0;
   packet.m_hasAbsTimestamp = 0;
   packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
@@ -298,7 +298,7 @@ SendPlayStop(RTMP *r)
   packet.m_nChannel = 0x03;     // control channel (invoke)
   packet.m_headerType = 1; /* RTMP_PACKET_SIZE_MEDIUM; */
   packet.m_packetType = 0x14;   // INVOKE
-  packet.m_nInfoField1 = 0;
+  packet.m_nTimeStamp = 0;
   packet.m_nInfoField2 = 0;
   packet.m_hasAbsTimestamp = 0;
   packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;