<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>jrtplib: src/rtcpscheduler.h Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"> <link href="jrtplib.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.5.9 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> <li><a href="dirs.html"><span>Directories</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul> </div> <div class="navpath"><a class="el" href="dir_e5298977290e638844c8018a73ab0caf.html">src</a> </div> </div> <div class="contents"> <h1>rtcpscheduler.h</h1><a href="rtcpscheduler_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span> <a name="l00002"></a>00002 <span class="comment"></span> <a name="l00003"></a>00003 <span class="comment"> This file is a part of JRTPLIB</span> <a name="l00004"></a>00004 <span class="comment"> Copyright (c) 1999-2007 Jori Liesenborgs</span> <a name="l00005"></a>00005 <span class="comment"></span> <a name="l00006"></a>00006 <span class="comment"> Contact: jori.liesenborgs@gmail.com</span> <a name="l00007"></a>00007 <span class="comment"></span> <a name="l00008"></a>00008 <span class="comment"> This library was developed at the "Expertisecentrum Digitale Media"</span> <a name="l00009"></a>00009 <span class="comment"> (http://www.edm.uhasselt.be), a research center of the Hasselt University</span> <a name="l00010"></a>00010 <span class="comment"> (http://www.uhasselt.be). The library is based upon work done for </span> <a name="l00011"></a>00011 <span class="comment"> my thesis at the School for Knowledge Technology (Belgium/The Netherlands).</span> <a name="l00012"></a>00012 <span class="comment"></span> <a name="l00013"></a>00013 <span class="comment"> Permission is hereby granted, free of charge, to any person obtaining a</span> <a name="l00014"></a>00014 <span class="comment"> copy of this software and associated documentation files (the "Software"),</span> <a name="l00015"></a>00015 <span class="comment"> to deal in the Software without restriction, including without limitation</span> <a name="l00016"></a>00016 <span class="comment"> the rights to use, copy, modify, merge, publish, distribute, sublicense,</span> <a name="l00017"></a>00017 <span class="comment"> and/or sell copies of the Software, and to permit persons to whom the</span> <a name="l00018"></a>00018 <span class="comment"> Software is furnished to do so, subject to the following conditions:</span> <a name="l00019"></a>00019 <span class="comment"></span> <a name="l00020"></a>00020 <span class="comment"> The above copyright notice and this permission notice shall be included</span> <a name="l00021"></a>00021 <span class="comment"> in all copies or substantial portions of the Software.</span> <a name="l00022"></a>00022 <span class="comment"></span> <a name="l00023"></a>00023 <span class="comment"> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS</span> <a name="l00024"></a>00024 <span class="comment"> OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,</span> <a name="l00025"></a>00025 <span class="comment"> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL</span> <a name="l00026"></a>00026 <span class="comment"> THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER</span> <a name="l00027"></a>00027 <span class="comment"> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING</span> <a name="l00028"></a>00028 <span class="comment"> FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS</span> <a name="l00029"></a>00029 <span class="comment"> IN THE SOFTWARE.</span> <a name="l00030"></a>00030 <span class="comment"></span> <a name="l00031"></a>00031 <span class="comment">*/</span> <a name="l00032"></a>00032 <a name="l00037"></a>00037 <span class="preprocessor">#ifndef RTCPSCHEDULER_H</span> <a name="l00038"></a>00038 <span class="preprocessor"></span> <a name="l00039"></a>00039 <span class="preprocessor">#define RTCPSCHEDULER_H</span> <a name="l00040"></a>00040 <span class="preprocessor"></span> <a name="l00041"></a>00041 <span class="preprocessor">#include "rtpconfig.h"</span> <a name="l00042"></a>00042 <span class="preprocessor">#include "<a class="code" href="rtptimeutilities_8h.html">rtptimeutilities.h</a>"</span> <a name="l00043"></a>00043 <span class="preprocessor">#include "<a class="code" href="rtprandom_8h.html">rtprandom.h</a>"</span> <a name="l00044"></a>00044 <a name="l00045"></a>00045 <span class="keyword">class </span><a class="code" href="classRTCPCompoundPacket.html" title="Represents an RTCP compound packet.">RTCPCompoundPacket</a>; <a name="l00046"></a>00046 <span class="keyword">class </span><a class="code" href="classRTPPacket.html" title="Represents an RTP Packet.">RTPPacket</a>; <a name="l00047"></a>00047 <span class="keyword">class </span><a class="code" href="classRTPSources.html" title="Represents a table in which information about the participating sources is kept.">RTPSources</a>; <a name="l00048"></a>00048 <a name="l00050"></a><a class="code" href="classRTCPSchedulerParams.html">00050</a> <span class="keyword">class </span><a class="code" href="classRTCPSchedulerParams.html" title="Describes parameters used by the RTCPScheduler class.">RTCPSchedulerParams</a> <a name="l00051"></a>00051 { <a name="l00052"></a>00052 <span class="keyword">public</span>: <a name="l00053"></a>00053 <a class="code" href="classRTCPSchedulerParams.html" title="Describes parameters used by the RTCPScheduler class.">RTCPSchedulerParams</a>(); <a name="l00054"></a>00054 ~<a class="code" href="classRTCPSchedulerParams.html" title="Describes parameters used by the RTCPScheduler class.">RTCPSchedulerParams</a>(); <a name="l00055"></a>00055 <a name="l00057"></a>00057 <span class="keywordtype">int</span> <a class="code" href="classRTCPSchedulerParams.html#c6c5dd6001bd51c4f96f896c22e224f0" title="Sets the RTCP bandwidth to be used to bw (in bytes per second).">SetRTCPBandwidth</a>(<span class="keywordtype">double</span> bw); <a name="l00058"></a>00058 <a name="l00060"></a><a class="code" href="classRTCPSchedulerParams.html#79d31bf4eb4b339f110fcabac4f23ae7">00060</a> <span class="keywordtype">double</span> <a class="code" href="classRTCPSchedulerParams.html#79d31bf4eb4b339f110fcabac4f23ae7" title="Returns the used RTCP bandwidth in bytes per second (default is 1000).">GetRTCPBandwidth</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> bandwidth; } <a name="l00061"></a>00061 <a name="l00063"></a>00063 <span class="keywordtype">int</span> <a class="code" href="classRTCPSchedulerParams.html#79c78fc30d245baeccf5ebe33215e2b2" title="Sets the fraction of the RTCP bandwidth reserved for senders to fraction.">SetSenderBandwidthFraction</a>(<span class="keywordtype">double</span> fraction); <a name="l00064"></a>00064 <a name="l00066"></a><a class="code" href="classRTCPSchedulerParams.html#a3c32e288341d1b4f1350cd6d4c9da8e">00066</a> <span class="keywordtype">double</span> <a class="code" href="classRTCPSchedulerParams.html#a3c32e288341d1b4f1350cd6d4c9da8e" title="Returns the fraction of the RTCP bandwidth reserved for senders (default is 25%)...">GetSenderBandwidthFraction</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> senderfraction; } <a name="l00067"></a>00067 <a name="l00069"></a>00069 <span class="keywordtype">int</span> <a class="code" href="classRTCPSchedulerParams.html#a8ca4c1c82cad46f9221734f485b6fe1" title="Sets the minimum (deterministic) interval between RTCP compound packets to t.">SetMinimumTransmissionInterval</a>(<span class="keyword">const</span> <a class="code" href="classRTPTime.html" title="This class is used to specify wallclock time, delay intervals etc.">RTPTime</a> &t); <a name="l00070"></a>00070 <a name="l00072"></a><a class="code" href="classRTCPSchedulerParams.html#7dc8968f2156c41ad12ab5224a34b02d">00072</a> <a class="code" href="classRTPTime.html" title="This class is used to specify wallclock time, delay intervals etc.">RTPTime</a> <a class="code" href="classRTCPSchedulerParams.html#7dc8968f2156c41ad12ab5224a34b02d" title="Returns the minimum RTCP transmission interval (default is 5 seconds).">GetMinimumTransmissionInterval</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> mininterval; } <a name="l00073"></a>00073 <a name="l00075"></a><a class="code" href="classRTCPSchedulerParams.html#9fcd2d8d25f302f71c25884f28febf46">00075</a> <span class="keywordtype">void</span> <a class="code" href="classRTCPSchedulerParams.html#9fcd2d8d25f302f71c25884f28febf46" title="If usehalf is true, only use half the minimum interval before sending the first RTCP...">SetUseHalfAtStartup</a>(<span class="keywordtype">bool</span> usehalf) { usehalfatstartup = usehalf; } <a name="l00076"></a>00076 <a name="l00080"></a><a class="code" href="classRTCPSchedulerParams.html#9d1710cdecf3f1b283296c53c5ae403b">00080</a> <span class="keywordtype">bool</span> <a class="code" href="classRTCPSchedulerParams.html#9d1710cdecf3f1b283296c53c5ae403b" title="Returns true if only half the minimum interval should be used before sending the...">GetUseHalfAtStartup</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> usehalfatstartup; } <a name="l00081"></a>00081 <a name="l00083"></a><a class="code" href="classRTCPSchedulerParams.html#74ffd83e72183ba283739c2f970f9c30">00083</a> <span class="keywordtype">void</span> <a class="code" href="classRTCPSchedulerParams.html#74ffd83e72183ba283739c2f970f9c30" title="If v is true, the scheduler will schedule a BYE packet to be sent immediately if...">SetRequestImmediateBYE</a>(<span class="keywordtype">bool</span> v) { immediatebye = v; } <a name="l00084"></a>00084 <a name="l00088"></a><a class="code" href="classRTCPSchedulerParams.html#fec076f9ce121d625fca2cbde62991d5">00088</a> <span class="keywordtype">bool</span> <a class="code" href="classRTCPSchedulerParams.html#fec076f9ce121d625fca2cbde62991d5" title="Returns if the scheduler will schedule a BYE packet to be sent immediately if allowed...">GetRequestImmediateBYE</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> immediatebye; } <a name="l00089"></a>00089 <span class="keyword">private</span>: <a name="l00090"></a>00090 <span class="keywordtype">double</span> bandwidth; <a name="l00091"></a>00091 <span class="keywordtype">double</span> senderfraction; <a name="l00092"></a>00092 <a class="code" href="classRTPTime.html" title="This class is used to specify wallclock time, delay intervals etc.">RTPTime</a> mininterval; <a name="l00093"></a>00093 <span class="keywordtype">bool</span> usehalfatstartup; <a name="l00094"></a>00094 <span class="keywordtype">bool</span> immediatebye; <a name="l00095"></a>00095 }; <a name="l00096"></a>00096 <a name="l00098"></a><a class="code" href="classRTCPScheduler.html">00098</a> <span class="keyword">class </span><a class="code" href="classRTCPScheduler.html" title="This class determines when RTCP compound packets should be sent.">RTCPScheduler</a> <a name="l00099"></a>00099 { <a name="l00100"></a>00100 <span class="keyword">public</span>: <a name="l00107"></a>00107 <a class="code" href="classRTCPScheduler.html#a043589cc9eb6e889ce5d450a6378195" title="Creates an instance which will use the source table RTPSources to determine when...">RTCPScheduler</a>(<a class="code" href="classRTPSources.html" title="Represents a table in which information about the participating sources is kept.">RTPSources</a> &sources); <a name="l00108"></a>00108 ~<a class="code" href="classRTCPScheduler.html" title="This class determines when RTCP compound packets should be sent.">RTCPScheduler</a>(); <a name="l00109"></a>00109 <a name="l00111"></a>00111 <span class="keywordtype">void</span> <a class="code" href="classRTCPScheduler.html#4bc3352ff8c8ad089739433af2c8c631" title="Resets the scheduler.">Reset</a>(); <a name="l00112"></a>00112 <a name="l00114"></a><a class="code" href="classRTCPScheduler.html#1bd1b3c1a984f3fa9c6d56970525172d">00114</a> <span class="keywordtype">void</span> <a class="code" href="classRTCPScheduler.html#1bd1b3c1a984f3fa9c6d56970525172d" title="Sets the scheduler parameters to be used to params.">SetParameters</a>(<span class="keyword">const</span> <a class="code" href="classRTCPSchedulerParams.html" title="Describes parameters used by the RTCPScheduler class.">RTCPSchedulerParams</a> &params) { schedparams = params; } <a name="l00115"></a>00115 <a name="l00117"></a><a class="code" href="classRTCPScheduler.html#521ce5931976fba69b1f8575b12bbccb">00117</a> <a class="code" href="classRTCPSchedulerParams.html" title="Describes parameters used by the RTCPScheduler class.">RTCPSchedulerParams</a> <a class="code" href="classRTCPScheduler.html#521ce5931976fba69b1f8575b12bbccb" title="Returns the currently used scheduler parameters.">GetParameters</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> schedparams; } <a name="l00118"></a>00118 <a name="l00120"></a><a class="code" href="classRTCPScheduler.html#cad51d5aef1e874aeff6c35f9519ea32">00120</a> <span class="keywordtype">void</span> <a class="code" href="classRTCPScheduler.html#cad51d5aef1e874aeff6c35f9519ea32" title="Sets the header overhead from underlying protocols (for example UDP and IP) to numbytes...">SetHeaderOverhead</a>(<span class="keywordtype">size_t</span> numbytes) { headeroverhead = numbytes; } <a name="l00121"></a>00121 <a name="l00123"></a><a class="code" href="classRTCPScheduler.html#a89299362650951f36840e1d98492552">00123</a> <span class="keywordtype">size_t</span> <a class="code" href="classRTCPScheduler.html#a89299362650951f36840e1d98492552" title="Returns the currently used header overhead.">GetHeaderOverhead</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> headeroverhead; } <a name="l00124"></a>00124 <a name="l00126"></a>00126 <span class="keywordtype">void</span> <a class="code" href="classRTCPScheduler.html#972f3ae5dc574ec9d607c749b229afff" title="For each incoming RTCP compound packet, this function has to be called for the scheduler...">AnalyseIncoming</a>(<a class="code" href="classRTCPCompoundPacket.html" title="Represents an RTCP compound packet.">RTCPCompoundPacket</a> &rtcpcomppack); <a name="l00127"></a>00127 <a name="l00129"></a>00129 <span class="keywordtype">void</span> <a class="code" href="classRTCPScheduler.html#d7f99c9279c8086987b56cd85047ad3f" title="For each outgoing RTCP compound packet, this function has to be called for the scheduler...">AnalyseOutgoing</a>(<a class="code" href="classRTCPCompoundPacket.html" title="Represents an RTCP compound packet.">RTCPCompoundPacket</a> &rtcpcomppack); <a name="l00130"></a>00130 <a name="l00132"></a>00132 <span class="keywordtype">void</span> <a class="code" href="classRTCPScheduler.html#db2ee8d5e26b7c4e403d5ad55990b11b" title="This function has to be called each time a member times out or sends a BYE packet...">ActiveMemberDecrease</a>(); <a name="l00133"></a>00133 <a name="l00137"></a>00137 <span class="keywordtype">void</span> <a class="code" href="classRTCPScheduler.html#a93178bc21ffc203a37e52b2fdbf4f28" title="Asks the scheduler to schedule an RTCP compound packet containing a BYE packetl;...">ScheduleBYEPacket</a>(<span class="keywordtype">size_t</span> packetsize); <a name="l00138"></a>00138 <a name="l00143"></a>00143 <a class="code" href="classRTPTime.html" title="This class is used to specify wallclock time, delay intervals etc.">RTPTime</a> <a class="code" href="classRTCPScheduler.html#f97cf4a688de5e09bb0c9056b38b184d" title="Returns the delay after which an RTCP compound will possibly have to be sent.">GetTransmissionDelay</a>(); <a name="l00144"></a>00144 <a name="l00150"></a>00150 <span class="keywordtype">bool</span> <a class="code" href="classRTCPScheduler.html#5324517c0d360fbc1f12296fcad85d67" title="This function returns true if it&#39;s time to send an RTCP compound packet and false...">IsTime</a>(); <a name="l00151"></a>00151 <a name="l00156"></a>00156 <a class="code" href="classRTPTime.html" title="This class is used to specify wallclock time, delay intervals etc.">RTPTime</a> <a class="code" href="classRTCPScheduler.html#4cd698dcf809ed1df989b105e2350520" title="Calculates the deterministic interval at this time.">CalculateDeterministicInterval</a>(<span class="keywordtype">bool</span> sender = <span class="keyword">false</span>); <a name="l00157"></a>00157 <span class="keyword">private</span>: <a name="l00158"></a>00158 <span class="keywordtype">void</span> CalculateNextRTCPTime(); <a name="l00159"></a>00159 <span class="keywordtype">void</span> PerformReverseReconsideration(); <a name="l00160"></a>00160 <a class="code" href="classRTPTime.html" title="This class is used to specify wallclock time, delay intervals etc.">RTPTime</a> CalculateBYETransmissionInterval(); <a name="l00161"></a>00161 <a class="code" href="classRTPTime.html" title="This class is used to specify wallclock time, delay intervals etc.">RTPTime</a> CalculateTransmissionInterval(<span class="keywordtype">bool</span> sender); <a name="l00162"></a>00162 <a name="l00163"></a>00163 <a class="code" href="classRTPSources.html" title="Represents a table in which information about the participating sources is kept.">RTPSources</a> &sources; <a name="l00164"></a>00164 <a class="code" href="classRTCPSchedulerParams.html" title="Describes parameters used by the RTCPScheduler class.">RTCPSchedulerParams</a> schedparams; <a name="l00165"></a>00165 <span class="keywordtype">size_t</span> headeroverhead; <a name="l00166"></a>00166 <span class="keywordtype">size_t</span> avgrtcppacksize; <a name="l00167"></a>00167 <span class="keywordtype">bool</span> hassentrtcp; <a name="l00168"></a>00168 <span class="keywordtype">bool</span> firstcall; <a name="l00169"></a>00169 <a class="code" href="classRTPTime.html" title="This class is used to specify wallclock time, delay intervals etc.">RTPTime</a> nextrtcptime; <a name="l00170"></a>00170 <a class="code" href="classRTPTime.html" title="This class is used to specify wallclock time, delay intervals etc.">RTPTime</a> prevrtcptime; <a name="l00171"></a>00171 <span class="keywordtype">int</span> pmembers; <a name="l00172"></a>00172 <a name="l00173"></a>00173 <span class="comment">// for BYE packet scheduling</span> <a name="l00174"></a>00174 <span class="keywordtype">bool</span> byescheduled; <a name="l00175"></a>00175 <span class="keywordtype">int</span> byemembers,pbyemembers; <a name="l00176"></a>00176 <span class="keywordtype">size_t</span> avgbyepacketsize; <a name="l00177"></a>00177 <span class="keywordtype">bool</span> sendbyenow; <a name="l00178"></a>00178 <a name="l00179"></a>00179 <a class="code" href="classRTPRandom.html" title="The RTPRandom class can be used to generate random numbers.">RTPRandom</a> rtprand; <a name="l00180"></a>00180 }; <a name="l00181"></a>00181 <a name="l00182"></a>00182 <span class="preprocessor">#endif // RTCPSCHEDULER_H</span> <a name="l00183"></a>00183 <span class="preprocessor"></span> </pre></div></div> <hr size="1"><address style="text-align: right;"><small>Generated on Sun Jul 26 09:42:07 2009 for jrtplib by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.9 </small></address> </body> </html>