<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";
        mso-fareast-language:EN-AU;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-AU link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'>Josh<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'>The video bitrate is adjusted by a FlowControlRequest from the remote. Have a look at <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";mso-fareast-language:EN-US'>void H323Connection::OnLogicalChannelFlowControl()<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'>if you want to adjust manually (not recommended).<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'>You can adjust the video input from your webcam on windows by overriding PVideoInputDevice::FlowControl<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'>Something like this<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";mso-fareast-language:EN-US'>bool PVideoInputDevice_MyDevice::FlowControl(const void * flowData)<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";mso-fareast-language:EN-US'>{<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";mso-fareast-language:EN-US'>    const PStringArray & options = *(const PStringArray *)flowData;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";mso-fareast-language:EN-US'>    int w=0; int h=0; int r=0;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";mso-fareast-language:EN-US'>    for (PINDEX i=0; i < options.GetSize(); i+=2) {<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";mso-fareast-language:EN-US'>      if (options[i] == "Frame Width")<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";mso-fareast-language:EN-US'>            w = options[i+1].AsInteger();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";mso-fareast-language:EN-US'>      else if (options[i] == "Frame Height")<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";mso-fareast-language:EN-US'>            h = options[i+1].AsInteger();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";mso-fareast-language:EN-US'>      else if (options[i] ==  "Frame Time")<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";mso-fareast-language:EN-US'>            r =  90000/options[i+1].AsInteger();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";mso-fareast-language:EN-US'>    }<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";mso-fareast-language:EN-US'>    SetFrameSize(w,h);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";mso-fareast-language:EN-US'>    SetFrameRate(r);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";mso-fareast-language:EN-US'>    return true;<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";mso-fareast-language:EN-US'>}<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";mso-fareast-language:EN-US'>Simon</span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> J.C Mercier [mailto:jcmerc5@gmail.com] <br><b>Sent:</b> Friday, 25 November 2011 12:49 PM<br><b>To:</b> Simon Horne<br><b>Cc:</b> h323plus@lists.packetizer.com<br><b>Subject:</b> Re: [h323plus] Changing video codec transmit bit rate<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal style='margin-bottom:12.0pt'>Thanks very much for your help Simon.<br><br>I don't seem to have good luck working with any of ptlib 2.10 on windows but i'll try 2.9. <br><br>Just for curiosity, you mentioned that one can change the bit rate during a call which i had not thought was possible, but in the case of h.264, how would one go about doing so?<br><br>Thanks!<br><br>Josh<br><br><o:p></o:p></p><div><p class=MsoNormal>On Thu, Nov 24, 2011 at 4:36 PM, Simon Horne <<a href="mailto:s.horne@packetizer.com">s.horne@packetizer.com</a>> wrote:<o:p></o:p></p><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif"'>Josh</span><span lang=EN-US><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif"'> </span><span lang=EN-US><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif"'>Yes you are correct  FlowControl for the InputDevice (change frame size and rate) requires PTLIB 2.9 or above. Also FlowControl is not supported on H.263 or H.261 which have fixed frame sizes. In H.264 you pass to the plugin the required bitrate and it will return an appropriate frameWidth, FrameHeight and FrameRate to match the proposed BitRate. In H.263 and H.261 the framesize is more rigid (CIF,QCIF) so really you can only adjust the FrameRate. </span><span lang=EN-US><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif"'> </span><span lang=EN-US><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif"'>For H.261/H.263 If you set </span><span lang=EN-US><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif"'>mediaFormat.SetBandwidth(yourrate) if SetFlowControl() fails in the H323PluginVideoCodec::SetMaxBitRate(unsigned bitRate)  function then you’ll force the remote via the TCS to that bitrate. Then in your OpenVideoChannel you set your inputdevice to a matching FrameRate (ie 128kbps/327kbps * 30 = 12)  then that should be a workaround to get the bitrate in both directions.</span><span lang=EN-US><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif"'> </span><span lang=EN-US><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif"'>The limitation is you will not be able to change the bitrate during the call.</span><span lang=EN-US><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif"'> </span><span lang=EN-US><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif"'>Simon</span><span lang=EN-US><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> </span><span lang=EN-US><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> </span><span lang=EN-US><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> </span><span lang=EN-US><o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> <a href="mailto:h323plus-bounces@lists.packetizer.com" target="_blank">h323plus-bounces@lists.packetizer.com</a> [mailto:<a href="mailto:h323plus-bounces@lists.packetizer.com" target="_blank">h323plus-bounces@lists.packetizer.com</a>] <b>On Behalf Of </b>J.C Mercier<br><b>Sent:</b> 25 November 2011 07:04<br><b>To:</b> Simon Horne<br><b>Cc:</b> <a href="mailto:h323plus@lists.packetizer.com" target="_blank">h323plus@lists.packetizer.com</a><br><b>Subject:</b> Re: [h323plus] Changing video codec transmit bit rate</span><span lang=EN-US><o:p></o:p></span></p><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US> <o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;margin-bottom:12.0pt'><span lang=EN-US>Thanks Simon for your prompt response.<br><br>Having tested the code as suggested, it seems that the bit rate still remains at 327kbps for the h.263 codec after i attempted to set it to 128kbps.<br><br>Is it possible that because this version of ptlib (2.8.5) does not support flow control, changing the bit rate will not take affect?<br><br>I traced the SetMaxBitRate function, and it was called by the descendant class in plugin, which is correct, which in turn looks as follows;<br><br>PBoolean H323PluginVideoCodec::SetMaxBitRate(unsigned bitRate)  <br>{ <br>    if (SetFlowControl(codec,context,mediaFormat,bitRate/100)) {<br>         frameWidth = mediaFormat.GetOptionInteger(OpalVideoFormat::FrameWidthOption); <br>         frameHeight =  mediaFormat.GetOptionInteger(OpalVideoFormat::FrameHeightOption);<br>         targetFrameTimeMs = mediaFormat.GetOptionInteger(OpalVideoFormat::FrameTimeOption);<br>         mediaFormat.SetBandwidth(bitRate);<br>         return true;<br>    }<br>    return false;<br>}<br><br>the SetFlowControl always returns false with the following message;<br><br> - > "No Flow Control supported in codec"<br><br>Any ideas or other suggestions you may provide will be greatly appreciated.<br><br>Thanks<br><br>Josh <o:p></o:p></span></p><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US>On Thu, Nov 24, 2011 at 2:29 PM, Simon Horne <<a href="mailto:s.horne@packetizer.com" target="_blank">s.horne@packetizer.com</a>> wrote:<o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US>Josh<br><br>Unfortunately the OpenVideoChannel is called after the H.245 TCS stage so<br>you cannot use it to negotiate a bandwidth limit for a call.<br><br>To set the Initial Bandwidth limit in the TCS there is a callback which is<br>called when building.<br>H323EndPoint::OnSetInitialBandwidth(H323VideoCodec * codec);<br><br>So you could do something like this in your code<br><br>void MyH323EndPoint::OnSetInitialBandwidth(H323VideoCodec * codec)<br>{<br>       unsigned bitrate = <your rate in kbps> * 1000;<br>       if ((bitrate != 0) && (codec->GetMediaFormat().GetBandwidth() ><br>bitrate)) {<br>               PTRACE(4,"My\tAdjusting maximum video bitrate to " <<<br>bitrate);<br>               codec->SetMaxBitRate(bitrate);<br>       }<br>}<br><br>During a call the bitrate may change via FlowControl requests but will not<br>exceed the value you set in this callback.<br><br>Simon<br><br><br>-----Original Message-----<br>From: <a href="mailto:h323plus-bounces@lists.packetizer.com" target="_blank">h323plus-bounces@lists.packetizer.com</a><br>[mailto:<a href="mailto:h323plus-bounces@lists.packetizer.com" target="_blank">h323plus-bounces@lists.packetizer.com</a>] On Behalf Of J C Mercier<br>Sent: 25 November 2011 05:08<br>To: <a href="mailto:h323plus@lists.packetizer.com" target="_blank">h323plus@lists.packetizer.com</a><br>Subject: [h323plus] Changing video codec transmit bit rate<o:p></o:p></span></p><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;margin-bottom:12.0pt'><span lang=EN-US><br>Hi all,<br><br>How would one go about adjusting the video codec max transmission bit rate?<br><br>I understand thus can be done in OpenVideoChannel by calling<br>codec.SetMaxBitRate but I I get  no flow control supported when I attempted<br>to do so.<br><br>I am using v 1.23 for H323plus downloaded from <a href="http://h323plus.org" target="_blank">h323plus.org</a> and pitlib v<br>2.8.5. I noticed that flow control is not supported in ptlib less than 2.9<br>but would there be another way of changing the bit rate?<br><br>Thanks!<br><br>Josh C.<o:p></o:p></span></p></div></div></div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-US> <o:p></o:p></span></p></div></div></div></div></div><p class=MsoNormal><o:p> </o:p></p></div></body></html>