Update media_opt_util with frame size parameters.
Review URL: http://webrtc-codereview.appspot.com/51002 git-svn-id: http://webrtc.googlecode.com/svn/trunk@141 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
6b04739e04
commit
c13708271a
@ -341,6 +341,8 @@ VCMFecMethod::ProtectionFactor(const VCMProtectionParameters* parameters)
|
||||
(bitRate /
|
||||
(parameters->frameRate));
|
||||
|
||||
// TODO (marpan): Incorporate frame size (bpp) into FEC setting
|
||||
|
||||
// Total (avg) number of packets per frame (source and fec):
|
||||
const WebRtc_UWord8 avgTotPackets = 1 + (WebRtc_UWord8)
|
||||
((float) bitRatePerFrame * 1000.0
|
||||
@ -850,6 +852,14 @@ VCMLossProtectionLogic::UpdateKeyFrameSize(float keyFrameSize)
|
||||
_keyFrameSize = keyFrameSize;
|
||||
}
|
||||
|
||||
void
|
||||
VCMLossProtectionLogic::UpdateFrameSize(WebRtc_UWord16 width,
|
||||
WebRtc_UWord16 height)
|
||||
{
|
||||
_codecWidth = width;
|
||||
_codecHeight = height;
|
||||
}
|
||||
|
||||
bool
|
||||
VCMLossProtectionLogic::UpdateMethod(VCMProtectionMethod *newMethod /*=NULL */)
|
||||
{
|
||||
@ -864,6 +874,8 @@ VCMLossProtectionLogic::UpdateMethod(VCMProtectionMethod *newMethod /*=NULL */)
|
||||
_currentParameters.packetsPerFrameKey = _packetsPerFrameKey.Value();
|
||||
_currentParameters.residualPacketLoss = _residualPacketLoss;
|
||||
_currentParameters.fecType = _fecType;
|
||||
_currentParameters.codecWidth = _codecWidth;
|
||||
_currentParameters.codecHeight = _codecHeight;
|
||||
|
||||
if (newMethod == NULL)
|
||||
{
|
||||
|
@ -45,7 +45,8 @@ struct VCMProtectionParameters
|
||||
{
|
||||
VCMProtectionParameters() : rtt(0), lossPr(0), bitRate(0), packetsPerFrame(0),
|
||||
frameRate(0), keyFrameSize(0), fecRateDelta(0), fecRateKey(0),
|
||||
residualPacketLoss(0.0), fecType(kXORFec) {}
|
||||
residualPacketLoss(0.0), fecType(kXORFec), codecWidth(0),
|
||||
codecHeight(0) {}
|
||||
|
||||
WebRtc_UWord32 rtt;
|
||||
float lossPr;
|
||||
@ -57,7 +58,10 @@ struct VCMProtectionParameters
|
||||
WebRtc_UWord8 fecRateDelta;
|
||||
WebRtc_UWord8 fecRateKey;
|
||||
float residualPacketLoss;
|
||||
VCMFecTypes fecType;
|
||||
VCMFecTypes fecType;
|
||||
WebRtc_UWord16 codecWidth;
|
||||
WebRtc_UWord16 codecHeight;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -236,7 +240,7 @@ public:
|
||||
_keyFrameSize(0.0f), _fecRateKey(0), _fecRateDelta(0), _lastPrUpdateT(0),
|
||||
_lossPr255(0.9999f), _lossPrHistory(), _shortMaxLossPr255(0),
|
||||
_packetsPerFrame(0.9999f), _packetsPerFrameKey(0.9999f), _residualPacketLoss(0),
|
||||
_boostRateKey(2)
|
||||
_boostRateKey(2), _codecWidth(0), _codecHeight(0)
|
||||
{ Reset(); }
|
||||
|
||||
~VCMLossProtectionLogic();
|
||||
@ -308,6 +312,13 @@ public:
|
||||
// - frameRate : The current target frame rate.
|
||||
void UpdateFrameRate(float frameRate) { _frameRate = frameRate; }
|
||||
|
||||
// Update the frame size
|
||||
//
|
||||
// Input:
|
||||
// - width : The codec frame width.
|
||||
// - height : The codec frame height.
|
||||
void UpdateFrameSize(WebRtc_UWord16 width, WebRtc_UWord16 height);
|
||||
|
||||
// The amount of packet loss to cover for with FEC.
|
||||
//
|
||||
// Input:
|
||||
@ -372,6 +383,8 @@ private:
|
||||
float _residualPacketLoss;
|
||||
WebRtc_UWord8 _boostRateKey;
|
||||
VCMFecTypes _fecType;
|
||||
WebRtc_UWord16 _codecWidth;
|
||||
WebRtc_UWord16 _codecHeight;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
@ -246,6 +246,7 @@ VCMMediaOptimization::SetEncodingData(VideoCodecType sendCodecType, WebRtc_Word3
|
||||
_targetBitRate = bitRate;
|
||||
_lossProtLogic->UpdateBitRate(static_cast<float>(bitRate));
|
||||
_lossProtLogic->UpdateFrameRate(static_cast<float>(frameRate));
|
||||
_lossProtLogic->UpdateFrameSize(width, height);
|
||||
_frameDropper->Reset();
|
||||
_frameDropper->SetRates(static_cast<float>(bitRate), static_cast<float>(frameRate));
|
||||
_userFrameRate = (float)frameRate;
|
||||
|
Loading…
Reference in New Issue
Block a user