[Live-devel] Changing from Multicast to Unicast
Ross Finlayson
finlayson at live555.com
Fri Oct 25 00:04:12 PDT 2013
> Am I missing a step in the remove code ?
Yes. What you're missing is that a "PassiveServerMediaSubsession" object refers to a stream that exists independently (as opposed to an "OnDemandServerMediaSubsession", that creates (and destroys) its own stream, on demand). Therefore, for the multicast case, you need to not only create the stream separately, you also need to destroy it separately. In particular, to destroy it, you should delete objects in this order:
Medium::close(rtcp);
Medium::close(sink);
Medium::close(videoSource); // note that this will also automatically delete the "vidSrc"("MPEG2TransportStreamFromESSource") and "source" objects
delete rtcpGroupsock;
delete rtpGroupsock;
Also:
> To remove
> rtspServer->deleteServerMediaSession(stream->sms);
> stream->sms->deleteAllSubsessions();
The second statement is unnecessary. Even worse, it can cause a crash, because the first statement deletes the "stream->sms" object!
> (For Multicast)
> const Port rtpPort(stream->rtpPort);
> Groupsock *rtpGroupsock = new Groupsock(*env, destaddr, rtpPort, stream->ttl);
> rtpGroupsock->multicastSendOnly();
> const Port rtcpPort(stream->rtcpPort);
> Groupsock *rtcpGroupsock = new Groupsock(*env, destaddr, rtcpPort, stream->ttl);
> rtcpGroupsock->multicastSendOnly();
> RTPSink *sink = SimpleRTPSink::createNew(*env, rtpGroupsock, 33, 90000, "video", "MP2T", 1, True, False /*no 'M' bit*/);
> RTCPInstance *rtcp = RTCPInstance::createNew(*env, rtcpGroupsock, estimatedSessionBandwidth, CNAME, sink, NULL, True);
> stream->sms->addSubsession(PassiveServerMediaSubsession::createNew(*sink, rtcp));
> MPEG2TransportStreamFromESSource *vidSrc = MPEG2TransportStreamFromESSource::createNew(*env);
> vidSrc->addNewVideoSource(source, 2);
> MPEG2TransportStreamFramer *videoSource = MPEG2TransportStreamFramer::createNew(*env, vidSrc);
Of course, there's also a call to sink<-startPlaying(*videoSource, ...);
Ross Finlayson
Live Networks, Inc.
http://www.live555.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20131025/9235d119/attachment.html>
More information about the live-devel
mailing list