gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] /srv/bzr/gnash/rtmp r9631: Drop the chunksize parameter f


From: rob
Subject: [Gnash-commit] /srv/bzr/gnash/rtmp r9631: Drop the chunksize parameter for ::split().
Date: Thu, 04 Sep 2008 09:17:06 -0600
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9631
committer: address@hidden
branch nick: rtmp
timestamp: Thu 2008-09-04 09:17:06 -0600
message:
  Drop the chunksize parameter for ::split().
  Use an array if chunksizes, as each channel may be using a different size
  for packets!
modified:
  libnet/rtmp.cpp
  libnet/rtmp.h
  testsuite/libnet.all/test_rtmp.cpp
=== modified file 'libnet/rtmp.cpp'
--- a/libnet/rtmp.cpp   2008-09-03 20:45:22 +0000
+++ b/libnet/rtmp.cpp   2008-09-04 15:17:06 +0000
@@ -176,17 +176,21 @@
 RTMP::RTMP() 
     : _handshake(0),
       _handler(0),
-      _chunksize(RTMP_VIDEO_PACKET_SIZE),
+      _packet_size(0),
+      _mystery_word(0),
       _timeout(1)
 {
 //    GNASH_REPORT_FUNCTION;
 //    _queues.resize(MAX_AMF_INDEXES);
-//    for (size_t i=0; i<MAX_AMF_INDEXES; i++) {
-//     string name = "channel #";
-//     for (size_t i=0; i<10; i++) {
-//     name[9] = i+'0';
-//     _queues[i].setName(name.c_str());
-//     }
+    // Initialize all of the queues
+    for (size_t i=0; i<MAX_AMF_INDEXES; i++) {
+       string name = "channel #";
+       for (size_t i=0; i<10; i++) {
+           name[9] = i+'0';
+           _queues[i].setName(name.c_str()); // this name is only used for 
debugging
+           _chunksize[i] = RTMP_VIDEO_PACKET_SIZE; // each channel can have a 
different chunksize
+       }
+    }
 }
 
 RTMP::~RTMP()
@@ -195,7 +199,7 @@
     _properties.clear();
     delete _handshake;
     delete _handler;
-    
+
 //    delete _body;
 }
 
