Josh
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.
For H.261/H.263 If you set
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.
The limitation is you will not be able to change the bitrate during the call.
Simon
From: h323plus-bounces@lists.packetizer.com [mailto:h323plus-bounces@lists.packetizer.com] On Behalf Of J.C Mercier Sent: 25 November 2011 07:04 To: Simon Horne Cc: h323plus@lists.packetizer.com Subject: Re: [h323plus] Changing video codec transmit bit rate
Thanks Simon for your prompt response.
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.
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?
I traced the SetMaxBitRate function, and it was called by the descendant class in plugin, which is correct, which in turn looks as follows;
PBoolean H323PluginVideoCodec::SetMaxBitRate(unsigned bitRate) { if (SetFlowControl(codec,context,mediaFormat,bitRate/100)) { frameWidth = mediaFormat.GetOptionInteger(OpalVideoFormat::FrameWidthOption); frameHeight = mediaFormat.GetOptionInteger(OpalVideoFormat::FrameHeightOption); targetFrameTimeMs = mediaFormat.GetOptionInteger(OpalVideoFormat::FrameTimeOption); mediaFormat.SetBandwidth(bitRate); return true; } return false; }
the SetFlowControl always returns false with the following message;
- > "No Flow Control supported in codec"
Any ideas or other suggestions you may provide will be greatly appreciated.
Thanks
Josh
On Thu, Nov 24, 2011 at 2:29 PM, Simon Horne s.horne@packetizer.com wrote:
Josh
Unfortunately the OpenVideoChannel is called after the H.245 TCS stage so you cannot use it to negotiate a bandwidth limit for a call.
To set the Initial Bandwidth limit in the TCS there is a callback which is called when building. H323EndPoint::OnSetInitialBandwidth(H323VideoCodec * codec);
So you could do something like this in your code
void MyH323EndPoint::OnSetInitialBandwidth(H323VideoCodec * codec) { unsigned bitrate = <your rate in kbps> * 1000; if ((bitrate != 0) && (codec->GetMediaFormat().GetBandwidth() > bitrate)) { PTRACE(4,"My\tAdjusting maximum video bitrate to " << bitrate); codec->SetMaxBitRate(bitrate); } }
During a call the bitrate may change via FlowControl requests but will not exceed the value you set in this callback.
Simon
-----Original Message----- From: h323plus-bounces@lists.packetizer.com [mailto:h323plus-bounces@lists.packetizer.com] On Behalf Of J C Mercier Sent: 25 November 2011 05:08 To: h323plus@lists.packetizer.com Subject: [h323plus] Changing video codec transmit bit rate
Hi all,
How would one go about adjusting the video codec max transmission bit rate?
I understand thus can be done in OpenVideoChannel by calling codec.SetMaxBitRate but I I get no flow control supported when I attempted to do so.
I am using v 1.23 for H323plus downloaded from h323plus.org and pitlib v 2.8.5. I noticed that flow control is not supported in ptlib less than 2.9 but would there be another way of changing the bit rate?
Thanks!
Josh C.