Disable temporal layers when building with Chromium.

BUG=
TEST=

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1099 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
stefan@webrtc.org
2011-12-05 08:42:52 +00:00
parent af71f0e5d9
commit 0ae71b9ccb
3 changed files with 24 additions and 3 deletions

View File

@@ -29,8 +29,9 @@ struct vpx_codec_cx_pkt;
namespace webrtc namespace webrtc
{ {
#if WEBRTC_LIBVPX_VERSION >= 971
class TemporalLayers; class TemporalLayers;
#endif
class ReferencePictureSelection; class ReferencePictureSelection;
/******************************/ /******************************/
@@ -175,7 +176,9 @@ private:
WebRtc_UWord32 _rcMaxIntraTarget; WebRtc_UWord32 _rcMaxIntraTarget;
int _tokenPartitions; int _tokenPartitions;
ReferencePictureSelection* _rps; ReferencePictureSelection* _rps;
#if WEBRTC_LIBVPX_VERSION >= 971
TemporalLayers* _temporalLayers; TemporalLayers* _temporalLayers;
#endif
vpx_codec_ctx_t* _encoder; vpx_codec_ctx_t* _encoder;
vpx_codec_enc_cfg_t* _cfg; vpx_codec_enc_cfg_t* _cfg;

View File

@@ -49,7 +49,9 @@ VP8Encoder::VP8Encoder():
_rcMaxIntraTarget(0), _rcMaxIntraTarget(0),
_tokenPartitions(VP8_ONE_TOKENPARTITION), _tokenPartitions(VP8_ONE_TOKENPARTITION),
_rps(new ReferencePictureSelection), _rps(new ReferencePictureSelection),
#if WEBRTC_LIBVPX_VERSION >= 971
_temporalLayers(NULL), _temporalLayers(NULL),
#endif
_encoder(NULL), _encoder(NULL),
_cfg(NULL), _cfg(NULL),
_raw(NULL) _raw(NULL)
@@ -113,11 +115,13 @@ VP8Encoder::Release()
delete _raw; delete _raw;
_raw = NULL; _raw = NULL;
} }
#if WEBRTC_LIBVPX_VERSION >= 971
if (_temporalLayers != NULL) if (_temporalLayers != NULL)
{ {
delete _temporalLayers; delete _temporalLayers;
_temporalLayers = NULL; _temporalLayers = NULL;
} }
#endif
_inited = false; _inited = false;
return WEBRTC_VIDEO_CODEC_OK; return WEBRTC_VIDEO_CODEC_OK;
@@ -172,10 +176,12 @@ VP8Encoder::SetRates(WebRtc_UWord32 newBitRateKbit, WebRtc_UWord32 newFrameRate)
} }
_cfg->rc_target_bitrate = newBitRateKbit; // in kbit/s _cfg->rc_target_bitrate = newBitRateKbit; // in kbit/s
#if WEBRTC_LIBVPX_VERSION >= 971
if (_temporalLayers) if (_temporalLayers)
{ {
_temporalLayers->ConfigureBitrates(newBitRateKbit, _cfg); _temporalLayers->ConfigureBitrates(newBitRateKbit, _cfg);
} }
#endif
_maxFrameRate = newFrameRate; _maxFrameRate = newFrameRate;
// update encoder context // update encoder context
@@ -238,12 +244,14 @@ VP8Encoder::InitEncode(const VideoCodec* inst,
_width = inst->width; _width = inst->width;
_height = inst->height; _height = inst->height;
#if WEBRTC_LIBVPX_VERSION >= 971
if (inst->codecSpecific.VP8.numberOfTemporalLayers > 1) if (inst->codecSpecific.VP8.numberOfTemporalLayers > 1)
{ {
assert(_temporalLayers == NULL); assert(_temporalLayers == NULL);
_temporalLayers = _temporalLayers =
new TemporalLayers(inst->codecSpecific.VP8.numberOfTemporalLayers); new TemporalLayers(inst->codecSpecific.VP8.numberOfTemporalLayers);
} }
#endif
// random start 16 bits is enough. // random start 16 bits is enough.
_pictureID = ((WebRtc_UWord16)rand()) & 0x7FFF; _pictureID = ((WebRtc_UWord16)rand()) & 0x7FFF;
@@ -274,10 +282,12 @@ VP8Encoder::InitEncode(const VideoCodec* inst,
{ {
_cfg->rc_target_bitrate = inst->startBitrate; // in kbit/s _cfg->rc_target_bitrate = inst->startBitrate; // in kbit/s
} }
#if WEBRTC_LIBVPX_VERSION >= 971
if (_temporalLayers) if (_temporalLayers)
{ {
_temporalLayers->ConfigureBitrates(inst->startBitrate, _cfg); _temporalLayers->ConfigureBitrates(inst->startBitrate, _cfg);
} }
#endif
// setting the time base of the codec // setting the time base of the codec
_cfg->g_timebase.num = 1; _cfg->g_timebase.num = 1;
_cfg->g_timebase.den = 90000; _cfg->g_timebase.den = 90000;
@@ -436,9 +446,11 @@ VP8Encoder::Encode(const RawImage& inputImage,
_raw->planes[PLANE_V] = &inputImage._buffer[_height * _width * 5 >> 2]; _raw->planes[PLANE_V] = &inputImage._buffer[_height * _width * 5 >> 2];
int flags = 0; int flags = 0;
#if WEBRTC_LIBVPX_VERSION >= 971
if (_temporalLayers) { if (_temporalLayers) {
flags |= _temporalLayers->EncodeFlags(); flags |= _temporalLayers->EncodeFlags();
} }
#endif
bool sendKeyFrame = frameTypes && (*frameTypes == kKeyFrame); bool sendKeyFrame = frameTypes && (*frameTypes == kKeyFrame);
if (sendKeyFrame) if (sendKeyFrame)
{ {
@@ -490,13 +502,17 @@ void VP8Encoder::PopulateCodecSpecific(CodecSpecificInfo* codec_specific,
vp8Info->simulcastIdx = _simulcastIdx; vp8Info->simulcastIdx = _simulcastIdx;
vp8Info->keyIdx = kNoKeyIdx; // TODO(hlundin) populate this vp8Info->keyIdx = kNoKeyIdx; // TODO(hlundin) populate this
vp8Info->nonReference = (pkt.data.frame.flags & VPX_FRAME_IS_DROPPABLE); vp8Info->nonReference = (pkt.data.frame.flags & VPX_FRAME_IS_DROPPABLE);
#if WEBRTC_LIBVPX_VERSION >= 971
if (_temporalLayers) { if (_temporalLayers) {
_temporalLayers->PopulateCodecSpecific( _temporalLayers->PopulateCodecSpecific(
(pkt.data.frame.flags & VPX_FRAME_IS_KEY) ? true : false, vp8Info); (pkt.data.frame.flags & VPX_FRAME_IS_KEY) ? true : false, vp8Info);
} else { } else {
#endif
vp8Info->temporalIdx = kNoTemporalIdx; vp8Info->temporalIdx = kNoTemporalIdx;
vp8Info->tl0PicIdx = kNoTl0PicIdx; vp8Info->tl0PicIdx = kNoTl0PicIdx;
#if WEBRTC_LIBVPX_VERSION >= 971
} }
#endif
_pictureID = (_pictureID + 1) % 0x7FFF; // prepare next _pictureID = (_pictureID + 1) % 0x7FFF; // prepare next
} }

View File

@@ -36,6 +36,10 @@
'defines': [ 'defines': [
'WEBRTC_LIBVPX_VERSION=971' # Cayuga 'WEBRTC_LIBVPX_VERSION=971' # Cayuga
], ],
'sources': [
'temporal_layers.h',
'temporal_layers.cc',
],
}], }],
], ],
'direct_dependent_settings': { 'direct_dependent_settings': {
@@ -50,8 +54,6 @@
'reference_picture_selection.cc', 'reference_picture_selection.cc',
'../interface/vp8.h', '../interface/vp8.h',
'../interface/vp8_simulcast.h', '../interface/vp8_simulcast.h',
'temporal_layers.h',
'temporal_layers.cc',
'vp8.cc', 'vp8.cc',
'vp8_simulcast.cc', 'vp8_simulcast.cc',
], ],