@@ -877,7 +881,7 @@
            switch (rthead->type) {
              case CHUNK_SIZE:
                  log_debug("Got CHUNK_SIZE packet!!!");
-                 _chunksize = ntohl(*reinterpret_cast<boost::uint32_t *>(ptr + 
rthead->head_size));
+                 _chunksize[rthead->channel] = 
ntohl(*reinterpret_cast<boost::uint32_t *>(ptr + rthead->head_size));
                  log_debug("Setting packet chunk size to %d.", _chunksize);
 //               decodeChunkSize();
                  break;
@@ -1033,12 +1037,6 @@
 RTMP::queues_t *
 RTMP::split(Buffer *buf)
 {
-    return split(buf, _chunksize);
-}
-
-RTMP::queues_t *
-RTMP::split(Buffer *buf, size_t chunksize)
-{
     GNASH_REPORT_FUNCTION;
 
     if (buf == 0) {
@@ -1059,7 +1057,7 @@
        if (rthead->head_size <= RTMP_MAX_HEADER_SIZE) {
            // Any packet with a size greater than 1 is a new header, so create
            // a new Buffer to hold all the data.
-           if ((rthead->head_size > 1) || (rthead->type == RTMP::PING)) {
+           if ((rthead->head_size > 1)) {
                // This is a queue of channels with active messages
                _channels.push_back(&_queues[rthead->channel]);
 //             cerr << "New packet for channel #" << rthead->channel << " of 
size "
@@ -1072,31 +1070,31 @@
                chunk = _queues[rthead->channel].peek();
            }
            // Many RTMP messages are smaller than the chunksize
-           if (chunk->size() <= chunksize) {
+           if (chunk->size() <= _chunksize[rthead->channel]) {
                // a single byte header has no length field. As these are often
                // used as continuation packets, the body size is the same as 
the
                // previous header with a length field.
-               if ((rthead->head_size > 1) || (rthead->type == RTMP::PING)) {
+               if ((rthead->head_size > 1)) {
                    pktsize = chunk->size();
                } else {
                    pktsize = rthead->head_size + rthead->bodysize - 
chunk->size();
                }
            } else { // this RTMP message is larger than the chunksize
                if (rthead->head_size > 1) {
-                   pktsize = rthead->head_size + chunksize;
+                   pktsize = rthead->head_size + _chunksize[rthead->channel];
                } else {
-                   pktsize = rthead->head_size + (chunk->size() - chunksize);
+                   pktsize = rthead->head_size + (chunk->size() - 
_chunksize[rthead->channel]);
                }
            }
            
            // Range check the size of the packet
-           if (pktsize <= (chunksize + RTMP_MAX_HEADER_SIZE)) {
+           if (pktsize <= (_chunksize[rthead->channel] + 
RTMP_MAX_HEADER_SIZE)) {
                nbytes += pktsize;
                // Skip the header for all but the first packet. The rest are 
just to
                // complete all the data up to the body size from the header.
 //             cerr << _queues[rthead->channel].size() << " messages in queue 
for channel "
 //                  << rthead->channel << endl;
-               if ((rthead->head_size == 1) && (rthead->type != RTMP::PING) ){
+               if ((rthead->head_size == 1)){
 //                 cerr << "FOLLOWING PACKET!" << " for channel " << 
rthead->channel << endl;
 //                 cerr << "Space Left in buffer for channel " << 
rthead->channel << " is: "
 //                      << chunk->spaceLeft() << endl;

=== modified file 'libnet/rtmp.h'
--- a/libnet/rtmp.h     2008-08-28 01:24:04 +0000
+++ b/libnet/rtmp.h     2008-09-04 15:17:06 +0000
@@ -289,7 +289,6 @@
     // bytes another 1 byte RTMP header. The header itself is not part of the 
byte
     // count.
     queues_t *split(amf::Buffer *buf);
-    queues_t *split(amf::Buffer *buf, size_t chunksize);
 
     CQue &operator[] (size_t x) { return _queues[x]; }
     void dump();
@@ -300,7 +299,7 @@
     rtmp_head_t        _header;
     int         _packet_size;
     int         _mystery_word;
-    size_t     _chunksize;
+    size_t     _chunksize[MAX_AMF_INDEXES];
     int                _timeout;
     CQue       _queues[MAX_AMF_INDEXES];
     queues_t    _channels;

=== modified file 'testsuite/libnet.all/test_rtmp.cpp'
--- a/testsuite/libnet.all/test_rtmp.cpp        2008-09-03 20:46:15 +0000
+++ b/testsuite/libnet.all/test_rtmp.cpp        2008-09-04 15:17:06 +0000
@@ -197,7 +197,7 @@
     CQue *que;
 
     Buffer *buf1 = hex2mem("04 00 00 00 00 00 b8 14 01 00 00 00 02 00 08 6f 6e 
53 74 61 74 75 73 00 00 00 00 00 00 00 00 00 05 03 00 05 6c 65 76 65 6c 02 00 
06 73 74 61 74 75 73 00 04 63 6f 64 65 02 00 14 4e 65 74 53 74 72 65 61 6d 2e 
50 6c 61 79 2e 52 65 73 65 74 00 0b 64 65 73 63 72 69 70 74 69 6f 6e 02 00 2d 
50 6c 61 79 69 6e 67 20 61 6e 64 20 72 65 73 65 74 74 69 6e 67 20 67 61 74 65 
30 36 5f 74 61 62 6c 61 6e 5f 62 63 75 65 75 5f 30 31 2e c4 00 07 64 65 74 61 
69 6c 73 02 00 16 67 61 74 65 30 36 5f 74 61 62 6c 61 6e 5f 62 63 75 65 75 5f 
30 31 00 08 63 6c 69 65 6e 74 69 64 00 41 bf e4 78 30 00 00 00 00 00 09");
-    RTMP::queues_t *queues1 = client.split(buf1, 128);
+    RTMP::queues_t *queues1 = client.split(buf1);
     if (queues1->size() == 0) {
         notest = true;
     }
@@ -254,7 +254,7 @@
 //    delete queues1;
     
     Buffer *buf2 = hex2mem("02 00 00 00 00 00 04 01 00 00 00 00 00 00 00 80 02 
00 00 00 00 00 06 04 00 00 00 00 00 04 00 00 00 01 04 00 00 00 00 00 b8 14 01 
00 00 00 02 00 08 6f 6e 53 74 61 74 75 73 00 00 00 00 00 00 00 00 00 05 03 00 
05 6c 65 76 65 6c 02 00 06 73 74 61 74 75 73 00 04 63 6f 64 65 02 00 14 4e 65 
74 53 74 72 65 61 6d 2e 50 6c 61 79 2e 52 65 73 65 74 00 0b 64 65 73 63 72 69 
70 74 69 6f 6e 02 00 2d 50 6c 61 79 69 6e 67 20 61 6e 64 20 72 65 73 65 74 74 
69 6e 67 20 67 61 74 65 30 36 5f 74 61 62 6c 61 6e 5f 62 63 75 65 75 5f 30 31 
2e 02 00 00 00 00 00 06 04 00 00 00 00 00 00 00 00 00 01 c4 00 07 64 65 74 61 
69 6c 73 02 00 16 67 61 74 65 30 36 5f 74 61 62 6c 61 6e 5f 62 63 75 65 75 5f 
30 31 00 08 63 6c 69 65 6e 74 69 64 00 41 d8 fb 78 56 00 00 00 00 00 09");
-    RTMP::queues_t *queues2 = client.split(buf2, 128);
+    RTMP::queues_t *queues2 = client.split(buf2);
     if (queues2->size() == 0) {
         notest = true;
     }    
@@ -349,7 +349,7 @@
     // for other channels.
 //    
...............onStatus.............level...status..code...NetStream.Play.Start..description..'Started
 playing 
gate06_tablan_bcueu_01...clie......'address@hidden;...../..rP.....K.......m......,......%......................B........M.<.$.....`.......i..9..C..J..........%..........G....2Np."address@hidden;.ntid.A..xV.....
     Buffer *buf3 = hex2mem("05 00 00 00 00 00 90 14 01 00 00 00 02 00 08 6f 6e 
53 74 61 74 75 73 00 00 00 00 00 00 00 00 00 05 03 00 05 6c 65 76 65 6c 02 00 
06 73 74 61 74 75 73 00 04 63 6f 64 65 02 00 14 4e 65 74 53 74 72 65 61 6d 2e 
50 6c 61 79 2e 53 74 61 72 74 00 0b 64 65 73 63 72 69 70 74 69 6f 6e 02 00 27 
53 74 61 72 74 65 64 20 70 6c 61 79 69 6e 67 20 67 61 74 65 30 36 5f 74 61 62 
6c 61 6e 5f 62 63 75 65 75 5f 30 31 2e 00 08 63 6c 69 65 07 00 00 00 00 00 27 
09 01 00 00 00 14 00 78 46 0f 14 0f 14 3f 6a ff ff 00 08 9f 40 10 9f f8 8b 3f 
fd b2 4f fb 5d c0 00 00 00 00 00 00 00 00 00 00 00 00 08 00 00 00 00 00 00 08 
01 00 00 00 08 00 00 00 00 01 3b 08 01 00 00 00 2f ff fb 72 50 00 00 00 00 00 
4b 00 00 00 00 07 e0 09 6d 00 00 00 00 00 01 2c 00 00 00 00 1f 80 25 b4 00 00 
00 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff fc 0c 87 42 80 ec c8 b0 0e 90 
c2 12 4d 90 3c 18 24 16 01 88 03 e1 60 1a 1a a0 1a 09 9c 1a 69 a1 10 39 06 8d 
43 02 c3 4a 12 0b 00 c8 1f 0b 00 d8 16 00 25 9f ff ff fe c1 a0 00 00 ff 8a 47 
80 80 0e 1e 32 4e 70 f1 22 ed 31 60 40 f8 02 00 00 00 00 00 04 01 00 00 00 00 
00 00 01 3b c5 6e 74 69 64 00 41 d8 fb 78 56 00 00 00 00 00 09");
-    RTMP::queues_t *queues3 = client.split(buf3, 128);
+    RTMP::queues_t *queues3 = client.split(buf3);
     if (queues3->size() == 0) {
         notest = true;
     }    


reply via email to

[Prev in Thread] Current Thread [Next in Thread]