video_coding: Updating protection logic in media optimization utility:
1. Changing protection logic structure: Accepts only one method (not a list) 2. Removed unused code (unreferenced protection methods) 3. Removed inline constructors/destructors. Review URL: http://webrtc-codereview.appspot.com/120005 git-svn-id: http://webrtc.googlecode.com/svn/trunk@467 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
552f173979
commit
a057a9561c
@ -21,22 +21,43 @@
|
|||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
|
VCMProtectionMethod::VCMProtectionMethod():
|
||||||
|
_effectivePacketLoss(0),
|
||||||
|
_protectionFactorK(0),
|
||||||
|
_protectionFactorD(0),
|
||||||
|
_residualPacketLossFec(0.0f),
|
||||||
|
_scaleProtKey(2.0f),
|
||||||
|
_maxPayloadSize(1460),
|
||||||
|
_qmRobustness(new VCMQmRobustness()),
|
||||||
|
_useUepProtectionK(false),
|
||||||
|
_useUepProtectionD(true),
|
||||||
|
_corrFecCost(1.0),
|
||||||
|
_type(kNone),
|
||||||
|
_efficiency(0)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
VCMProtectionMethod::~VCMProtectionMethod()
|
||||||
|
{
|
||||||
|
delete _qmRobustness;
|
||||||
|
}
|
||||||
void
|
void
|
||||||
VCMProtectionMethod::UpdateContentMetrics(const
|
VCMProtectionMethod::UpdateContentMetrics(const
|
||||||
VideoContentMetrics* contentMetrics)
|
VideoContentMetrics* contentMetrics)
|
||||||
{
|
{
|
||||||
_qmRobustness->UpdateContent(contentMetrics);
|
_qmRobustness->UpdateContent(contentMetrics);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VCMNackFecMethod::VCMNackFecMethod():
|
||||||
VCMNackFecMethod::VCMNackFecMethod() : VCMProtectionMethod(kNackFec)
|
VCMFecMethod()
|
||||||
{
|
{
|
||||||
_fecMethod = new VCMFecMethod();
|
_type = kNackFec;
|
||||||
}
|
}
|
||||||
|
|
||||||
VCMNackFecMethod::~VCMNackFecMethod()
|
VCMNackFecMethod::~VCMNackFecMethod()
|
||||||
{
|
{
|
||||||
delete _fecMethod;
|
//
|
||||||
}
|
}
|
||||||
bool
|
bool
|
||||||
VCMNackFecMethod::ProtectionFactor(const
|
VCMNackFecMethod::ProtectionFactor(const
|
||||||
@ -54,13 +75,7 @@ VCMNackFecMethod::ProtectionFactor(const
|
|||||||
// nack the residual, based on a decision made in the JB.
|
// nack the residual, based on a decision made in the JB.
|
||||||
|
|
||||||
// Compute the protection factors
|
// Compute the protection factors
|
||||||
_fecMethod->ProtectionFactor(parameters);
|
VCMFecMethod::ProtectionFactor(parameters);
|
||||||
|
|
||||||
_protectionFactorK = _fecMethod->_protectionFactorK;
|
|
||||||
_protectionFactorD = _fecMethod->_protectionFactorD;
|
|
||||||
|
|
||||||
_useUepProtectionD = _fecMethod->_useUepProtectionD;
|
|
||||||
_useUepProtectionK = _fecMethod->_useUepProtectionK;
|
|
||||||
|
|
||||||
// When in Hybrid mode (RTT range), adjust FEC rates based on the
|
// When in Hybrid mode (RTT range), adjust FEC rates based on the
|
||||||
// RTT (NACK effectiveness) - adjustment factor is in the range [0,1].
|
// RTT (NACK effectiveness) - adjustment factor is in the range [0,1].
|
||||||
@ -75,7 +90,7 @@ VCMNackFecMethod::ProtectionFactor(const
|
|||||||
(adjustRtt *
|
(adjustRtt *
|
||||||
static_cast<float>(_protectionFactorD));
|
static_cast<float>(_protectionFactorD));
|
||||||
// update FEC rates after applyingadjustment softness parameter
|
// update FEC rates after applyingadjustment softness parameter
|
||||||
_fecMethod->UpdateProtectionFactorD(_protectionFactorD);
|
VCMFecMethod::UpdateProtectionFactorD(_protectionFactorD);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -87,10 +102,7 @@ VCMNackFecMethod::EffectivePacketLoss(const
|
|||||||
{
|
{
|
||||||
// Set the effective packet loss for encoder (based on FEC code).
|
// Set the effective packet loss for encoder (based on FEC code).
|
||||||
// Compute the effective packet loss and residual packet loss due to FEC.
|
// Compute the effective packet loss and residual packet loss due to FEC.
|
||||||
_fecMethod->EffectivePacketLoss(parameters);
|
VCMFecMethod::EffectivePacketLoss(parameters);
|
||||||
_effectivePacketLoss = _fecMethod->_effectivePacketLoss;
|
|
||||||
_residualPacketLossFec = _fecMethod->_residualPacketLossFec;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,18 +131,28 @@ VCMNackFecMethod::UpdateParameters(const VCMProtectionParameters* parameters)
|
|||||||
// protection factor is defined relative to source number of packets so we
|
// protection factor is defined relative to source number of packets so we
|
||||||
// should convert the factor to reduce mismatch between mediaOpt's rate and
|
// should convert the factor to reduce mismatch between mediaOpt's rate and
|
||||||
// the actual one
|
// the actual one
|
||||||
_protectionFactorK = _fecMethod->ConvertFECRate(_protectionFactorK);
|
_protectionFactorK = VCMFecMethod::ConvertFECRate(_protectionFactorK);
|
||||||
_protectionFactorD = _fecMethod->ConvertFECRate(_protectionFactorD);
|
_protectionFactorD = VCMFecMethod::ConvertFECRate(_protectionFactorD);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VCMNackMethod::VCMNackMethod():
|
||||||
|
VCMProtectionMethod()
|
||||||
|
{
|
||||||
|
_type = kNack;
|
||||||
|
}
|
||||||
|
|
||||||
|
VCMNackMethod::~VCMNackMethod()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
VCMNackMethod::EffectivePacketLoss(const VCMProtectionParameters* parameter)
|
VCMNackMethod::EffectivePacketLoss(const VCMProtectionParameters* parameter)
|
||||||
{
|
{
|
||||||
// Effective Packet Loss, NA in current version.
|
// Effective Packet Loss, NA in current version.
|
||||||
_effectivePacketLoss = 0;
|
_effectivePacketLoss = 0;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,6 +168,16 @@ VCMNackMethod::UpdateParameters(const VCMProtectionParameters* parameters)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VCMFecMethod::VCMFecMethod():
|
||||||
|
VCMProtectionMethod()
|
||||||
|
{
|
||||||
|
_type = kFec;
|
||||||
|
}
|
||||||
|
VCMFecMethod::~VCMFecMethod()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
WebRtc_UWord8
|
WebRtc_UWord8
|
||||||
VCMFecMethod::BoostCodeRateKey(WebRtc_UWord8 packetFrameDelta,
|
VCMFecMethod::BoostCodeRateKey(WebRtc_UWord8 packetFrameDelta,
|
||||||
WebRtc_UWord8 packetFrameKey) const
|
WebRtc_UWord8 packetFrameKey) const
|
||||||
@ -175,7 +207,6 @@ void
|
|||||||
VCMFecMethod::UpdateProtectionFactorD(WebRtc_UWord8 protectionFactorD)
|
VCMFecMethod::UpdateProtectionFactorD(WebRtc_UWord8 protectionFactorD)
|
||||||
{
|
{
|
||||||
_protectionFactorD = protectionFactorD;
|
_protectionFactorD = protectionFactorD;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// AvgRecoveryFEC: computes the residual packet loss function.
|
// AvgRecoveryFEC: computes the residual packet loss function.
|
||||||
@ -241,8 +272,10 @@ VCMFecMethod::AvgRecoveryFEC(const VCMProtectionParameters* parameters) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const WebRtc_UWord8 lossRate = static_cast<WebRtc_UWord8> (255.0 *
|
WebRtc_UWord8 lossRate = static_cast<WebRtc_UWord8> (255.0 *
|
||||||
parameters->lossPr + 0.5f);
|
parameters->lossPr + 0.5f);
|
||||||
|
// Constrain lossRate to 129 (50% protection)
|
||||||
|
// TODO (marpan): Verify table values
|
||||||
|
|
||||||
const WebRtc_UWord16 codeIndex = (fecPacketsPerFrame - 1) * codeSize +
|
const WebRtc_UWord16 codeIndex = (fecPacketsPerFrame - 1) * codeSize +
|
||||||
(sourcePacketsPerFrame - 1);
|
(sourcePacketsPerFrame - 1);
|
||||||
@ -527,151 +560,100 @@ VCMFecMethod::UpdateParameters(const VCMProtectionParameters* parameters)
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
VCMLossProtectionLogic::VCMLossProtectionLogic():
|
||||||
bool
|
_selectedMethod(NULL),
|
||||||
VCMIntraReqMethod::UpdateParameters(const VCMProtectionParameters* parameters)
|
_currentParameters(),
|
||||||
|
_rtt(0),
|
||||||
|
_lossPr(0.0f),
|
||||||
|
_bitRate(0.0f),
|
||||||
|
_frameRate(0.0f),
|
||||||
|
_keyFrameSize(0.0f),
|
||||||
|
_fecRateKey(0),
|
||||||
|
_fecRateDelta(0),
|
||||||
|
_lastPrUpdateT(0),
|
||||||
|
_lossPr255(0.9999f),
|
||||||
|
_lossPrHistory(),
|
||||||
|
_shortMaxLossPr255(0),
|
||||||
|
_packetsPerFrame(0.9999f),
|
||||||
|
_packetsPerFrameKey(0.9999f),
|
||||||
|
_residualPacketLossFec(0),
|
||||||
|
_boostRateKey(2),
|
||||||
|
_codecWidth(0),
|
||||||
|
_codecHeight(0)
|
||||||
{
|
{
|
||||||
float packetRate = parameters->packetsPerFrame * parameters->frameRate;
|
Reset();
|
||||||
// Assume that all lost packets cohere to different frames
|
|
||||||
float lossRate = parameters->lossPr * packetRate;
|
|
||||||
if (parameters->keyFrameSize <= 1e-3)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
_efficiency = lossRate * parameters->keyFrameSize;
|
|
||||||
if (parameters->lossPr >= 1.0f / parameters->keyFrameSize ||
|
|
||||||
parameters->rtt > _IREQ_MAX_RTT)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
VCMPeriodicIntraMethod::UpdateParameters(const
|
|
||||||
VCMProtectionParameters* /*parameters*/)
|
|
||||||
{
|
|
||||||
// Periodic I-frames. The last thing we want to use.
|
|
||||||
_efficiency = 0.0f;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
VCMMbIntraRefreshMethod::UpdateParameters(const
|
|
||||||
VCMProtectionParameters* parameters)
|
|
||||||
{
|
|
||||||
// Assume optimal for now.
|
|
||||||
_efficiency = parameters->bitRate * parameters->lossPr /
|
|
||||||
(1.0f + parameters->lossPr);
|
|
||||||
if (parameters->bitRate < _MBREF_MIN_BITRATE)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VCMLossProtectionLogic::~VCMLossProtectionLogic()
|
VCMLossProtectionLogic::~VCMLossProtectionLogic()
|
||||||
{
|
{
|
||||||
ClearLossProtections();
|
Release();
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
VCMLossProtectionLogic::ClearLossProtections()
|
|
||||||
{
|
|
||||||
ListItem *item;
|
|
||||||
while ((item = _availableMethods.First()) != 0)
|
|
||||||
{
|
|
||||||
VCMProtectionMethod *method = static_cast<VCMProtectionMethod*>
|
|
||||||
(item->GetItem());
|
|
||||||
if (method != NULL)
|
|
||||||
{
|
|
||||||
delete method;
|
|
||||||
}
|
|
||||||
_availableMethods.PopFront();
|
|
||||||
}
|
|
||||||
_selectedMethod = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
VCMLossProtectionLogic::AddMethod(VCMProtectionMethod *newMethod)
|
VCMLossProtectionLogic::SetMethod(enum VCMProtectionMethodEnum newMethodType)
|
||||||
{
|
{
|
||||||
VCMProtectionMethod *method;
|
if (_selectedMethod != NULL)
|
||||||
ListItem *item;
|
|
||||||
if (newMethod == NULL)
|
|
||||||
{
|
{
|
||||||
return false;
|
if (_selectedMethod->Type() == newMethodType)
|
||||||
}
|
|
||||||
for (item = _availableMethods.First(); item != NULL;
|
|
||||||
item = _availableMethods.Next(item))
|
|
||||||
{
|
|
||||||
method = static_cast<VCMProtectionMethod *> (item->GetItem());
|
|
||||||
if (method != NULL && method->Type() == newMethod->Type())
|
|
||||||
{
|
{
|
||||||
|
// Nothing to update
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
// New method - delete existing one
|
||||||
|
delete _selectedMethod;
|
||||||
}
|
}
|
||||||
_availableMethods.PushBack(newMethod);
|
VCMProtectionMethod *newMethod = NULL;
|
||||||
|
switch (newMethodType)
|
||||||
|
{
|
||||||
|
case kNack:
|
||||||
|
{
|
||||||
|
newMethod = new VCMNackMethod();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case kFec:
|
||||||
|
{
|
||||||
|
newMethod = new VCMFecMethod();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case kNackFec:
|
||||||
|
{
|
||||||
|
newMethod = new VCMNackFecMethod();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
_selectedMethod = newMethod;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bool
|
bool
|
||||||
VCMLossProtectionLogic::RemoveMethod(VCMProtectionMethodEnum methodType)
|
VCMLossProtectionLogic::RemoveMethod(enum VCMProtectionMethodEnum method)
|
||||||
{
|
{
|
||||||
VCMProtectionMethod *method;
|
if (_selectedMethod == NULL)
|
||||||
ListItem *item;
|
|
||||||
bool foundAndRemoved = false;
|
|
||||||
for (item = _availableMethods.First(); item != NULL;
|
|
||||||
item = _availableMethods.Next(item))
|
|
||||||
{
|
{
|
||||||
method = static_cast<VCMProtectionMethod *> (item->GetItem());
|
return false;
|
||||||
if (method != NULL && method->Type() == methodType)
|
|
||||||
{
|
|
||||||
if (_selectedMethod != NULL &&
|
|
||||||
_selectedMethod->Type() == method->Type())
|
|
||||||
{
|
|
||||||
_selectedMethod = NULL;
|
|
||||||
}
|
|
||||||
_availableMethods.Erase(item);
|
|
||||||
item = NULL;
|
|
||||||
delete method;
|
|
||||||
foundAndRemoved = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return foundAndRemoved;
|
else if (_selectedMethod->Type() == method)
|
||||||
}
|
|
||||||
|
|
||||||
VCMProtectionMethod*
|
|
||||||
VCMLossProtectionLogic::FindMethod(VCMProtectionMethodEnum methodType) const
|
|
||||||
{
|
|
||||||
VCMProtectionMethod *method;
|
|
||||||
ListItem *item;
|
|
||||||
for (item = _availableMethods.First(); item != NULL;
|
|
||||||
item = _availableMethods.Next(item))
|
|
||||||
{
|
{
|
||||||
method = static_cast<VCMProtectionMethod *> (item->GetItem());
|
delete _selectedMethod;
|
||||||
if (method != NULL && method->Type() == methodType)
|
_selectedMethod = NULL;
|
||||||
{
|
|
||||||
return method;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return NULL;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
float
|
float
|
||||||
VCMLossProtectionLogic::HighestOverhead() const
|
VCMLossProtectionLogic::RequiredBitRate() const
|
||||||
{
|
{
|
||||||
VCMProtectionMethod *method;
|
float RequiredBitRate = 0.0f;
|
||||||
ListItem *item;
|
if (_selectedMethod != NULL)
|
||||||
float highestOverhead = 0.0f;
|
|
||||||
for (item = _availableMethods.First(); item != NULL;
|
|
||||||
item = _availableMethods.Next(item))
|
|
||||||
{
|
{
|
||||||
method = static_cast<VCMProtectionMethod *> (item->GetItem());
|
RequiredBitRate = _selectedMethod->RequiredBitRate();
|
||||||
if (method != NULL && method->RequiredBitRate() > highestOverhead)
|
|
||||||
{
|
|
||||||
highestOverhead = method->RequiredBitRate();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return highestOverhead;
|
return RequiredBitRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -774,7 +756,7 @@ VCMLossProtectionLogic::FilteredLoss() const
|
|||||||
|
|
||||||
//TODO: Update for hybrid
|
//TODO: Update for hybrid
|
||||||
//take the windowed max of the received loss
|
//take the windowed max of the received loss
|
||||||
if (_selectedMethod != NULL && _selectedMethod->Type() == kFEC)
|
if (_selectedMethod != NULL && _selectedMethod->Type() == kFec)
|
||||||
{
|
{
|
||||||
return MaxFilteredLossPr(VCMTickTime::MillisecondTimestamp());
|
return MaxFilteredLossPr(VCMTickTime::MillisecondTimestamp());
|
||||||
}
|
}
|
||||||
@ -829,8 +811,12 @@ VCMLossProtectionLogic::UpdateFrameSize(WebRtc_UWord16 width,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
VCMLossProtectionLogic::UpdateMethod(VCMProtectionMethod *newMethod /*=NULL */)
|
VCMLossProtectionLogic::UpdateMethod()
|
||||||
{
|
{
|
||||||
|
if (_selectedMethod == NULL)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
_currentParameters.rtt = _rtt;
|
_currentParameters.rtt = _rtt;
|
||||||
_currentParameters.lossPr = _lossPr;
|
_currentParameters.lossPr = _lossPr;
|
||||||
_currentParameters.bitRate = _bitRate;
|
_currentParameters.bitRate = _bitRate;
|
||||||
@ -843,15 +829,7 @@ VCMLossProtectionLogic::UpdateMethod(VCMProtectionMethod *newMethod /*=NULL */)
|
|||||||
_currentParameters.residualPacketLossFec = _residualPacketLossFec;
|
_currentParameters.residualPacketLossFec = _residualPacketLossFec;
|
||||||
_currentParameters.codecWidth = _codecWidth;
|
_currentParameters.codecWidth = _codecWidth;
|
||||||
_currentParameters.codecHeight = _codecHeight;
|
_currentParameters.codecHeight = _codecHeight;
|
||||||
|
return _selectedMethod->UpdateParameters(&_currentParameters);
|
||||||
// Update to new method, if not NULL
|
|
||||||
if (newMethod != NULL)
|
|
||||||
{
|
|
||||||
_selectedMethod = newMethod;
|
|
||||||
_selectedMethod->UpdateParameters(&_currentParameters);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VCMProtectionMethod*
|
VCMProtectionMethod*
|
||||||
@ -860,6 +838,12 @@ VCMLossProtectionLogic::SelectedMethod() const
|
|||||||
return _selectedMethod;
|
return _selectedMethod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VCMProtectionMethodEnum
|
||||||
|
VCMLossProtectionLogic::SelectedType() const
|
||||||
|
{
|
||||||
|
return _selectedMethod->Type();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
VCMLossProtectionLogic::Reset()
|
VCMLossProtectionLogic::Reset()
|
||||||
{
|
{
|
||||||
@ -876,7 +860,14 @@ VCMLossProtectionLogic::Reset()
|
|||||||
_lossPrHistory[i].timeMs = -1;
|
_lossPrHistory[i].timeMs = -1;
|
||||||
}
|
}
|
||||||
_shortMaxLossPr255 = 0;
|
_shortMaxLossPr255 = 0;
|
||||||
ClearLossProtections();
|
Release();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
VCMLossProtectionLogic::Release()
|
||||||
|
{
|
||||||
|
delete _selectedMethod;
|
||||||
|
_selectedMethod = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
#define WEBRTC_MODULES_VIDEO_CODING_MEDIA_OPT_UTIL_H_
|
#define WEBRTC_MODULES_VIDEO_CODING_MEDIA_OPT_UTIL_H_
|
||||||
|
|
||||||
#include "typedefs.h"
|
#include "typedefs.h"
|
||||||
#include "list_wrapper.h"
|
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
#include "exp_filter.h"
|
#include "exp_filter.h"
|
||||||
#include "internal_defines.h"
|
#include "internal_defines.h"
|
||||||
@ -40,9 +39,10 @@ enum HybridNackTH {
|
|||||||
|
|
||||||
struct VCMProtectionParameters
|
struct VCMProtectionParameters
|
||||||
{
|
{
|
||||||
VCMProtectionParameters() : rtt(0), lossPr(0), bitRate(0),
|
VCMProtectionParameters() : rtt(0), lossPr(0.0f), bitRate(0.0f),
|
||||||
packetsPerFrame(0), frameRate(0), keyFrameSize(0), fecRateDelta(0),
|
packetsPerFrame(0.0f), packetsPerFrameKey(0.0f), frameRate(0.0f),
|
||||||
fecRateKey(0), residualPacketLossFec(0.0), codecWidth(0), codecHeight(0)
|
keyFrameSize(0.0f), fecRateDelta(0), fecRateKey(0),
|
||||||
|
residualPacketLossFec(0.0f), codecWidth(0), codecHeight(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
WebRtc_UWord32 rtt;
|
WebRtc_UWord32 rtt;
|
||||||
@ -57,7 +57,6 @@ struct VCMProtectionParameters
|
|||||||
float residualPacketLossFec;
|
float residualPacketLossFec;
|
||||||
WebRtc_UWord16 codecWidth;
|
WebRtc_UWord16 codecWidth;
|
||||||
WebRtc_UWord16 codecHeight;
|
WebRtc_UWord16 codecHeight;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -67,12 +66,9 @@ struct VCMProtectionParameters
|
|||||||
|
|
||||||
enum VCMProtectionMethodEnum
|
enum VCMProtectionMethodEnum
|
||||||
{
|
{
|
||||||
kNACK,
|
kNack,
|
||||||
kFEC,
|
kFec,
|
||||||
kNackFec,
|
kNackFec,
|
||||||
kIntraRequest, // I-frame request
|
|
||||||
kPeriodicIntra, // I-frame refresh
|
|
||||||
kMBIntraRefresh, // Macro block refresh
|
|
||||||
kNone
|
kNone
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -89,19 +85,13 @@ public:
|
|||||||
class VCMProtectionMethod
|
class VCMProtectionMethod
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VCMProtectionMethod(VCMProtectionMethodEnum type) : _effectivePacketLoss(0),
|
VCMProtectionMethod();
|
||||||
_protectionFactorK(0), _protectionFactorD(0),
|
virtual ~VCMProtectionMethod();
|
||||||
_residualPacketLossFec(0.0), _scaleProtKey(2.0), _maxPayloadSize(1460),
|
|
||||||
_useUepProtectionK(false), _useUepProtectionD(true), _corrFecCost(1.0),
|
|
||||||
_efficiency(0), _type(type)
|
|
||||||
{_qmRobustness = new VCMQmRobustness();}
|
|
||||||
|
|
||||||
virtual ~VCMProtectionMethod() { delete _qmRobustness;}
|
|
||||||
|
|
||||||
// Updates the efficiency of the method using the parameters provided
|
// Updates the efficiency of the method using the parameters provided
|
||||||
//
|
//
|
||||||
// Input:
|
// Input:
|
||||||
// - parameters : Parameters used to calculate the efficiency
|
// - parameters : Parameters used to calculate efficiency
|
||||||
//
|
//
|
||||||
// Return value : True if this method is recommended in
|
// Return value : True if this method is recommended in
|
||||||
// the given conditions.
|
// the given conditions.
|
||||||
@ -146,6 +136,8 @@ public:
|
|||||||
// Updates content metrics
|
// Updates content metrics
|
||||||
void UpdateContentMetrics(const VideoContentMetrics* contentMetrics);
|
void UpdateContentMetrics(const VideoContentMetrics* contentMetrics);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
WebRtc_UWord8 _effectivePacketLoss;
|
WebRtc_UWord8 _effectivePacketLoss;
|
||||||
WebRtc_UWord8 _protectionFactorK;
|
WebRtc_UWord8 _protectionFactorK;
|
||||||
WebRtc_UWord8 _protectionFactorD;
|
WebRtc_UWord8 _protectionFactorD;
|
||||||
@ -158,20 +150,15 @@ public:
|
|||||||
bool _useUepProtectionK;
|
bool _useUepProtectionK;
|
||||||
bool _useUepProtectionD;
|
bool _useUepProtectionD;
|
||||||
float _corrFecCost;
|
float _corrFecCost;
|
||||||
|
enum VCMProtectionMethodEnum _type;
|
||||||
protected:
|
|
||||||
float _efficiency;
|
float _efficiency;
|
||||||
|
|
||||||
private:
|
|
||||||
const enum VCMProtectionMethodEnum _type;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class VCMNackMethod : public VCMProtectionMethod
|
class VCMNackMethod : public VCMProtectionMethod
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VCMNackMethod() : VCMProtectionMethod(kNACK) {}
|
VCMNackMethod();
|
||||||
virtual ~VCMNackMethod() {}
|
virtual ~VCMNackMethod();
|
||||||
virtual bool UpdateParameters(const VCMProtectionParameters* parameters);
|
virtual bool UpdateParameters(const VCMProtectionParameters* parameters);
|
||||||
// Get the effective packet loss
|
// Get the effective packet loss
|
||||||
bool EffectivePacketLoss(const VCMProtectionParameters* parameter);
|
bool EffectivePacketLoss(const VCMProtectionParameters* parameter);
|
||||||
@ -180,8 +167,8 @@ public:
|
|||||||
class VCMFecMethod : public VCMProtectionMethod
|
class VCMFecMethod : public VCMProtectionMethod
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VCMFecMethod() : VCMProtectionMethod(kFEC) {}
|
VCMFecMethod();
|
||||||
virtual ~VCMFecMethod() {}
|
virtual ~VCMFecMethod();
|
||||||
virtual bool UpdateParameters(const VCMProtectionParameters* parameters);
|
virtual bool UpdateParameters(const VCMProtectionParameters* parameters);
|
||||||
// Get the effective packet loss for ER
|
// Get the effective packet loss for ER
|
||||||
bool EffectivePacketLoss(const VCMProtectionParameters* parameters);
|
bool EffectivePacketLoss(const VCMProtectionParameters* parameters);
|
||||||
@ -199,69 +186,41 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class VCMNackFecMethod : public VCMProtectionMethod
|
class VCMNackFecMethod : public VCMFecMethod
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VCMNackFecMethod();
|
VCMNackFecMethod();
|
||||||
~VCMNackFecMethod();
|
virtual ~VCMNackFecMethod();
|
||||||
virtual bool UpdateParameters(const VCMProtectionParameters* parameters);
|
virtual bool UpdateParameters(const VCMProtectionParameters* parameters);
|
||||||
// Get the effective packet loss for ER
|
// Get the effective packet loss for ER
|
||||||
bool EffectivePacketLoss(const VCMProtectionParameters* parameters);
|
bool EffectivePacketLoss(const VCMProtectionParameters* parameters);
|
||||||
// Get the FEC protection factors
|
// Get the protection factors
|
||||||
bool ProtectionFactor(const VCMProtectionParameters* parameters);
|
bool ProtectionFactor(const VCMProtectionParameters* parameters);
|
||||||
private:
|
|
||||||
VCMFecMethod* _fecMethod;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class VCMIntraReqMethod : public VCMProtectionMethod
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
VCMIntraReqMethod() : VCMProtectionMethod(kIntraRequest), _IREQ_MAX_RTT(150)
|
|
||||||
{}
|
|
||||||
virtual bool UpdateParameters(const VCMProtectionParameters* parameters);
|
|
||||||
private:
|
|
||||||
const WebRtc_UWord32 _IREQ_MAX_RTT;
|
|
||||||
};
|
|
||||||
|
|
||||||
class VCMPeriodicIntraMethod : public VCMProtectionMethod
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
VCMPeriodicIntraMethod() : VCMProtectionMethod(kPeriodicIntra) {}
|
|
||||||
virtual bool UpdateParameters(const VCMProtectionParameters* parameters);
|
|
||||||
};
|
|
||||||
|
|
||||||
class VCMMbIntraRefreshMethod : public VCMProtectionMethod
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
VCMMbIntraRefreshMethod() :
|
|
||||||
VCMProtectionMethod(kMBIntraRefresh), _MBREF_MIN_BITRATE(150) {}
|
|
||||||
virtual bool UpdateParameters(const VCMProtectionParameters* parameters);
|
|
||||||
virtual float RequiredBitRate() { return 0.0; }
|
|
||||||
private:
|
|
||||||
const WebRtc_UWord32 _MBREF_MIN_BITRATE;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class VCMLossProtectionLogic
|
class VCMLossProtectionLogic
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VCMLossProtectionLogic() : _availableMethods(), _selectedMethod(NULL),
|
VCMLossProtectionLogic();
|
||||||
_bestNotOkMethod(NULL), _currentParameters(), _rtt(0), _lossPr(0.0f),
|
|
||||||
_bitRate(0.0f), _frameRate(0.0f), _keyFrameSize(0.0f), _fecRateKey(0),
|
|
||||||
_fecRateDelta(0), _lastPrUpdateT(0), _lossPr255(0.9999f),
|
|
||||||
_lossPrHistory(), _shortMaxLossPr255(0), _packetsPerFrame(0.9999f),
|
|
||||||
_packetsPerFrameKey(0.9999f), _residualPacketLossFec(0),
|
|
||||||
_boostRateKey(2), _codecWidth(0), _codecHeight(0)
|
|
||||||
{ Reset(); }
|
|
||||||
|
|
||||||
~VCMLossProtectionLogic();
|
~VCMLossProtectionLogic();
|
||||||
|
|
||||||
void ClearLossProtections();
|
// Set the protection method to be used
|
||||||
bool AddMethod(VCMProtectionMethod *newMethod);
|
//
|
||||||
bool RemoveMethod(VCMProtectionMethodEnum methodType);
|
// Input:
|
||||||
VCMProtectionMethod* FindMethod(VCMProtectionMethodEnum methodType) const;
|
// - newMethodType : New requested protection method type. If one
|
||||||
float HighestOverhead() const;
|
// is already set, it will be deleted and replaced
|
||||||
|
// Return value: Returns true on update
|
||||||
|
bool SetMethod(enum VCMProtectionMethodEnum newMethodType);
|
||||||
|
|
||||||
|
// Remove requested protection method
|
||||||
|
// Input:
|
||||||
|
// - method : method to be removed (if currently selected)
|
||||||
|
//
|
||||||
|
// Return value: Returns true on update
|
||||||
|
bool RemoveMethod(enum VCMProtectionMethodEnum method);
|
||||||
|
|
||||||
|
// Return required bit rate per selected protectin method
|
||||||
|
float RequiredBitRate() const;
|
||||||
|
|
||||||
// Update the round-trip time
|
// Update the round-trip time
|
||||||
//
|
//
|
||||||
@ -340,18 +299,17 @@ public:
|
|||||||
|
|
||||||
// Update the protection methods with the current VCMProtectionParameters
|
// Update the protection methods with the current VCMProtectionParameters
|
||||||
// and set the requested protection settings.
|
// and set the requested protection settings.
|
||||||
//
|
|
||||||
// Input:
|
|
||||||
// - newMethod : If not NULL, this method will be selected.
|
|
||||||
//
|
|
||||||
// Return value : Returns true on update
|
// Return value : Returns true on update
|
||||||
bool UpdateMethod(VCMProtectionMethod *newMethod = NULL);
|
bool UpdateMethod();
|
||||||
|
|
||||||
// Returns the method currently selected.
|
// Returns the method currently selected.
|
||||||
//
|
//
|
||||||
// Return value : The protection method currently selected.
|
// Return value : The protection method currently selected.
|
||||||
VCMProtectionMethod* SelectedMethod() const;
|
VCMProtectionMethod* SelectedMethod() const;
|
||||||
|
|
||||||
|
// Return the protection type of the currently selected method
|
||||||
|
VCMProtectionMethodEnum SelectedType() const;
|
||||||
|
|
||||||
// Returns the filtered loss probability in the interval [0, 255].
|
// Returns the filtered loss probability in the interval [0, 255].
|
||||||
//
|
//
|
||||||
// Return value : The filtered loss probability
|
// Return value : The filtered loss probability
|
||||||
@ -359,13 +317,13 @@ public:
|
|||||||
|
|
||||||
void Reset();
|
void Reset();
|
||||||
|
|
||||||
|
void Release();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Sets the available loss protection methods.
|
// Sets the available loss protection methods.
|
||||||
void UpdateMaxLossHistory(WebRtc_UWord8 lossPr255, WebRtc_Word64 now);
|
void UpdateMaxLossHistory(WebRtc_UWord8 lossPr255, WebRtc_Word64 now);
|
||||||
WebRtc_UWord8 MaxFilteredLossPr(WebRtc_Word64 nowMs) const;
|
WebRtc_UWord8 MaxFilteredLossPr(WebRtc_Word64 nowMs) const;
|
||||||
ListWrapper _availableMethods;
|
|
||||||
VCMProtectionMethod* _selectedMethod;
|
VCMProtectionMethod* _selectedMethod;
|
||||||
VCMProtectionMethod* _bestNotOkMethod;
|
|
||||||
VCMProtectionParameters _currentParameters;
|
VCMProtectionParameters _currentParameters;
|
||||||
WebRtc_UWord32 _rtt;
|
WebRtc_UWord32 _rtt;
|
||||||
float _lossPr;
|
float _lossPr;
|
||||||
|
@ -27,7 +27,6 @@ _packetLossEnc(0),
|
|||||||
_fractionLost(0),
|
_fractionLost(0),
|
||||||
_sendStatisticsZeroEncode(0),
|
_sendStatisticsZeroEncode(0),
|
||||||
_maxPayloadSize(1460),
|
_maxPayloadSize(1460),
|
||||||
_lastBitRate(0),
|
|
||||||
_targetBitRate(0),
|
_targetBitRate(0),
|
||||||
_incomingFrameRate(0),
|
_incomingFrameRate(0),
|
||||||
_enableQm(false),
|
_enableQm(false),
|
||||||
@ -51,7 +50,7 @@ _lastChangeTime(0)
|
|||||||
|
|
||||||
VCMMediaOptimization::~VCMMediaOptimization(void)
|
VCMMediaOptimization::~VCMMediaOptimization(void)
|
||||||
{
|
{
|
||||||
_lossProtLogic->ClearLossProtections();
|
_lossProtLogic->Release();
|
||||||
delete _lossProtLogic;
|
delete _lossProtLogic;
|
||||||
delete _frameDropper;
|
delete _frameDropper;
|
||||||
delete _content;
|
delete _content;
|
||||||
@ -71,7 +70,6 @@ VCMMediaOptimization::Reset()
|
|||||||
_lossProtLogic->UpdateFrameRate(_incomingFrameRate);
|
_lossProtLogic->UpdateFrameRate(_incomingFrameRate);
|
||||||
_lossProtLogic->Reset();
|
_lossProtLogic->Reset();
|
||||||
_sendStatisticsZeroEncode = 0;
|
_sendStatisticsZeroEncode = 0;
|
||||||
_lastBitRate = 0;
|
|
||||||
_targetBitRate = 0;
|
_targetBitRate = 0;
|
||||||
_lossProtOverhead = 0;
|
_lossProtOverhead = 0;
|
||||||
_codecWidth = 0;
|
_codecWidth = 0;
|
||||||
@ -144,7 +142,7 @@ VCMMediaOptimization::SetTargetRates(WebRtc_UWord32 bitRate,
|
|||||||
|
|
||||||
// Get the bit cost of protection method
|
// Get the bit cost of protection method
|
||||||
_lossProtOverhead = static_cast<WebRtc_UWord32>
|
_lossProtOverhead = static_cast<WebRtc_UWord32>
|
||||||
(_lossProtLogic->HighestOverhead() + 0.5f);
|
(_lossProtLogic->RequiredBitRate() + 0.5f);
|
||||||
|
|
||||||
// Get the effective packet loss for encoder ER
|
// Get the effective packet loss for encoder ER
|
||||||
// when applicable, should be passed to encoder via fractionLost
|
// when applicable, should be passed to encoder via fractionLost
|
||||||
@ -154,9 +152,6 @@ VCMMediaOptimization::SetTargetRates(WebRtc_UWord32 bitRate,
|
|||||||
// Update encoding rates following protection settings
|
// Update encoding rates following protection settings
|
||||||
_frameDropper->SetRates(static_cast<float>(bitRate -
|
_frameDropper->SetRates(static_cast<float>(bitRate -
|
||||||
_lossProtOverhead), 0);
|
_lossProtOverhead), 0);
|
||||||
// This may be used for UpdateEncoderBitRate: lastBitRate is total rate,
|
|
||||||
// before compensation
|
|
||||||
_lastBitRate = _targetBitRate;
|
|
||||||
|
|
||||||
// Source coding rate: total rate - protection overhead
|
// Source coding rate: total rate - protection overhead
|
||||||
_targetBitRate = bitRate - _lossProtOverhead;
|
_targetBitRate = bitRate - _lossProtOverhead;
|
||||||
@ -205,7 +200,7 @@ VCMMediaOptimization::UpdateProtectionCallback(VCMProtectionMethod
|
|||||||
|
|
||||||
// NACK is on for NACK and NackFec protection method: off for FEC method
|
// NACK is on for NACK and NackFec protection method: off for FEC method
|
||||||
bool nackStatus = (selectedMethod->Type() == kNackFec ||
|
bool nackStatus = (selectedMethod->Type() == kNackFec ||
|
||||||
selectedMethod->Type() == kNACK);
|
selectedMethod->Type() == kNack);
|
||||||
|
|
||||||
return _videoProtectionCallback->ProtectionRequest(codeRateDeltaRTP,
|
return _videoProtectionCallback->ProtectionRequest(codeRateDeltaRTP,
|
||||||
codeRateKeyRTP,
|
codeRateKeyRTP,
|
||||||
@ -270,31 +265,24 @@ VCMMediaOptimization::RegisterProtectionCallback(VCMProtectionCallback*
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
VCMMediaOptimization::EnableFrameDropper(bool enable)
|
VCMMediaOptimization::EnableFrameDropper(bool enable)
|
||||||
{
|
{
|
||||||
_frameDropper->Enable(enable);
|
_frameDropper->Enable(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
VCMMediaOptimization::EnableNack(bool enable)
|
VCMMediaOptimization::EnableProtectionMethod(bool enable,
|
||||||
|
VCMProtectionMethodEnum method)
|
||||||
{
|
{
|
||||||
// Add NACK to the list of loss protection methods
|
|
||||||
bool updated = false;
|
bool updated = false;
|
||||||
if (enable)
|
if (enable)
|
||||||
{
|
{
|
||||||
VCMProtectionMethod *nackMethod = new VCMNackMethod();
|
updated = _lossProtLogic->SetMethod(method);
|
||||||
updated = _lossProtLogic->AddMethod(nackMethod);
|
|
||||||
if (!updated)
|
|
||||||
{
|
|
||||||
delete nackMethod;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
updated = _lossProtLogic->RemoveMethod(kNACK);
|
_lossProtLogic->RemoveMethod(method);
|
||||||
}
|
}
|
||||||
if (updated)
|
if (updated)
|
||||||
{
|
{
|
||||||
@ -303,68 +291,9 @@ VCMMediaOptimization::EnableNack(bool enable)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
VCMMediaOptimization::IsNackEnabled()
|
VCMMediaOptimization::IsProtectionMethodEnabled(VCMProtectionMethodEnum method)
|
||||||
{
|
{
|
||||||
return (_lossProtLogic->FindMethod(kNACK) != NULL);
|
return (_lossProtLogic->SelectedType() == method);
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
VCMMediaOptimization::EnableFEC(bool enable)
|
|
||||||
{
|
|
||||||
// Add FEC to the list of loss protection methods
|
|
||||||
bool updated = false;
|
|
||||||
if (enable)
|
|
||||||
{
|
|
||||||
VCMProtectionMethod *fecMethod = new VCMFecMethod();
|
|
||||||
updated = _lossProtLogic->AddMethod(fecMethod);
|
|
||||||
if (!updated)
|
|
||||||
{
|
|
||||||
delete fecMethod;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
updated = _lossProtLogic->RemoveMethod(kFEC);
|
|
||||||
}
|
|
||||||
if (updated)
|
|
||||||
{
|
|
||||||
_lossProtLogic->UpdateMethod();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void
|
|
||||||
VCMMediaOptimization::EnableNackFEC(bool enable)
|
|
||||||
{
|
|
||||||
// Add NackFec to the list of loss protection methods
|
|
||||||
bool updated = false;
|
|
||||||
if (enable)
|
|
||||||
{
|
|
||||||
VCMProtectionMethod *nackfecMethod = new VCMNackFecMethod();
|
|
||||||
updated = _lossProtLogic->AddMethod(nackfecMethod);
|
|
||||||
if (!updated)
|
|
||||||
{
|
|
||||||
delete nackfecMethod;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
updated = _lossProtLogic->RemoveMethod(kNackFec);
|
|
||||||
}
|
|
||||||
if (updated)
|
|
||||||
{
|
|
||||||
_lossProtLogic->UpdateMethod();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
VCMMediaOptimization::IsFecEnabled()
|
|
||||||
{
|
|
||||||
return (_lossProtLogic->FindMethod(kFEC) != NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
VCMMediaOptimization::IsNackFecEnabled()
|
|
||||||
{
|
|
||||||
return (_lossProtLogic->FindMethod(kNackFec) != NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -67,35 +67,17 @@ public:
|
|||||||
WebRtc_UWord16 width,
|
WebRtc_UWord16 width,
|
||||||
WebRtc_UWord16 height);
|
WebRtc_UWord16 height);
|
||||||
/**
|
/**
|
||||||
* Enable NACK and update error resilience parameters
|
* Enable protection method
|
||||||
*/
|
*/
|
||||||
void EnableNack(bool enable);
|
void EnableProtectionMethod(bool enable, VCMProtectionMethodEnum method);
|
||||||
/**
|
/**
|
||||||
* Returns weather or not NACK is enabled
|
* Returns weather or not protection method is enabled
|
||||||
*/
|
*/
|
||||||
bool IsNackEnabled();
|
bool IsProtectionMethodEnabled(VCMProtectionMethodEnum method);
|
||||||
/**
|
|
||||||
* Enable FEC and update error resilience parameters
|
|
||||||
*/
|
|
||||||
void EnableFEC(bool enable);
|
|
||||||
/**
|
|
||||||
* Returns weather or not FEC is enabled
|
|
||||||
*/
|
|
||||||
bool IsFecEnabled();
|
|
||||||
/**
|
|
||||||
* Returns weather or not NackFec is enabled
|
|
||||||
*/
|
|
||||||
bool IsNackFecEnabled();
|
|
||||||
/**
|
/**
|
||||||
* Updates the max pay load size
|
* Updates the max pay load size
|
||||||
*/
|
*/
|
||||||
/**
|
|
||||||
* Enable NackFec and update error resilience parameters
|
|
||||||
*/
|
|
||||||
void EnableNackFEC(bool enable);
|
|
||||||
|
|
||||||
void SetMtu(WebRtc_Word32 mtu);
|
void SetMtu(WebRtc_Word32 mtu);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get actual input frame rate
|
* Get actual input frame rate
|
||||||
*/
|
*/
|
||||||
@ -122,10 +104,10 @@ public:
|
|||||||
* Register a protection callback to be used to inform the user about the
|
* Register a protection callback to be used to inform the user about the
|
||||||
* protection methods used
|
* protection methods used
|
||||||
*/
|
*/
|
||||||
WebRtc_Word32 RegisterProtectionCallback(VCMProtectionCallback* protectionCallback);
|
WebRtc_Word32 RegisterProtectionCallback(VCMProtectionCallback*
|
||||||
|
protectionCallback);
|
||||||
/*
|
/*
|
||||||
* Register a quality settings callback to be used to inform VPM/user about the optimal
|
* Register a quality settings callback to be used to inform VPM/user about
|
||||||
* quality settings (frame rate/dimension) required
|
|
||||||
*/
|
*/
|
||||||
WebRtc_Word32 RegisterVideoQMCallback(VCMQMSettingsCallback* videoQMSettings);
|
WebRtc_Word32 RegisterVideoQMCallback(VCMQMSettingsCallback* videoQMSettings);
|
||||||
void EnableFrameDropper(bool enable);
|
void EnableFrameDropper(bool enable);
|
||||||
@ -194,7 +176,6 @@ private:
|
|||||||
WebRtc_UWord32 _sendStatistics[4];
|
WebRtc_UWord32 _sendStatistics[4];
|
||||||
WebRtc_UWord32 _sendStatisticsZeroEncode;
|
WebRtc_UWord32 _sendStatisticsZeroEncode;
|
||||||
WebRtc_Word32 _maxPayloadSize;
|
WebRtc_Word32 _maxPayloadSize;
|
||||||
WebRtc_UWord32 _lastBitRate;
|
|
||||||
WebRtc_UWord32 _targetBitRate;
|
WebRtc_UWord32 _targetBitRate;
|
||||||
|
|
||||||
float _incomingFrameRate;
|
float _incomingFrameRate;
|
||||||
@ -215,7 +196,7 @@ private:
|
|||||||
VCMQmResolution* _qmResolution;
|
VCMQmResolution* _qmResolution;
|
||||||
|
|
||||||
WebRtc_Word64 _lastQMUpdateTime;
|
WebRtc_Word64 _lastQMUpdateTime;
|
||||||
WebRtc_Word64 _lastChangeTime; // content or user triggered
|
WebRtc_Word64 _lastChangeTime; // content/user triggered
|
||||||
|
|
||||||
|
|
||||||
}; // end of VCMMediaOptimization class definition
|
}; // end of VCMMediaOptimization class definition
|
||||||
|
@ -590,15 +590,13 @@ VideoCodingModuleImpl::SetVideoProtection(VCMVideoProtection videoProtection, bo
|
|||||||
|
|
||||||
case kProtectionNackSender:
|
case kProtectionNackSender:
|
||||||
{
|
{
|
||||||
// Send-side only
|
|
||||||
CriticalSectionScoped cs(_sendCritSect);
|
CriticalSectionScoped cs(_sendCritSect);
|
||||||
_mediaOpt.EnableNack(enable);
|
_mediaOpt.EnableProtectionMethod(enable, kNack);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case kProtectionNackReceiver:
|
case kProtectionNackReceiver:
|
||||||
{
|
{
|
||||||
// Receive-side only
|
|
||||||
CriticalSectionScoped cs(_receiveCritSect);
|
CriticalSectionScoped cs(_receiveCritSect);
|
||||||
if (enable)
|
if (enable)
|
||||||
{
|
{
|
||||||
@ -679,7 +677,7 @@ VideoCodingModuleImpl::SetVideoProtection(VCMVideoProtection videoProtection, bo
|
|||||||
// Send Side
|
// Send Side
|
||||||
{
|
{
|
||||||
CriticalSectionScoped cs(_sendCritSect);
|
CriticalSectionScoped cs(_sendCritSect);
|
||||||
_mediaOpt.EnableNackFEC(enable);
|
_mediaOpt.EnableProtectionMethod(enable, kNackFec);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -687,7 +685,7 @@ VideoCodingModuleImpl::SetVideoProtection(VCMVideoProtection videoProtection, bo
|
|||||||
case kProtectionFEC:
|
case kProtectionFEC:
|
||||||
{
|
{
|
||||||
CriticalSectionScoped cs(_sendCritSect);
|
CriticalSectionScoped cs(_sendCritSect);
|
||||||
_mediaOpt.EnableFEC(enable);
|
_mediaOpt.EnableProtectionMethod(enable, kFec);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user