[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Ccrtp-devel] Broadcasting RTP
From: |
Jeremy |
Subject: |
Re: [Ccrtp-devel] Broadcasting RTP |
Date: |
Thu, 30 Oct 2003 16:20:57 +0200 (SAST) |
I've been trying to get broadcasting working, and I've hit a bit of a
brick wall. I've copy/paste/edited everything that's different between
unicast and multicast to make broadcast, but I'm not getting any packets.
Here's a diff of my changes, any help would be appreciated:
-----------------------------------
diff -ur ccrtp-1.0.2/src/ccrtp/channel.h jccrtp-1.0.2/src/ccrtp/channel.h
--- ccrtp-1.0.2/src/ccrtp/channel.h 2003-06-07 01:18:48.000000000 +0200
+++ jccrtp-1.0.2/src/ccrtp/channel.h 2003-10-30 11:50:00.000000000 +0200
@@ -129,6 +129,10 @@
{ size_t len; ccioctl(UDPSocket::so,FIONREAD,len); return len; }
Socket::Error
+ setBroadcast(bool enable)
+ { return UDPSocket::setBroadcast(enable); }
+
+ Socket::Error
setMulticast(bool enable)
{ return UDPSocket::setMulticast(enable); }
@@ -223,6 +227,10 @@
{ return recvSocket->getNextPacketSize(); }
Socket::Error
+ setBroadcast(bool enable)
+ { return recvSocket->setBroadcast(enable); }
+
+ Socket::Error
setMulticast(bool enable)
{ return recvSocket->setMulticast(enable); }
diff -ur ccrtp-1.0.2/src/ccrtp/oqueue.h jccrtp-1.0.2/src/ccrtp/oqueue.h
--- ccrtp-1.0.2/src/ccrtp/oqueue.h 2003-06-07 01:18:48.000000000 +0200
+++ jccrtp-1.0.2/src/ccrtp/oqueue.h 2003-10-27 18:56:14.000000000 +0200
@@ -166,6 +166,11 @@
tpport_t controlPort = 0);
bool
+ addDestination(const BroadcastAddress& ia,
+ tpport_t dataPort = DefaultRTPDataPort,
+ tpport_t controlPort = 0);
+
+ bool
forgetDestination(const InetHostAddress& ia,
tpport_t dataPort = DefaultRTPDataPort,
tpport_t controlPort = 0);
@@ -175,6 +180,11 @@
tpport_t dataPort = DefaultRTPDataPort,
tpport_t controlPort = 0);
+ bool
+ forgetDestination(const BroadcastAddress& ia,
+ tpport_t dataPort = DefaultRTPDataPort,
+ tpport_t controlPort = 0);
+
/**
* Determine if outgoing packets are waiting to send.
*
diff -ur ccrtp-1.0.2/src/ccrtp/rtp.h jccrtp-1.0.2/src/ccrtp/rtp.h
--- ccrtp-1.0.2/src/ccrtp/rtp.h 2003-06-07 01:18:48.000000000 +0200
+++ jccrtp-1.0.2/src/ccrtp/rtp.h 2003-10-30 17:57:45.000000000 +0200
@@ -126,6 +126,41 @@
{ build(ia,dataPort,controlPort); }
/**
+ * Builds a session waiting for packets in a broadcast address.
+ * TODO: figure out what still needs to be done for broadcast
+ *
+ * @param ia Broadcast address this socket is to be bound.
+ * @param dataPort Transport port the data socket is to be bound.
+ * @param controlPort Transport port the control socket is to be bound.
+ * @param membersSize Initial size of the membership table.
+ * @param app Application this session is associated to.
+ **/
+ TRTPSessionBase(const BroadcastAddress& ia, tpport_t dataPort,
+ tpport_t controlPort, uint32 membersSize,
+ RTPApplication& app) :
+ ServiceQueue(membersSize,app)
+ { build(ia,dataPort,controlPort); }
+
+ /**
+ * Builds a session waiting for packets in a multicast
+ * address, with the specified ssrc identifier for the local
+ * source.
+ *
+ * @param ssrc SSRC identifier for the local source.
+ * @param ia Broadcast address this socket is to be bound.
+ * @param dataPort Transport port the data socket is to be bound.
+ * @param controlPort Transport port the control socket is to be bound.
+ * @param membersSize Initial size of the membership table.
+ * @param app Application this session is associated to.
+ **/
+ TRTPSessionBase(uint32 ssrc,
+ const BroadcastAddress& ia, tpport_t dataPort,
+ tpport_t controlPort, uint32 membersSize,
+ RTPApplication& app) :
+ ServiceQueue(ssrc,membersSize,app)
+ { build(ia,dataPort,controlPort); }
+
+ /**
* Builds a session waiting for packets in a multicast address.
* TODO: ssrc constructor for multicast!
*
@@ -298,6 +333,23 @@
joinGroup(ia);
}
+ void
+ build(const BroadcastAddress& ia, tpport_t dataPort,
+ tpport_t controlPort)
+ {
+ if ( 0 == controlPort ) {
+ dataBasePort = even_port(dataPort);
+ controlBasePort = dataBasePort + 1;
+ } else {
+ dataBasePort = dataPort;
+ controlBasePort = controlPort;
+ }
+ dso = new RTPDataChannel(ia,dataBasePort);
+ cso = new RTCPChannel(ia,controlBasePort);
+ dso->setBroadcast(true);
+ cso->setBroadcast(true);
+ }
+
/**
* Join a multicast group.
*
@@ -432,6 +484,18 @@
(ia,dataPort,controlPort,memberssize,app)
{ }
+ SingleThreadRTPSession(const BroadcastAddress& ia,
+ tpport_t dataPort = DefaultRTPDataPort,
+ tpport_t controlPort = 0,
+ int pri = 0,
+ uint32 memberssize =
+ MembershipBookkeeping::defaultMembersHashSize,
+ RTPApplication& app = defaultApplication()):
+ Thread(pri),
+ TRTPSessionBase<RTPDataChannel,RTCPChannel,ServiceQueue>
+ (ia,dataPort,controlPort,memberssize,app)
+ { }
+
~SingleThreadRTPSession()
{ terminate(); }
diff -ur ccrtp-1.0.2/src/Makefile jccrtp-1.0.2/src/Makefile
--- ccrtp-1.0.2/src/Makefile 2003-10-30 17:59:39.000000000 +0200
+++ jccrtp-1.0.2/src/Makefile 2003-10-27 19:01:38.000000000 +0200
@@ -157,7 +157,7 @@
CXXLD = $(CXX)
CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
-CXXFLAGS = -g -O2 -I/usr/local/include/cc++2 -g -O2 -I/usr/local/include
-D_GNU_SOURCE
+CXXFLAGS = -g -O2 -I/usr/local/arm/3.2.3/include/cc++2 -g -O2
-I/usr/local/include -D_GNU_SOURCE
DIST_SOURCES = $(libccrtp1_la_SOURCES)
HEADERS = $(noinst_HEADERS)
diff -ur ccrtp-1.0.2/src/outqueue.cpp jccrtp-1.0.2/src/outqueue.cpp
--- ccrtp-1.0.2/src/outqueue.cpp 2003-06-07 01:18:47.000000000 +0200
+++ jccrtp-1.0.2/src/outqueue.cpp 2003-10-27 18:56:47.000000000 +0200
@@ -194,6 +194,21 @@
}
bool
+OutgoingDataQueue::addDestination(const BroadcastAddress& ia,
+ tpport_t dataPort,
+ tpport_t controlPort)
+{
+ if ( 0 == controlPort )
+ controlPort = dataPort + 1;
+ bool result = addDestinationToList(ia,dataPort,controlPort);
+ if ( result && isSingleDestination() ) {
+ setDataPeer(ia,dataPort);
+ setControlPeer(ia,controlPort);
+ }
+ return result;
+}
+
+bool
OutgoingDataQueue::forgetDestination(const InetHostAddress& ia,
tpport_t dataPort,
tpport_t controlPort)
@@ -216,6 +231,17 @@
}
bool
+OutgoingDataQueue::forgetDestination(const BroadcastAddress& ia,
+ tpport_t dataPort,
+ tpport_t controlPort)
+{
+ if ( 0 == controlPort )
+ controlPort = dataPort + 1;
+ return DestinationListHandler::
+ removeDestinationFromList(ia,dataPort,controlPort);
+}
+
+bool
OutgoingDataQueue::isSending(void) const
{
if(sendFirst)
-----------------------------------
--J