<html><body><div style="color:#000; background-color:#fff; font-family:verdana, helvetica, sans-serif;font-size:10px"><div style="" class=""><span style="" class="">Thank you very much for detailed explanation.</span></div><div class="" style="color: rgb(0, 0, 0); font-size: 10px; font-family: verdana,helvetica,sans-serif; background-color: transparent; font-style: normal;"><span style="" class="">Probably increasing of the send buffer (SO_SNDBUF) can help, it's value depends on estimatedBitrate from RTPSink:</span></div><div class="" style="color: rgb(0, 0, 0); font-size: 10px; font-family: verdana,helvetica,sans-serif; background-color: transparent; font-style: normal;"><br style="" class=""><span style="" class=""></span></div><div class="" style="color: rgb(0, 0, 0); font-size: 10px; font-family: verdana,helvetica,sans-serif; background-color: transparent; font-style: normal;"><span style="" class="">if (rtpSink != NULL &&
rtpSink->estimatedBitrate() > 0) streamBitrate = rtpSink->estimatedBitrate();</span></div><div class="" style="color: rgb(0, 0, 0); font-size: 10px; font-family: verdana,helvetica,sans-serif; background-color: transparent; font-style: normal;"><br style="" class=""><span style="" class=""></span></div><div class="" style="color: rgb(0, 0, 0); font-size: 10px; font-family: verdana,helvetica,sans-serif; background-color: transparent; font-style: normal;"><span style="" class="">if (rtpGroupsock != NULL) {<br style="" class=""> // Try to use a big send buffer for RTP - at least 0.1 second of<br style="" class=""> // specified bandwidth and at least 50 KB<br style="" class=""> unsigned rtpBufSize = streamBitrate * 25 / 2; // 1 kbps * 0.1 s = 12.5 bytes<br style="" class=""> if (rtpBufSize < 50 * 1024) rtpBufSize = 50 * 1024;<br style="" class="">
increaseSendBufferTo(envir(), rtpGroupsock->socketNum(), rtpBufSize);<br style="" class="">}<br style="" class=""></span></div> <div class="qtdSeparateBR"><br><br></div><div style="display: block;" class="yahoo_quoted"> <div class="" style="font-family: verdana, helvetica, sans-serif; font-size: 10px;"> <div class="" style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, Sans-Serif; font-size: 12pt;"> <div style="" class="" dir="ltr"> <font style="" class="" size="2" face="Arial"> On Friday, 19 September 2014, 11:13, Ross Finlayson <finlayson@live555.com> wrote:<br style="" class=""> </font> </div> <blockquote class="" style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; margin-top: 5px; padding-left: 5px;"> <br style="" class=""><br style="" class=""> <div style="" class=""><div style="" class="" id="yiv6439688251"><div style="" class="" id="yiv6439688251yqtfd66773"></div><div style="" class=""><div
style="" class=""><blockquote style="" class="" type="cite"><div style="" class=""><div class="" style="background-color:rgb(255, 255, 255);font-family:verdana, helvetica, sans-serif;font-size:10pt;"><div style="" class="" id="yiv6439688251yqtfd39420"><div class="" style="font-size:13.3333px;font-family:verdana, helvetica, sans-serif;background-color:transparent;font-style:normal;">I tried to fix the problem by this way:</div><div class="" style="font-size:13.3333px;font-family:verdana, helvetica, sans-serif;background-color:transparent;font-style:normal;"><br class="" style="" clear="none"></div></div><div class="" style="font-size:13.3333px;font-family:verdana, helvetica, sans-serif;background-color:transparent;font-style:normal;"><div style="" class="" id="yiv6439688251yqtfd67824">- sendResult = send(socketNum, (char const*)(&data[numBytesSentSoFar]), numBytesRemainingToSend, 0/*flags*/);<br class="" style=""
clear="none">+ <br class="" style="" clear="none">+ do {<br class="" style="" clear="none">+ sendResult = send(socketNum, (char const*)(&data[numBytesSentSoFar]), numBytesRemainingToSend, 0/*flags*/);<br class="" style="" clear="none">+ } while(sendResult == -1 && envir().getErrno() == EAGAIN);</div><br class="" style="" clear="none"></div></div></div></blockquote><div style="" class=""><br style="" class="" clear="none"></div>No, you can't do this (and there's not a 'problem' that needs fixing)! If the TCP connection gets blocked permanently (e.g., because the receiving client has stopped running, or has a cable disconnected), then you can't just sit in a loop, attempting to send() over and over again. That would starve out all other server activity.</div><div style="" class=""><br
style="" class="" clear="none"></div><div style="" class="">There's no 'bug' or 'problem' here. The "EAGAIN" error occurs when the sending OS's TCP buffer is full - which occurs if the stream's bitrate exceeds (at least temporarily) the capacity of the TCP connection. When this happens, the only solution is to discard outgoing data. Our code does so by ensuring that if/when data gets discarded, the discarded data will be a complete RTP (or RTCP) packet - equivalent to the loss of a packet if you were streaming over UDP.</div><div style="" class=""><br style="" class="" clear="none"></div><div style="" class="">Some people seem to think that streaming over TCP is a 'magic wand' that will avoid all data loss, regardless of the bitrate of your stream and the capacity of your network. But that's impossible. If your stream's bitrate exceeds the capacity of your network, you *will* lose data. The only way to prevent this is
either to transmit a slower stream, or use a faster network.</div><div style="" class=""><br style="" class="" clear="none"></div><div style="" class="">Yet again, let me remind everyone that streaming over TCP is something that you should be doing *only* if you are behind a firewall that blocks UDP packets</div><br style="" class="" clear="none"><div style="" class="">
<span class="" 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-indent:0px;text-transform:none;white-space:normal;widows:2;word-spacing:0px;"><span class="" 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-indent:0px;text-transform:none;white-space:normal;widows:2;word-spacing:0px;">Ross Finlayson<br style="" class="" clear="none">Live Networks, Inc.<br style="" class="" clear="none"><a style="" class="" rel="nofollow" shape="rect" target="_blank" href="http://www.live555.com/">http://www.live555.com/</a></span></span><div style="" class="" id="yiv6439688251yqtfd68946">
</div></div><div style="" class="" id="yiv6439688251yqtfd02514">
<br style="" class="" clear="none"></div></div></div><br style="" class=""><br style="" class=""></div> </blockquote> </div> </div> </div> </div></body></html>