Add the FEC mask type to FecProtectionParams and set the mask type in the VCM.

Review URL: https://webrtc-codereview.appspot.com/682004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@2514 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
marpan@webrtc.org 2012-07-13 16:27:51 +00:00
parent d96dcef422
commit 71707aaae8
6 changed files with 30 additions and 17 deletions

View File

@ -297,11 +297,21 @@ struct RTCPVoIPMetric
WebRtc_UWord16 JBabsMax;
};
// Types for the FEC packet masks. The type |kFecMaskRandom| is based on a
// random loss model. The type |kFecMaskBursty| is based on a bursty/consecutive
// loss model. The packet masks are defined in
// modules/rtp_rtcp/fec_private_tables_random(bursty).h
enum FecMaskType {
kFecMaskRandom,
kFecMaskBursty,
};
// Struct containing forward error correction settings.
struct FecProtectionParams {
int fec_rate;
bool use_uep_protection;
int max_fec_frames;
FecMaskType fec_mask_type;
};
// class describing a complete, or parts of an encoded frame.

View File

@ -21,16 +21,6 @@
namespace webrtc {
// Types for the FEC packet masks. The type |kFecMaskRandom| selects the mask
// defined in fec_private_tables_random.h, and is based on a random loss model.
// The type |kFecMaskBursty| selects the mask defined in
// fec_private_tables_bursty.h, and is based on a bursty loss model. Please
// refer to those files for a more detailed description.
enum FecMaskType {
kFecMaskRandom,
kFecMaskBursty,
};
// Forward declaration.
class FecPacket;

View File

@ -164,14 +164,11 @@ int ProducerFec::AddRtpPacketAndGenerateFec(const uint8_t* data_buffer,
(ExcessOverheadBelowMax() && MinimumMediaPacketsReached()))) {
assert(num_first_partition_ <=
static_cast<int>(ForwardErrorCorrection::kMaxMediaPackets));
// TODO(marpan): The setting of the mask type (|kFecMaskRandom| or
// |kFecMaskBursty|) should be part of FecProtectionParams and passed
// in from the VCM.
int ret = fec_->GenerateFEC(media_packets_fec_,
params_.fec_rate,
num_first_partition_,
params_.use_uep_protection,
kFecMaskBursty,
params_.fec_mask_type,
&fec_packets_);
if (fec_packets_.empty()) {
num_frames_ = 0;

View File

@ -56,6 +56,8 @@ RTPSenderVideo::RTPSenderVideo(const WebRtc_Word32 id,
memset(&delta_fec_params_, 0, sizeof(delta_fec_params_));
memset(&key_fec_params_, 0, sizeof(key_fec_params_));
delta_fec_params_.max_fec_frames = key_fec_params_.max_fec_frames = 1;
delta_fec_params_.fec_mask_type = key_fec_params_.fec_mask_type =
kFecMaskRandom;
}
RTPSenderVideo::~RTPSenderVideo()
@ -213,6 +215,8 @@ RTPSenderVideo::SetGenericFECStatus(const bool enable,
memset(&delta_fec_params_, 0, sizeof(delta_fec_params_));
memset(&key_fec_params_, 0, sizeof(key_fec_params_));
delta_fec_params_.max_fec_frames = key_fec_params_.max_fec_frames = 1;
delta_fec_params_.fec_mask_type = key_fec_params_.fec_mask_type =
kFecMaskRandom;
return 0;
}

View File

@ -228,6 +228,13 @@ int VCMMediaOptimization::UpdateProtectionCallback(
delta_fec_params.max_fec_frames = selected_method->MaxFramesFec();
key_fec_params.max_fec_frames = selected_method->MaxFramesFec();
// Set the FEC packet mask type. |kFecMaskBursty| is more effective for
// consecutive losses and little/no packet re-ordering. As we currently
// do not have feedback data on the degree of correlated losses and packet
// re-ordering, we keep default setting to |kFecMaskRandom| for now.
delta_fec_params.fec_mask_type = kFecMaskRandom;
key_fec_params.fec_mask_type = kFecMaskRandom;
// TODO(Marco): Pass FEC protection values per layer.
return _videoProtectionCallback->ProtectionRequest(&delta_fec_params,
&key_fec_params,

View File

@ -729,13 +729,18 @@ WebRtc_Word32 ViEEncoder::ProtectionRequest(
WEBRTC_TRACE(webrtc::kTraceStream, webrtc::kTraceVideo,
ViEId(engine_id_, channel_id_),
"%s, deltaFECRate: %u, key_fecrate: %u, "
"delta_use_uep_protection: %d, key_use_uep_protection: %d, ",
"delta_use_uep_protection: %d, key_use_uep_protection: %d, "
"delta_max_fec_frames: %d, key_max_fec_frames: %d, "
"delta_mask_type: %d, key_mask_type: %d, ",
__FUNCTION__,
delta_fec_params->fec_rate,
key_fec_params->fec_rate,
delta_fec_params->use_uep_protection,
key_fec_params->use_uep_protection);
key_fec_params->use_uep_protection,
delta_fec_params->max_fec_frames,
key_fec_params->max_fec_frames,
delta_fec_params->fec_mask_type,
key_fec_params->fec_mask_type);
if (default_rtp_rtcp_->SetFecParameters(delta_fec_params,
key_fec_params) != 0) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceVideo,