Refactor SetDefaultEncoderConfig to work on existing codecs.
Addresses issue where SetDefaultEncoderConfig modifies the codec list rather than just the targeted codec. This was previously done just to pass more unit tests rather than be done properly. This incidentally addresses a TODO causing this to work with external codecs as well. R=stefan@webrtc.org BUG=1788 Review URL: https://webrtc-codereview.appspot.com/32009004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7667 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
a5d29fcd59
commit
957e802fe0
@ -359,9 +359,17 @@ int WebRtcVideoEngine2::GetCapabilities() { return VIDEO_RECV | VIDEO_SEND; }
|
||||
bool WebRtcVideoEngine2::SetDefaultEncoderConfig(
|
||||
const VideoEncoderConfig& config) {
|
||||
const VideoCodec& codec = config.max_codec;
|
||||
// TODO(pbos): Make use of external encoder factory.
|
||||
if (!CodecIsInternallySupported(codec.name)) {
|
||||
LOG(LS_ERROR) << "SetDefaultEncoderConfig, codec not supported:"
|
||||
bool supports_codec = false;
|
||||
for (size_t i = 0; i < video_codecs_.size(); ++i) {
|
||||
if (CodecNameMatches(video_codecs_[i].name, codec.name)) {
|
||||
video_codecs_[i] = codec;
|
||||
supports_codec = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!supports_codec) {
|
||||
LOG(LS_ERROR) << "SetDefaultEncoderConfig, codec not supported: "
|
||||
<< codec.ToString();
|
||||
return false;
|
||||
}
|
||||
@ -371,8 +379,6 @@ bool WebRtcVideoEngine2::SetDefaultEncoderConfig(
|
||||
codec.height,
|
||||
VideoFormat::FpsToInterval(codec.framerate),
|
||||
FOURCC_ANY);
|
||||
video_codecs_.clear();
|
||||
video_codecs_.push_back(codec);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user