[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/rtmp r9653: Buffer is a shared_ptr now.
From: |
rob |
Subject: |
[Gnash-commit] /srv/bzr/gnash/rtmp r9653: Buffer is a shared_ptr now. |
Date: |
Sun, 21 Sep 2008 18:26:39 -0600 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 9653
committer: address@hidden
branch nick: rtmp
timestamp: Sun 2008-09-21 18:26:39 -0600
message:
Buffer is a shared_ptr now.
modified:
libnet/http.cpp
libnet/rtmp.cpp
libnet/rtmp_client.cpp
libnet/rtmp_client.h
libnet/rtmp_msg.cpp
libnet/rtmp_server.cpp
libnet/rtmp_server.h
=== modified file 'libnet/http.cpp'
--- a/libnet/http.cpp 2008-09-18 03:45:44 +0000
+++ b/libnet/http.cpp 2008-09-22 00:26:39 +0000
@@ -455,15 +455,15 @@
formatHeader(_filesize, code);
// int ret = Network::writeNet(_header.str());
- amf::Buffer *buf = new amf::Buffer;
+ boost::scoped_ptr<amf::Buffer> buf(new amf::Buffer);
// Network::byte_t *ptr = (Network::byte_t *)_body.str().c_str();
// buf->copy(ptr, _body.str().size());
// _handler->dump();
if (_header.str().size()) {
buf->resize(_header.str().size());
string str = _header.str();
- buf->copy(str);
- _handler->pushout(buf);
+ *buf = str;
+// _handler->pushout(buf); FIXME:
_handler->notifyout();
log_debug (_("Sent GET Reply"));
return true; // Default to true
@@ -1205,15 +1205,13 @@
string docroot = args->filespec;
- while (!hand->timetodie()) {
- log_debug(_("Waiting for HTTP GET request on fd #%d..."), args->netfd);
+ log_debug("Starting to wait for data in net for fd #%d", args->netfd);
+
+ // Wait for data, and when we get it, process it.
+ do {
+ hand->readPacket(args->netfd);
+#if 0
hand->wait();
- // This thread is the last to wake up when the browser
- // closes the network connection. When browsers do this
- // varies, elinks and lynx are very forgiving to a more
- // flexible HTTP protocol, which Firefox/Mozilla & Opera
- // are much pickier, and will hang or fail to load if
- // you aren't careful.
if (hand->timetodie()) {
log_debug("Not waiting no more, no more for more HTTP data for fd
#%d...", args->netfd);
map<int, Handler *>::iterator hit = handlers.find(args->netfd);
@@ -1225,6 +1223,7 @@
}
return;
}
+#endif
#ifdef USE_STATISTICS
struct timespec start;
clock_gettime (CLOCK_REALTIME, &start);
@@ -1332,7 +1331,7 @@
#endif
// conndata->statistics->dump();
// }
- } // end of while retries
+ } while(!hand->timetodie());
log_debug("httphandler all done now finally...");
=== modified file 'libnet/rtmp.cpp'
--- a/libnet/rtmp.cpp 2008-09-04 15:17:06 +0000
+++ b/libnet/rtmp.cpp 2008-09-22 00:26:39 +0000
@@ -149,6 +149,8 @@
// GNASH_REPORT_FUNCTION;
int headersize = -1;
+
+ cerr << "Header size value: " << (void *)header << endl;
switch (header & RTMP_HEADSIZE_MASK) {
case HEADER_12:
@@ -254,10 +256,6 @@
_header.head_size = headerSize(*tmpptr++);
log_debug (_("The header size is %d"), _header.head_size);
- if (_header.head_size == 1) {
- _header.bodysize = sizeof(boost::uint16_t) * 2;
- }
-
if (_header.head_size >= 4) {
_mystery_word = *tmpptr++;
_mystery_word = (_mystery_word << 12) + *tmpptr++;
@@ -285,6 +283,16 @@
}
}
+ if (_header.head_size == 1) {
+ if (_header.channel == RTMP_SYSTEM_CHANNEL) {
+ _header.bodysize = sizeof(boost::uint16_t) * 3;
+ log_debug("Got a one byte header system message: %s", hexify(in,
_header.bodysize, false));
+ } else {
+ log_debug("Got a continuation packet for channel #%d",
_header.channel);
+ _header.bodysize = 0;
+ }
+ }
+
// switch(_header.type) {
// case CHUNK_SIZE:
// case BYTES_READ:
@@ -475,13 +483,13 @@
amf::Element *app = getProperty("app");
if (file) {
- log_debug("SWF file %s", file->getData());
+ log_debug("SWF file %s", file->to_string());
}
if (url) {
- log_debug("is Loading video %s", url->getData());
+ log_debug("is Loading video %s", url->to_string());
}
if (app) {
- log_debug("is file name is %s", app->getData());
+ log_debug("is file name is %s", app->to_string());
}
return true;
@@ -605,7 +613,7 @@
// The first data object is the method name of this object.
Element *name = amf_obj.extractAMF(ptr, tooFar);
if (name) {
- ptr += name->getLength() + 3; // skip the length bytes too
+ ptr += name->getDataSize() + 3; // skip the length bytes too
} else {
log_error("Name field of RTMP Message corrupted!");
return 0;
@@ -618,7 +626,7 @@
// Most onStatus messages have the stream ID, but the Data Start
onStatus
// message is basically just a marker that an FLV file is coming next.
if (streamid->getType() == Element::NUMBER_AMF0) {
- ptr += streamid->getLength() + 2;
+ ptr += streamid->getDataSize() + 2;
}
} else {
log_error("Stream ID field of RTMP Message corrupted!");
@@ -1053,15 +1061,18 @@
Buffer *chunk = 0;
while ((ptr - buf->reference()) < buf->size()) {
rthead = decodeHeader(ptr);
+ if (rthead->channel == RTMP_SYSTEM_CHANNEL) {
+ log_debug("Got a message on the system channel");
+ ptr += rthead->head_size + rthead->bodysize;
+ continue;
+ }
// Make sure the header size is in range
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)) {
- // This is a queue of channels with active messages
- _channels.push_back(&_queues[rthead->channel]);
-// cerr << "New packet for channel #" << rthead->channel << " of
size "
-// << (rthead->head_size + rthead->bodysize) << endl;
+ cerr << "New packet for channel #" << rthead->channel << " of
size "
+ << (rthead->head_size + rthead->bodysize) << endl;
chunk = new Buffer(rthead->bodysize + rthead->head_size);
chunk->clear(); // FIXME: temporary debug only, should be
unnecessary
_queues[rthead->channel].push(chunk);
@@ -1069,6 +1080,15 @@
// Use the existing Buffer for this pkt
chunk = _queues[rthead->channel].peek();
}
+ // Red5 version 5 sends out PING messages with a 1 byte header. I
think this
+ // may be a bug in Red5, but we should handle it anyway.
+ if (chunk == 0) {
+ cerr << "Chunk wasn't allocated! " << (rthead->bodysize +
rthead->head_size) << endl;
+ chunk = new Buffer(rthead->bodysize + rthead->head_size);
+ chunk->clear(); // FIXME: temporary debug only, should be
unnecessary
+ _queues[rthead->channel].push(chunk);
+ }
+
// Many RTMP messages are smaller than the chunksize
if (chunk->size() <= _chunksize[rthead->channel]) {
// a single byte header has no length field. As these are often
@@ -1083,7 +1103,11 @@
if (rthead->head_size > 1) {
pktsize = rthead->head_size + _chunksize[rthead->channel];
} else {
- pktsize = rthead->head_size + (chunk->size() -
_chunksize[rthead->channel]);
+ if ((rthead->head_size + chunk->size()) <
_chunksize[rthead->channel]) {
+ pktsize = rthead->head_size + chunk->size();
+ } else {
+ pktsize = rthead->head_size + (chunk->size() -
_chunksize[rthead->channel]);
+ }
}
}
@@ -1094,21 +1118,27 @@
// 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)){
-// cerr << "FOLLOWING PACKET!" << " for channel " <<
rthead->channel << endl;
-// cerr << "Space Left in buffer for channel " <<
rthead->channel << " is: "
-// << chunk->spaceLeft() << endl;
+ 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;
ptr += rthead->head_size;
pktsize -= rthead->head_size;
// } else {
// cerr << "FIRST PACKET!" << " for channel " <<
rthead->channel << endl;
}
- chunk->append(ptr, pktsize);
-// cerr << "Adding data to existing packet for channel #" <<
rthead->channel
-// << ", read " << nbytes << " bytes." << endl;
- ptr += pktsize;
+ // This is a queue of channels with active messages
+ _channels.push_back(&_queues[rthead->channel]);
+ if (pktsize < 0xffffff) {
+ chunk->append(ptr, pktsize);
+ cerr << "Adding data to existing packet for channel #" <<
rthead->channel
+ << ", read " << pktsize << " bytes." << endl;
+ ptr += pktsize;
+ } else {
+ log_error("Packet size out of range! %d, %d",
rthead->bodysize, pktsize);
+ }
} else {
- log_error("RTMP packet size is out of range! %d", pktsize);
+ log_error("RTMP packet size is out of range! %d, %d",
rthead->bodysize, pktsize);
break;
}
} else {
=== modified file 'libnet/rtmp_client.cpp'
--- a/libnet/rtmp_client.cpp 2008-09-06 07:35:31 +0000
+++ b/libnet/rtmp_client.cpp 2008-09-22 00:26:39 +0000
@@ -71,7 +71,7 @@
// Make the NetConnection object that is used to connect to the
// server.
-amf::Buffer *
+boost::shared_ptr<Buffer>
RTMPClient::encodeConnect(const char *app, const char *swfUrl, const char
*tcUrl,
double audioCodecs, double videoCodecs, double
videoFunction,
const char *pageUrl)
@@ -151,27 +151,22 @@
// RTMP::INVOKE, RTMP::FROM_CLIENT);
// const char *rtmpStr = "03 00 00 04 00 01 1f 14 00 00 00 00";
// Buffer *rtmpBuf = hex2mem(rtmpStr);
- Buffer *conobj = connect.encode();
- Buffer *numobj = connum.encode();
- Buffer *encobj = obj.encode();
-
- Buffer *buf = new Buffer(conobj->size() + numobj->size() + encobj->size());
-// buf->append(out);
- buf->append(conobj);
- buf->append(numobj);
- buf->append(encobj);
-
- delete conobj;
- delete numobj;
- delete encobj;
-
+ boost::shared_ptr<Buffer> conobj = connect.encode();
+ boost::shared_ptr<Buffer> numobj = connum.encode();
+ boost::shared_ptr<Buffer> encobj = obj.encode();
+
+ boost::shared_ptr<Buffer> buf(new Buffer(conobj->size() + numobj->size() +
encobj->size()));
+ *buf += conobj;
+ *buf += numobj;
+ *buf += encobj;
+
return buf;
}
// 43 00 1a 21 00 00 19 14 02 00 0c 63 72 65 61 74 C..!.......creat
// 65 53 74 72 65 61 6d 00 40 08 00 00 00 00 00 00 address@hidden
// 05 .
-amf::Buffer *
+boost::shared_ptr<Buffer>
RTMPClient::encodeStream(double id)
{
// GNASH_REPORT_FUNCTION;
@@ -181,39 +176,23 @@
Element str = new Element;
str.makeString("createStream");
- Buffer *strobj = str.encode();
- if (!strobj) {
- return 0;
- }
+ boost::shared_ptr<Buffer> strobj = str.encode();
Element num = new Element;
num.makeNumber(id);
- Buffer *numobj = num.encode();
- if (!numobj) {
- return 0;
- }
+ boost::shared_ptr<Buffer> numobj = num.encode();
- Buffer *buf = new Buffer(strobj->size() + numobj->size());
- if (!buf) {
- return 0;
- }
+ boost::shared_ptr<Buffer> buf(new Buffer(strobj->size() + numobj->size()));
// Set the NULL object element that follows the stream ID
Element null;
null.makeNull();
- Buffer *nullobj = null.encode();
- if (!nullobj) {
- return 0;
- }
-
- buf->append(strobj);
- buf->append(numobj);
- buf->append(nullobj);
-
- delete strobj;
- delete numobj;
- delete nullobj;
-
+ boost::shared_ptr<Buffer> nullobj = null.encode();
+
+ *buf += strobj;
+ *buf += numobj;
+ *buf += nullobj;
+
return buf;
}
@@ -223,21 +202,21 @@
// 6f 6e 32 5f 66 6c 61 73 68 38 5f 77 5f 61 75 64 on2_flash8_w_aud
// 69 6f 2e 66 6c 76 c2 00 03 00 00 00 01 00 00 27 io.flv.........'
// 10
-amf::Buffer *
+boost::shared_ptr<Buffer>
RTMPClient::encodeStreamOp(double id, rtmp_op_e op, bool flag)
{
// GNASH_REPORT_FUNCTION;
return encodeStreamOp(id, op, flag, "", 0);
}
-amf::Buffer *
+boost::shared_ptr<Buffer>
RTMPClient::encodeStreamOp(double id, rtmp_op_e op, bool flag, double pos)
{
// GNASH_REPORT_FUNCTION;
return encodeStreamOp(id, op, flag, "", pos);
}
-amf::Buffer *
+boost::shared_ptr<Buffer>
RTMPClient::encodeStreamOp(double id, rtmp_op_e op, bool flag, const
std::string &name)
{
// GNASH_REPORT_FUNCTION;
@@ -250,7 +229,7 @@
// A pause packet is the operation name "pause", followed by the stream ID,
// then a NULL object, a boolean (always true from what I can tell), and then
// a location, which appears to always be 0.
-amf::Buffer *
+boost::shared_ptr<Buffer>
RTMPClient::encodeStreamOp(double id, rtmp_op_e op, bool flag, const
std::string &name, double pos)
{
// GNASH_REPORT_FUNCTION;
@@ -274,37 +253,26 @@
str.makeString("seek");
break;
default:
- return 0;
+ boost::shared_ptr<Buffer> foo;
+ return foo;
};
- Buffer *strobj = str.encode();
- if (!strobj) {
- return 0;
- }
+ boost::shared_ptr<Buffer> strobj = str.encode();
// Set the stream ID, which follows the command
Element strid;
strid.makeNumber(id);
- Buffer *stridobj = strid.encode();
- if (!stridobj) {
- return 0;
- }
+ boost::shared_ptr<Buffer> stridobj = strid.encode();
// Set the NULL object element that follows the stream ID
Element null;
null.makeNull();
- Buffer *nullobj = null.encode();
- if (!nullobj) {
- return 0;
- }
+ boost::shared_ptr<Buffer> nullobj = null.encode();
// Set the BOOLEAN object element that is the last field in the packet
Element boolean;
boolean.makeBoolean(flag);
- Buffer *boolobj = boolean.encode();
- if (!boolobj) {
- return 0;
- }
+ boost::shared_ptr<Buffer> boolobj = boolean.encode();
// Calculate the packet size, rather than use the default as we want to
// to be concious of the memory usage. The command name and the optional
@@ -313,24 +281,14 @@
// Add 2 bytes for the Boolean, and 16 bytes for the two doubles, which are
// 8 bytes apiece.
pktsize += (sizeof(double) * 2) + 2;
- Buffer *buf = new Buffer(pktsize);
- buf->clear();
-// Buffer *buf = new Buffer;
-
- if (!buf) {
- return 0;
- }
- buf->append(strobj);
- delete strobj;
- buf->append(stridobj);
- delete stridobj;
- buf->append(nullobj);
- delete nullobj;
+ boost::shared_ptr<Buffer> buf(new Buffer(pktsize));
+ *buf += strobj;
+ *buf += stridobj;
+ *buf += nullobj;
// Seek doesn't use the boolean flag
if ((op != STREAM_SEEK) && (op != STREAM_PLAY)) {
- buf->append(boolobj);
+ *buf += boolobj;
}
- delete boolobj;
// The play command has an optional field, which is the name of the file
// used for the stream. A Play command without this name set play an
@@ -338,21 +296,16 @@
if (!name.empty()) {
Element filespec;
filespec.makeString(name);
- Buffer *fileobj = filespec.encode();
- buf->append(fileobj);
- delete fileobj;
+ boost::shared_ptr<Buffer> fileobj = filespec.encode();
+ *buf += fileobj;
}
// The seek command also may have an optional location to seek to
if ((op == STREAM_PAUSE) || (op == STREAM_SEEK)) {
Element seek;
seek.makeNumber(pos);
- Buffer *posobj = seek.encode();
- if (!posobj) {
- return 0;
- }
- buf->append(posobj);
- delete posobj;
+ boost::shared_ptr<Buffer> posobj = seek.encode();
+ *buf += posobj;
}
return buf;
@@ -372,13 +325,13 @@
}
// All RTMP connections start with a 0x3
- _handshake->copy(RTMP_HANDSHAKE);
+ *_handshake = RTMP_HANDSHAKE;
// Since we don't know what the format is, create a pattern we can
// recognize if we stumble across it later on.
for (int i=0; i<RTMP_BODY_SIZE; i++) {
Network::byte_t pad = i^256;
- _handshake->append(pad);
+ *_handshake += pad;
}
int ret = writeNet(_handshake);
=== modified file 'libnet/rtmp_client.h'
--- a/libnet/rtmp_client.h 2008-06-17 13:55:12 +0000
+++ b/libnet/rtmp_client.h 2008-09-22 00:26:39 +0000
@@ -19,6 +19,7 @@
#define _RTMP_CLIENT_H_ 1
#include <boost/cstdint.hpp>
+#include <boost/shared_ptr.hpp>
#include <string>
#include <map>
#include <time.h>
@@ -46,15 +47,15 @@
// These are used for creating the primary objects
// Create the initial object sent to the server, which is
NetConnection::connect()
- amf::Buffer *encodeConnect(const char *app, const char *swfUrl, const char
*tcUrl,
- double audioCodecs, double videoCodecs, double
videoFunction,
- const char *pageUrl);
+ boost::shared_ptr<amf::Buffer> encodeConnect(const char *app, const char
*swfUrl, const char *tcUrl,
+ double audioCodecs, double videoCodecs,
double videoFunction,
+ const char *pageUrl);
// Create the second object sent to the server, which is
NetStream():;NetStream()
- amf::Buffer *encodeStream(double id);
- amf::Buffer *encodeStreamOp(double id, rtmp_op_e op, bool flag);
- amf::Buffer *encodeStreamOp(double id, rtmp_op_e op, bool flag, double
pos);
- amf::Buffer *encodeStreamOp(double id, rtmp_op_e op, bool flag, const
std::string &name);
- amf::Buffer *encodeStreamOp(double id, rtmp_op_e op, bool flag, const
std::string &name, double pos);
+ boost::shared_ptr<amf::Buffer> encodeStream(double id);
+ boost::shared_ptr<amf::Buffer> encodeStreamOp(double id, rtmp_op_e op,
bool flag);
+ boost::shared_ptr<amf::Buffer> encodeStreamOp(double id, rtmp_op_e op,
bool flag, double pos);
+ boost::shared_ptr<amf::Buffer> encodeStreamOp(double id, rtmp_op_e op,
bool flag, const std::string &name);
+ boost::shared_ptr<amf::Buffer> encodeStreamOp(double id, rtmp_op_e op,
bool flag, const std::string &name, double pos);
void dump();
private:
=== modified file 'libnet/rtmp_msg.cpp'
--- a/libnet/rtmp_msg.cpp 2008-08-28 01:26:22 +0000
+++ b/libnet/rtmp_msg.cpp 2008-09-22 00:26:39 +0000
@@ -97,7 +97,7 @@
// child->dump();
string name = child->getName();
string value;
- if (child->getLength()) {
+ if (child->getDataSize()) {
value = child->to_string();
if (name == "code") {
// log_debug("Name is: %s, Value is: %s",
name.c_str(), value.c_str());
=== modified file 'libnet/rtmp_server.cpp'
--- a/libnet/rtmp_server.cpp 2008-09-03 20:46:15 +0000
+++ b/libnet/rtmp_server.cpp 2008-09-22 00:26:39 +0000
@@ -25,6 +25,7 @@
#include <string>
#include <map>
#include <boost/cstdint.hpp>
+#include <boost/shared_ptr.hpp>
#include <boost/detail/endian.hpp>
#if ! (defined(_WIN32) || defined(WIN32))
@@ -116,14 +117,14 @@
{
GNASH_REPORT_FUNCTION;
- amf::Buffer *buf1 = new amf::Buffer(RTMP_BODY_SIZE + 1);
- *buf1->begin() = RTMP_HANDSHAKE;
- buf1->append(_handshake);
- _handler->pushout(buf1);
+ boost::shared_ptr<amf::Buffer> buf1(new amf::Buffer(RTMP_BODY_SIZE + 1));
+ *buf1 = RTMP_HANDSHAKE;
+ *buf1 += _handshake;
+// _handler->pushout(buf1); FIXME:
- amf::Buffer *buf2 = new amf::Buffer(RTMP_BODY_SIZE);
+ boost::shared_ptr<amf::Buffer> buf2(new amf::Buffer(RTMP_BODY_SIZE));
buf2->copy(_handshake->begin(), RTMP_BODY_SIZE);
- _handler->pushout(buf2);
+// _handler->pushout(buf2); FIXME:
// std::copy(_handshake->begin(), _handshake->end(), (buf1->begin() + 1));
// amf::Buffer *buf = new amf::Buffer(RTMP_BODY_SIZE + 1);
@@ -342,13 +343,13 @@
Element *app = getProperty("app");
if (file) {
- log_debug("SWF file %s", file->getData());
+ log_debug("SWF file %s", file->to_string());
}
if (url) {
- log_debug("is Loading video %s", url->getData());
+ log_debug("is Loading video %s", url->to_string());
}
if (app) {
- log_debug("is file name is %s", app->getData());
+ log_debug("is file name is %s", app->to_string());
}
return true;
@@ -368,7 +369,7 @@
//
// _result(double ClientStream, NULL, double ServerStream)
// These are handlers for the various types
-amf::Buffer *
+boost::shared_ptr<Buffer>
RTMPServer::encodeResult(RTMPMsg::rtmp_status_e status)
{
GNASH_REPORT_FUNCTION;
@@ -489,22 +490,19 @@
break;
};
- Buffer *strbuf = str->encode();
- Buffer *numbuf = number->encode();
- Buffer *topbuf = top.encode();
+ boost::shared_ptr<amf::Buffer> strbuf = str->encode();
+ boost::shared_ptr<amf::Buffer> numbuf = number->encode();
+ boost::shared_ptr<amf::Buffer> topbuf = top.encode();
- Buffer *buf = new Buffer(strbuf->size() + numbuf->size() + topbuf->size());
- buf->append(strbuf);
- buf->append(numbuf);
+ boost::shared_ptr<amf::Buffer> buf(new Buffer(strbuf->size() +
numbuf->size() + topbuf->size()));
+ *buf += strbuf;
+ *buf += numbuf;
Network::byte_t byte = static_cast<Network::byte_t>(RTMP::SERVER &
0x000000ff);
- buf->append(byte);
- buf->append(topbuf);
+ *buf += byte;
+ *buf += topbuf;
delete str;
delete number;
- delete strbuf;
- delete numbuf;
-// delete topbuf;// FIXME: deleting this shouldn't core dump.
return buf;
}
@@ -613,18 +611,18 @@
// A RTMP Ping packet looks like this: "02 00 00 00 00 00 06 04 00 00 00 00 00
00 00 00 00 0",
// which is the Ping type byte, followed by two shorts that are the
parameters. Only the first
// two paramters are required.
-amf::Buffer *
+boost::shared_ptr<Buffer>
RTMPServer::encodePing(rtmp_ping_e type)
{
GNASH_REPORT_FUNCTION;
return encodePing(type, 0);
}
-amf::Buffer *
+boost::shared_ptr<Buffer>
RTMPServer::encodePing(rtmp_ping_e type, boost::uint32_t milliseconds)
{
GNASH_REPORT_FUNCTION;
- Buffer *buf = new Buffer(sizeof(boost::uint16_t) * 3);
+ boost::shared_ptr<amf::Buffer> buf(new Buffer(sizeof(boost::uint16_t) *
3));
Network::byte_t *ptr = buf->reference();
buf->clear(); // default everything to zeros, real data gets
optionally added.
@@ -636,7 +634,7 @@
ptr += sizeof(boost::uint16_t); // go past the first short
boost::uint32_t swapped = 0;
- buf->copy(typefield);
+ *buf = typefield;
switch (type) {
// These two don't appear to have any paramaters
case PING_CLEAR:
@@ -648,7 +646,7 @@
ptr += sizeof(boost::uint16_t); // go past the second short
swapped = milliseconds;
swapBytes(&swapped, sizeof(boost::uint32_t));
- buf->append(swapped);
+ buf->append((Network::byte_t *)&swapped, sizeof(boost::uint32_t));
break;
}
// reset doesn't have any parameters
@@ -661,11 +659,10 @@
// swapped = htonl(milliseconds);
swapped = milliseconds;
swapBytes(&swapped, sizeof(boost::uint32_t));
- buf->append(swapped);
+ buf->append((Network::byte_t *)&swapped, sizeof(boost::uint32_t));
break;
}
default:
- return 0;
break;
};
=== modified file 'libnet/rtmp_server.h'
--- a/libnet/rtmp_server.h 2008-08-14 04:24:41 +0000
+++ b/libnet/rtmp_server.h 2008-09-22 00:26:39 +0000
@@ -19,6 +19,7 @@
#define _RTMP_SERVER_H_ 1
#include <boost/cstdint.hpp>
+#include <boost/shared_ptr.hpp>
#include <string>
#include <map>
@@ -43,9 +44,9 @@
bool packetRead(amf::Buffer *buf);
// These are handlers for the various types
- amf::Buffer *encodeResult(RTMPMsg::rtmp_status_e status);
- amf::Buffer *encodePing(rtmp_ping_e type, boost::uint32_t milliseconds);
- amf::Buffer *encodePing(rtmp_ping_e type);
+ boost::shared_ptr<amf::Buffer> encodeResult(RTMPMsg::rtmp_status_e status);
+ boost::shared_ptr<amf::Buffer> encodePing(rtmp_ping_e type,
boost::uint32_t milliseconds);
+ boost::shared_ptr<amf::Buffer> encodePing(rtmp_ping_e type);
void dump();
private:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/rtmp r9653: Buffer is a shared_ptr now.,
rob <=