[Live-devel] RTPSource/Sink sharing the same groupsock (I think I sent this originally to the wrong group)
Ben Rush
ben at ben-rush.net
Wed Jun 8 07:10:29 PDT 2016
Sorry if this is a double-post, as I think I sent the previous email to the
wrong list.
Ross,
>From a previous conversation we had, you mentioned it was possible, and
easy, to have "full-duplex" mode, in that RTPSink and RTPSource share a
Groupsock and therefore share a TCP/IP socket. I'm looking to do this and
need a bit more direction.
Ultimately the goal is to have one "server" which resides in a room and
provides video + two-way audio to a monitoring station. If the monitoring
station wishes to have a conversation with the room, then it can do so
using the two-way audio. To simply everything we figured it'd be easiest to
just have the two-way audio over the same socket.
The problem is I'm still pretty green and so I'm trying to write something
simple at first and build my way up. I sub-classed MultiFramedRTPSource and
made my own streamer class (I'm trying to just write something which can
receive the L16 audio my server is sending).
class WaveFormDataStreamer : public MultiFramedRTPSource
{
public:
static WaveFormDataStreamer* createNew(UsageEnvironment& env,
Groupsock* RTPgs,
unsigned char rtpPayloadFormat = 14,
unsigned rtpTimestampFrequency = 90000);
protected:
virtual ~WaveFormDataStreamer();
private:
WaveFormDataStreamer(UsageEnvironment& env, Groupsock* RTPgs,
unsigned char rtpPayloadFormat,
unsigned int rtpTimestampFrequence);
virtual char const* MIMEtype() const;
};
I then am trying to use that to connect to my RTSP server (which is
currenly one way audio only):
TaskScheduler* scheduler = BasicTaskScheduler::createNew();
UsageEnvironment* environment =
BasicUsageEnvironment::createNew(*scheduler);
unsigned int rtpPortNum = 8554;
unsigned int rtcpPortNum = rtpPortNum + 1;
char* ipAddress = "172.17.5.156";
struct in_addr address;
address.S_un.S_addr = our_inet_addr(ipAddress);
const Port rtpPort(rtpPortNum);
const Port rtcpPort(rtcpPortNum);
Groupsock rtpGroupSock(*environment, address, rtpPort, 1);
Groupsock rtcpGroupSock(*environment, address, rtcpPort, 1);
RTPSource* rtpSource = WaveFormDataStreamer::createNew(*environment,
&rtpGroupSock);
const unsigned maxCNAMElen = 100;
unsigned char CNAME[maxCNAMElen + 1];
gethostname((char*)CNAME, maxCNAMElen);
CNAME[maxCNAMElen] = '\0'; // just in case
RTCPInstance* rtcpInstance =
RTCPInstance::createNew(*environment, &rtcpGroupSock, 160, CNAME,
NULL, rtpSource);
*environment << "Beginning receiving multicast stream...\n";
FileSink* sink = FileSink::createNew(*environment,
"c:/users/brush/desktop/test.dat");
sink->startPlaying(*rtpSource, afterPlaying, NULL);
environment->taskScheduler().doEventLoop(); // does not return
The problem is that I think what I need is an RTSPClient, not an RTPSource,
because I'm trying to access my RTSP server and need a stream name (which
in this case is "feynman"). Right?
So I put together a hierarchy diagram of the classes that I'm interested in
to get a better understanding (
https://docs.google.com/drawings/d/1jRJ9-BeEC9UqCGkl_gAk-av_ahP04S7sgW_Q9r4DG74/edit?usp=sharing),
but as a result I'm failing to see how I can use RTPSource/Sink in this
situation as I'm trying to talk to an RTSP server.
I will agree I'm possibly missing something very fundamental here (which is
why I'm asking).
Any help/advice would be great. If there's good sample code you want me to
research to answer my questions let me know. I looked into playCommon.cpp
but, again, that tells me I should use RTSPClient.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20160608/10beb411/attachment.html>
More information about the live-devel
mailing list