[Live-devel] Multiple sources question
Ivo Vachkov
ivo.vachkov at gmail.com
Mon Apr 27 08:48:40 PDT 2009
Hello all,
By reading testOnDemandRTSPServer.cpp i figured out that I can have
different ServerMediaSessions and add subsession to each one. However,
it proves to be a bit more complex than that when i comes to network
sources. I have the following code:
const int channels = 128;
struct Stream {
string protocol;
string address;
string port;
string stream;
RTPSink *videoSink;
struct in_addr inputAddress;
Port *inputPort;
Groupsock *inputGroupsock;
ServerMediaSession *sms;
};
int num_streams = 0;
Stream streams[channels];
... to represent a number of multicast streams i would like to
restream over rtsp. And later on in my code I initialise those like
this:
for (int i = 0; i < num_streams; i++) {
cout << streams[i].stream << streams[i].address << streams[i].port << endl;
streams[i].inputAddress.s_addr = our_inet_addr(streams[i].address.c_str());
streams[i].inputPort = new Port(atoi(streams[i].port.c_str()));
unsigned char const inputTTL = 0;
streams[i].inputGroupsock = new Groupsock(*env,
streams[i].inputAddress, *streams[i].inputPort, inputTTL);
streams[i].videoSink = SimpleRTPSink::createNew(*env,
streams[i].inputGroupsock, 33, 90000, "video", "mp2t", 1, True, True
/*no 'M' bit*/);
streams[i].sms = ServerMediaSession::createNew(*env,
streams[i].stream.c_str(), streams[i].stream.c_str(),
descriptionString);
streams[i].sms->addSubsession(PassiveServerMediaSubsession::createNew(*streams[i].videoSink,
NULL));
rtspServer->addServerMediaSession(streams[i].sms);
announceStream(rtspServer, streams[i].sms,
streams[i].stream.c_str(), streams[i].stream.c_str());
}
With one source everything is working fine. However when I have
several multicast sources I get them overlapping on every rtsp url.
For some reason (I guess in my code :) ) different multicast streams
don't go to different sessions. All packets go to all sessions and it
becomes a complete mess.
Any help is greatly appreciated. Thanks in advance.
P.S. I know the source is messy. I'm trying to prove a concept.
More information about the live-devel
mailing list