<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div><blockquote type="cite" class=""><div class=""><div style="" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">If all of your clients are unicast RTSP clients, all using just one “OnDemandServerMediaSubsession” subclass, then you shouldn’t need to use “StreamReplicator” at all.  Instead, just ensure that your “OnDemandServerMediaSubsession” subclass’s constructor sets the “reuseFirstSource” parameter to True when it calls the parent (“OnDemandServerMediaSubsession”) constructor.  Setting the “reuseFirstSource” parameter to True will ensure that only one instance of your encoder source (your “FramedSource” subclass) is in existence at any time.  (You must still allow for your “FramedSource” subclass to be closed, then later re-opened; however, no more than one object of this class will be in existence at any given time.)<br class=""><br class="">In this case the ‘replication’ (transmitting packets to the multiple unicast clients) will happen automatically at a lower level, inside the “Groupsock” object.<br class=""></blockquote><br style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">I have already tried this, and it worked terribly. With StreamReplicator and reuseFirstSource==False I have managed to send VP8 video to about 400 clients for 500-900 Mbit/s total bandwidth. With reuseFirstSource==True after 20 connected  clients send errors have started to appear, and after about 40 clients video on clients became unwatchable due to packet loss. My guess this happened because with reuseFirstSource==True OnDemandServerMediaSubsession uses just one socket to send to all clients and hence all data goes through one OS socket send buffer which is simply not big enough to handle that much data. This happens on Windows by the way (send error is WSAEWOULDBLOCK), maybe on normal operating systems this will work fine</span></div></div></blockquote><div><br class=""></div>Yes :-)</div><div><br class=""></div><div>However, if Windows lets you increase the size of its OS socket send buffer (using the standard POSIX "setsockopt(socket, SOL_SOCKET, SO_SNDBU, ...)” call), then you could try calling our “increaseSendBufferTo()” function, which does this.  (By default, our code sets output socket buffers to 50 kBytes.)</div><div><br class=""></div><div>If you can do this (and set “reuseFirstSource” to True), then that should be a lot more efficient than using multiple “StreamReplica”s with “reuseFirstSource” set to False.  In the latter case, you have the extra overhead of copying to the replicas, plus the fact that you’ll have multiple sockets for RTP and RTCP (one of each for each client), which you don’t have if you set “reuseFirstSource” to True.  (You’d be more likely to run into the OS's limit on the number of open sockets.)</div><div><br class=""></div><div><br class=""></div><div><blockquote type="cite" class=""><div class=""><div style="" class="">Anyway, sorry for wasting your time with specifics of my use-case. I just wanted explain why I think that including timeouts in StreamReplicator and not somewhere else is better.</div></div></blockquote><div><br class=""></div>Or you could just fix whatever it is in your application that can cause your replicas to hang :-)  If your replicas are all feeding into “RTPSink”s, then the only thing (that I know of) that could cause a write to a “RTPSink” to ‘hang’ would be if it got fed an excessively large “fDurationInMicroseconds” value when it was delivered a frame (or H.264 NAL unit).  Perhaps your patches to the “H264VideoStreamFramer” code (which I’m still reviewing) fixed this problem for you (or maybe even caused it?).  In any case, it should be easy to check for and fix if necessary.</div><br class=""><br class=""><div apple-content-edited="true" class="">
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;  "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;  ">Ross Finlayson<br class="">Live Networks, Inc.<br class=""><a href="http://www.live555.com/" class="">http://www.live555.com/</a></span></span>
</div>
<br class=""></body></html>