Expose VP8/H264 defaults through video_encoder.h.
Reduces code duplication quite a bit, these identical defaults were set in quite a few different places. R=mflodman@webrtc.org, stefan@webrtc.org BUG=3070 Review URL: https://webrtc-codereview.appspot.com/19299004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7220 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
c7134f8286
commit
6cd6ba8ae0
@ -212,14 +212,9 @@ void* WebRtcVideoEncoderFactory2::CreateVideoEncoderSettings(
|
||||
const VideoOptions& options) {
|
||||
assert(SupportsCodec(codec));
|
||||
if (_stricmp(codec.name.c_str(), kVp8CodecName) == 0) {
|
||||
webrtc::VideoCodecVP8* settings = new webrtc::VideoCodecVP8();
|
||||
settings->resilience = webrtc::kResilientStream;
|
||||
settings->numberOfTemporalLayers = 1;
|
||||
webrtc::VideoCodecVP8* settings = new webrtc::VideoCodecVP8(
|
||||
webrtc::VideoEncoder::GetDefaultVp8Settings());
|
||||
options.video_noise_reduction.Get(&settings->denoisingOn);
|
||||
settings->errorConcealmentOn = false;
|
||||
settings->automaticResizeOn = false;
|
||||
settings->frameDroppingOn = true;
|
||||
settings->keyFrameInterval = 3000;
|
||||
return settings;
|
||||
}
|
||||
return NULL;
|
||||
|
||||
@ -24,6 +24,36 @@
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
VideoCodecVP8 VideoEncoder::GetDefaultVp8Settings() {
|
||||
VideoCodecVP8 vp8_settings;
|
||||
memset(&vp8_settings, 0, sizeof(vp8_settings));
|
||||
|
||||
vp8_settings.resilience = kResilientStream;
|
||||
vp8_settings.numberOfTemporalLayers = 1;
|
||||
vp8_settings.denoisingOn = true;
|
||||
vp8_settings.errorConcealmentOn = false;
|
||||
vp8_settings.automaticResizeOn = false;
|
||||
vp8_settings.frameDroppingOn = true;
|
||||
vp8_settings.keyFrameInterval = 3000;
|
||||
|
||||
return vp8_settings;
|
||||
}
|
||||
|
||||
VideoCodecH264 VideoEncoder::GetDefaultH264Settings() {
|
||||
VideoCodecH264 h264_settings;
|
||||
memset(&h264_settings, 0, sizeof(h264_settings));
|
||||
|
||||
h264_settings.profile = kProfileBase;
|
||||
h264_settings.frameDroppingOn = true;
|
||||
h264_settings.keyFrameInterval = 3000;
|
||||
h264_settings.spsData = NULL;
|
||||
h264_settings.spsLen = 0;
|
||||
h264_settings.ppsData = NULL;
|
||||
h264_settings.ppsLen = 0;
|
||||
|
||||
return h264_settings;
|
||||
}
|
||||
|
||||
VCMDecoderMapItem::VCMDecoderMapItem(VideoCodec* settings,
|
||||
int number_of_cores,
|
||||
bool require_key_frame)
|
||||
@ -92,13 +122,7 @@ bool VCMCodecDataBase::Codec(int list_id,
|
||||
settings->height = VCM_DEFAULT_CODEC_HEIGHT;
|
||||
settings->numberOfSimulcastStreams = 0;
|
||||
settings->qpMax = 56;
|
||||
settings->codecSpecific.VP8.resilience = kResilientStream;
|
||||
settings->codecSpecific.VP8.numberOfTemporalLayers = 1;
|
||||
settings->codecSpecific.VP8.denoisingOn = true;
|
||||
settings->codecSpecific.VP8.errorConcealmentOn = false;
|
||||
settings->codecSpecific.VP8.automaticResizeOn = false;
|
||||
settings->codecSpecific.VP8.frameDroppingOn = true;
|
||||
settings->codecSpecific.VP8.keyFrameInterval = 3000;
|
||||
settings->codecSpecific.VP8 = VideoEncoder::GetDefaultVp8Settings();
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
@ -116,13 +140,7 @@ bool VCMCodecDataBase::Codec(int list_id,
|
||||
settings->height = VCM_DEFAULT_CODEC_HEIGHT;
|
||||
settings->numberOfSimulcastStreams = 0;
|
||||
settings->qpMax = 56;
|
||||
settings->codecSpecific.H264.profile = kProfileBase;
|
||||
settings->codecSpecific.H264.frameDroppingOn = true;
|
||||
settings->codecSpecific.H264.keyFrameInterval = 3000;
|
||||
settings->codecSpecific.H264.spsData = NULL;
|
||||
settings->codecSpecific.H264.spsLen = 0;
|
||||
settings->codecSpecific.H264.ppsData = NULL;
|
||||
settings->codecSpecific.H264.ppsLen = 0;
|
||||
settings->codecSpecific.H264 = VideoEncoder::GetDefaultH264Settings();
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "webrtc/video_encoder.h"
|
||||
#include "webrtc/video_engine/vie_defines.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -68,19 +69,9 @@ VideoCodec CreateDecoderVideoCodec(
|
||||
}
|
||||
|
||||
if (codec.codecType == kVideoCodecVP8) {
|
||||
codec.codecSpecific.VP8.resilience = kResilientStream;
|
||||
codec.codecSpecific.VP8.numberOfTemporalLayers = 1;
|
||||
codec.codecSpecific.VP8.denoisingOn = true;
|
||||
codec.codecSpecific.VP8.errorConcealmentOn = false;
|
||||
codec.codecSpecific.VP8.automaticResizeOn = false;
|
||||
codec.codecSpecific.VP8.frameDroppingOn = true;
|
||||
codec.codecSpecific.VP8.keyFrameInterval = 3000;
|
||||
}
|
||||
|
||||
if (codec.codecType == kVideoCodecH264) {
|
||||
codec.codecSpecific.H264.profile = kProfileBase;
|
||||
codec.codecSpecific.H264.frameDroppingOn = true;
|
||||
codec.codecSpecific.H264.keyFrameInterval = 3000;
|
||||
codec.codecSpecific.VP8 = VideoEncoder::GetDefaultVp8Settings();
|
||||
} else if (codec.codecType == kVideoCodecH264) {
|
||||
codec.codecSpecific.H264 = VideoEncoder::GetDefaultH264Settings();
|
||||
}
|
||||
|
||||
codec.width = 320;
|
||||
|
||||
@ -313,17 +313,9 @@ bool VideoSendStream::ReconfigureVideoEncoder(
|
||||
}
|
||||
|
||||
if (video_codec.codecType == kVideoCodecVP8) {
|
||||
video_codec.codecSpecific.VP8.resilience = kResilientStream;
|
||||
video_codec.codecSpecific.VP8.numberOfTemporalLayers = 1;
|
||||
video_codec.codecSpecific.VP8.denoisingOn = true;
|
||||
video_codec.codecSpecific.VP8.errorConcealmentOn = false;
|
||||
video_codec.codecSpecific.VP8.automaticResizeOn = false;
|
||||
video_codec.codecSpecific.VP8.frameDroppingOn = true;
|
||||
video_codec.codecSpecific.VP8.keyFrameInterval = 3000;
|
||||
video_codec.codecSpecific.VP8 = VideoEncoder::GetDefaultVp8Settings();
|
||||
} else if (video_codec.codecType == kVideoCodecH264) {
|
||||
video_codec.codecSpecific.H264.profile = kProfileBase;
|
||||
video_codec.codecSpecific.H264.frameDroppingOn = true;
|
||||
video_codec.codecSpecific.H264.keyFrameInterval = 3000;
|
||||
video_codec.codecSpecific.H264 = VideoEncoder::GetDefaultH264Settings();
|
||||
}
|
||||
|
||||
if (video_codec.codecType == kVideoCodecVP8) {
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "webrtc/common_types.h"
|
||||
#include "webrtc/typedefs.h"
|
||||
#include "webrtc/video_frame.h"
|
||||
|
||||
@ -43,6 +44,9 @@ class VideoEncoder {
|
||||
|
||||
static VideoEncoder* Create(EncoderType codec_type);
|
||||
|
||||
static VideoCodecVP8 GetDefaultVp8Settings();
|
||||
static VideoCodecH264 GetDefaultH264Settings();
|
||||
|
||||
virtual ~VideoEncoder() {}
|
||||
|
||||
virtual int32_t InitEncode(const VideoCodec* codec_settings,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user