Add error resilient mode options to the VP8 specific VideoCodec struct.

It is useful to disable error resilience when we know we won't decode
with errors.

BUG=
TEST=

Review URL: http://webrtc-codereview.appspot.com/329015

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1305 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
stefan@webrtc.org 2011-12-29 10:12:35 +00:00
parent 67f294a48a
commit efd0a48c61
3 changed files with 30 additions and 2 deletions

View File

@ -469,6 +469,17 @@ enum VideoCodecProfile
kProfileMain = 0x01
};
enum VP8ResilienceMode {
kResilienceOff, // The stream produced by the encoder requires a
// recovery frame (typically a key frame) to be
// decodable after a packet loss.
kResilientStream, // A stream produced by the encoder is resilient to
// packet losses, but packets within a frame subsequent
// to a loss can't be decoded.
kResilientFrames // Same as kResilientStream but with added resilience
// within a frame.
};
struct VideoCodecH264
{
H264Packetization packetization;
@ -489,6 +500,7 @@ struct VideoCodecVP8
bool pictureLossIndicationOn;
bool feedbackModeOn;
VideoCodecComplexity complexity;
VP8ResilienceMode resilience;
unsigned char numberOfTemporalLayers;
};

View File

@ -292,11 +292,26 @@ VP8Encoder::InitEncode(const VideoCodec* inst,
_cfg->g_timebase.num = 1;
_cfg->g_timebase.den = 90000;
// Set the error resilience mode according to user settings.
switch (inst->codecSpecific.VP8.resilience) {
case kResilienceOff:
_cfg->g_error_resilient = 0;
break;
case kResilientStream:
_cfg->g_error_resilient = 1; // TODO(holmer): Replace with
// VPX_ERROR_RESILIENT_DEFAULT when we
// drop support for libvpx 9.6.0.
break;
case kResilientFrames:
#ifdef INDEPENDENT_PARTITIONS
_cfg->g_error_resilient = VPX_ERROR_RESILIENT_DEFAULT | VPX_ERROR_RESILIENT_PARTITIONS;
_cfg->g_error_resilient = VPX_ERROR_RESILIENT_DEFAULT |
VPX_ERROR_RESILIENT_PARTITIONS;
#else
_cfg->g_error_resilient = 1;
return WEBRTC_VIDEO_CODEC_ERR_PARAMETER; // Not supported
#endif
break;
}
_cfg->g_lag_in_frames = 0; // 0- no frame lagging
// Determining number of threads based on the image size

View File

@ -213,6 +213,7 @@ VCMCodecDataBase::Codec(WebRtc_UWord8 listId, VideoCodec *settings)
settings->width = VCM_DEFAULT_CODEC_WIDTH;
settings->height = VCM_DEFAULT_CODEC_HEIGHT;
settings->numberOfSimulcastStreams = 0;
settings->codecSpecific.VP8.resilience = kResilientStream;
settings->codecSpecific.VP8.numberOfTemporalLayers = 1;
break;
}