[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/rtmp r9936: move rtmp_server from libnet t
From: |
rob |
Subject: |
[Gnash-commit] /srv/bzr/gnash/rtmp r9936: move rtmp_server from libnet to cygnal, as it's becoming less generic, and more cygnal specific. |
Date: |
Tue, 30 Dec 2008 15:39:46 -0700 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 9936
committer: address@hidden
branch nick: rtmp
timestamp: Tue 2008-12-30 15:39:46 -0700
message:
move rtmp_server from libnet to cygnal, as it's becoming less generic, and
more cygnal specific.
check the threading flag from the config file. If in single threaded mode,
all RTMP packets are processed in the one function, as there is no distpatch
thread. When multi-threaded, return to the top level after processing a packet
as the distpatch handler will call the rtmp_handler for the next packet of
data.
cygnal almost survives the red5 echo test all the way through!
renamed:
libnet/rtmp_server.cpp => cygnal/rtmp_server.cpp
libnet/rtmp_server.h => cygnal/rtmp_server.h
modified:
cygnal/Makefile.am
libnet/Makefile.am
libnet/handler.cpp
libnet/rtmp.cpp
cygnal/rtmp_server.cpp
cygnal/rtmp_server.h
=== modified file 'cygnal/Makefile.am'
--- a/cygnal/Makefile.am 2008-11-06 19:58:35 +0000
+++ b/cygnal/Makefile.am 2008-12-30 22:39:46 +0000
@@ -66,11 +66,12 @@
$(PTHREAD_CFLAGS)
noinst_HEADERS = \
+ rtmp_server.h \
crc.h
bin_PROGRAMS = cygnal
-cygnal_SOURCES = cygnal.cpp crc.cpp cvm.cpp
+cygnal_SOURCES = cygnal.cpp crc.cpp cvm.cpp rtmp_server.cpp
cygnal_LDADD = $(AM_LDFLAGS)
# Rebuild with GCC 4.x Mudflap support
=== renamed file 'libnet/rtmp_server.cpp' => 'cygnal/rtmp_server.cpp'
--- a/libnet/rtmp_server.cpp 2008-12-30 21:56:25 +0000
+++ b/cygnal/rtmp_server.cpp 2008-12-30 22:39:46 +0000
@@ -42,14 +42,22 @@
#include "utility.h"
#include "buffer.h"
#include "GnashSleep.h"
+#include "crc.h"
+#include "cache.h"
using namespace gnash;
using namespace std;
using namespace amf;
-namespace gnash
+namespace cygnal
{
+// Get access to the global config data for Cygnal
+static CRcInitFile& crcfile = CRcInitFile::getDefaultInstance();
+
+// Get access to the global Cygnal cache
+static Cache& cache = Cache::getDefaultInstance();
+
extern map<int, Handler *> handlers;
RTMPServer::RTMPServer()
@@ -687,9 +695,9 @@
// Adjust the timeout
rtmp->setTimeout(10);
- static boost::shared_ptr<amf::Buffer> pkt;
- static boost::shared_ptr<amf::Element> tcurl;
- static boost::shared_ptr<amf::Element> swfurl;
+ boost::shared_ptr<amf::Buffer> pkt;
+ boost::shared_ptr<amf::Element> tcurl;
+ boost::shared_ptr<amf::Element> swfurl;
// This handler is called everytime there is RTMP data on a socket to
process the
// messsage. Unlike HTTP, RTMP always uses persistant network connections,
so we
@@ -802,7 +810,7 @@
boost::shared_ptr<amf::Buffer> buf = rtmp->recvMsg(args->netfd);
if (buf) {
if (buf->allocated()) {
- buf->dump();
+// buf->dump();
boost::uint8_t *ptr = buf->reference();
if (ptr == 0) {
log_debug("Que empty, net connection dropped for fd #%d",
args->netfd);
@@ -813,11 +821,19 @@
if (echo) {
vector<boost::shared_ptr<amf::Element > > request =
rtmp->parseEchoRequest(ptr, buf->allocated());
boost::shared_ptr<amf::Buffer> result =
rtmp->formatEchoResponse(request[1]->to_number(), *request[2]);
- result->dump();
if (rtmp->sendMsg(args->netfd, rthead->channel,
RTMP::HEADER_8, result->allocated(),
RTMP::INVOKE, RTMPMsg::FROM_SERVER,
*result)) {
log_error("Sent echo test response response to
client.");
- done = false;
+ // If we're in single threaded mode, we Just want to
stay in
+ // this thread for now and do everything all at once.
Otherwise
+ // we're done, so we return to the dispatch handler
waiting for
+ // the next packet. Single threaded mode is primarily
used by
+ // developers for debugging protocols.
+ if (crcfile.getThreadingFlag()) {
+ done = true;
+ } else {
+ done = false;
+ }
} else {
log_error("Couldn't send echo test response to
client!");
done = true;
@@ -828,10 +844,12 @@
}
} else {
log_error("Never read any data from fd #%d", args->netfd);
+ initialize = true;
return false;
}
} else {
log_error("Communication error with client using fd #%d",
args->netfd);
+ initialize = true;
return false;
}
} while (!done);
=== renamed file 'libnet/rtmp_server.h' => 'cygnal/rtmp_server.h'
--- a/libnet/rtmp_server.h 2008-12-29 01:14:01 +0000
+++ b/cygnal/rtmp_server.h 2008-12-30 22:39:46 +0000
@@ -29,11 +29,12 @@
#include "network.h"
#include "buffer.h"
#include "diskstream.h"
+#include "rtmp_msg.h"
-namespace gnash
+namespace cygnal
{
-class DSOEXPORT RTMPServer : public RTMP
+class DSOEXPORT RTMPServer : public gnash::RTMP
{
public:
RTMPServer();
@@ -45,7 +46,7 @@
bool packetRead(amf::Buffer &buf);
// These are handlers for the various types
- boost::shared_ptr<amf::Buffer> encodeResult(RTMPMsg::rtmp_status_e status);
+ boost::shared_ptr<amf::Buffer> encodeResult(gnash::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);
@@ -61,13 +62,13 @@
private:
typedef boost::char_separator<char> Sep;
typedef boost::tokenizer<Sep> Tok;
- DiskStream::filetype_e _filetype;
+ gnash::DiskStream::filetype_e _filetype;
std::string _filespec;
boost::uint32_t _filesize;
};
// This is the thread for all incoming RTMP connections
-bool rtmp_handler(Network::thread_params_t *args);
+bool rtmp_handler(gnash::Network::thread_params_t *args);
} // end of gnash namespace
// end of _RTMP_SERVER_H_
=== modified file 'libnet/Makefile.am'
--- a/libnet/Makefile.am 2008-11-13 01:15:09 +0000
+++ b/libnet/Makefile.am 2008-12-30 22:39:46 +0000
@@ -55,7 +55,6 @@
rtmp.h \
rtmp_msg.h \
rtmp_client.h \
- rtmp_server.h \
statistics.h \
diskstream.h \
cache.h
@@ -70,7 +69,6 @@
rtmp.cpp \
rtmp_msg.cpp \
rtmp_client.cpp \
- rtmp_server.cpp \
statistics.cpp \
diskstream.cpp \
cache.cpp
=== modified file 'libnet/handler.cpp'
--- a/libnet/handler.cpp 2008-12-20 17:11:55 +0000
+++ b/libnet/handler.cpp 2008-12-30 22:39:46 +0000
@@ -38,7 +38,6 @@
#include "dsodefs.h" //For DSOEXPORT.
#include "rtmp.h"
-#include "rtmp_server.h"
#include "http.h"
using namespace gnash;
=== modified file 'libnet/rtmp.cpp'
--- a/libnet/rtmp.cpp 2008-12-30 21:07:49 +0000
+++ b/libnet/rtmp.cpp 2008-12-30 22:39:46 +0000
@@ -261,7 +261,7 @@
head->head_size = headerSize(*tmpptr++);
log_debug (_("The header size is %d"), head->head_size);
- cerr << "FIXME3: " << hexify(in, head->head_size, false) << endl;
+// cerr << "FIXME3: " << hexify(in, head->head_size, false) << endl;
if (head->head_size >= 4) {
_mystery_word = *tmpptr++;
@@ -821,7 +821,7 @@
size_t total_size, content_types_e type,
RTMPMsg::rtmp_source_e routing, amf::Buffer &data)
{
- GNASH_REPORT_FUNCTION;
+// GNASH_REPORT_FUNCTION;
int ret = 0;
// We got some bogus parameters
@@ -1031,7 +1031,7 @@
boost::shared_ptr<amf::Buffer>
RTMP::recvMsg()
{
- GNASH_REPORT_FUNCTION;
+// GNASH_REPORT_FUNCTION;
return recvMsg(getFileFd());
}
@@ -1042,7 +1042,7 @@
boost::shared_ptr<amf::Buffer>
RTMP::recvMsg(int fd)
{
- GNASH_REPORT_FUNCTION;
+// GNASH_REPORT_FUNCTION;
int ret = 0;
bool nopacket = true;
@@ -1051,7 +1051,7 @@
boost::shared_ptr<amf::Buffer> buf(new Buffer(7096));
do {
ret = readNet(fd, buf->reference()+ret, buf->size()-ret, _timeout);
- cerr << __PRETTY_FUNCTION__ << ": " << ret << endl;
+// cerr << __PRETTY_FUNCTION__ << ": " << ret << endl;
// We got data. Resize the buffer if necessary.
if (ret > 0) {
buf->setSeekPointer(buf->reference() + ret);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/rtmp r9936: move rtmp_server from libnet to cygnal, as it's becoming less generic, and more cygnal specific.,
rob <=