Revert 4008 "Avoid resetting video encoder for similar configs."

> Avoid resetting video encoder for similar configs.
> 
> BUG=1681
> R=holmer@google.com, mflodman@webrtc.org, stefan@webrtc.org
> 
> Review URL: https://webrtc-codereview.appspot.com/1442006

TBR=pbos@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@4010 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
phoglund@webrtc.org 2013-05-13 15:39:26 +00:00
parent c53480fbcf
commit 43bf6ce322
2 changed files with 7 additions and 69 deletions
webrtc/modules/video_coding/main/source

View File

@ -318,63 +318,6 @@ VideoCodingModuleImpl::InitializeSender()
return VCM_OK;
}
bool VideoCodingModuleImpl::RequiresEncoderReset(const VideoCodec& send_codec) {
VideoCodec current_codec;
if (!_codecDataBase.SendCodec(&current_codec)) {
return true;
}
if (current_codec.codecType != send_codec.codecType ||
strcmp(current_codec.plName, send_codec.plName) != 0 ||
current_codec.plType != send_codec.plType ||
current_codec.width != send_codec.width ||
current_codec.height != send_codec.height ||
current_codec.qpMax != send_codec.qpMax ||
current_codec.numberOfSimulcastStreams !=
send_codec.numberOfSimulcastStreams ||
current_codec.mode != send_codec.mode ||
current_codec.extra_options != send_codec.extra_options) {
return true;
}
switch (current_codec.codecType) {
case kVideoCodecVP8:
if (memcmp(&current_codec.codecSpecific.VP8,
&send_codec.codecSpecific.VP8,
sizeof(current_codec.codecSpecific.VP8)) != 0) {
return true;
}
break;
case kVideoCodecGeneric:
if (memcmp(&current_codec.codecSpecific.Generic,
&send_codec.codecSpecific.Generic,
sizeof(current_codec.codecSpecific.Generic)) != 0) {
return true;
}
break;
// Known codecs without payload-specifics
case kVideoCodecI420:
case kVideoCodecRED:
case kVideoCodecULPFEC:
break;
// Unknown codec type, reset just to be sure.
case kVideoCodecUnknown:
return true;
}
if (current_codec.numberOfSimulcastStreams > 0) {
for (unsigned char i = 0; i < current_codec.numberOfSimulcastStreams; ++i) {
if (memcmp(&current_codec.simulcastStream[i],
&send_codec.simulcastStream[i],
sizeof(current_codec.simulcastStream[i])) != 0) {
return true;
}
}
}
return false;
}
// Register the send codec to be used.
int32_t
VideoCodingModuleImpl::RegisterSendCodec(const VideoCodec* sendCodec,
@ -386,18 +329,13 @@ VideoCodingModuleImpl::RegisterSendCodec(const VideoCodec* sendCodec,
{
return VCM_PARAMETER_ERROR;
}
bool requires_reconfigure = RequiresEncoderReset(*sendCodec);
if (!_codecDataBase.RegisterSendCodec(sendCodec, numberOfCores,
maxPayloadSize)) {
bool ret = _codecDataBase.RegisterSendCodec(sendCodec, numberOfCores,
maxPayloadSize);
if (!ret)
{
return -1;
}
if (!requires_reconfigure) {
return VCM_OK;
}
_encoder = _codecDataBase.GetEncoder(sendCodec, &_encodedFrameCallback);
if (_encoder == NULL)
{

View File

@ -279,9 +279,9 @@ public:
protected:
int32_t Decode(const webrtc::VCMEncodedFrame& frame);
bool RequiresEncoderReset(const VideoCodec& send_codec);
int32_t RequestKeyFrame();
int32_t RequestSliceLossIndication(const uint64_t pictureID) const;
int32_t RequestSliceLossIndication(
const uint64_t pictureID) const;
int32_t NackList(uint16_t* nackList, uint16_t& size);
private: