Chromium Code Reviews| Index: content/renderer/media/rtc_video_encoder_factory.cc |
| diff --git a/content/renderer/media/rtc_video_encoder_factory.cc b/content/renderer/media/rtc_video_encoder_factory.cc |
| index 147ce368b2d1e771d26cb092d44b42eaaa93f9f6..b1793240af052b787ce6e9f6541d8fd9d3b4b12e 100644 |
| --- a/content/renderer/media/rtc_video_encoder_factory.cc |
| +++ b/content/renderer/media/rtc_video_encoder_factory.cc |
| @@ -20,9 +20,9 @@ namespace { |
| void VEAToWebRTCCodecs( |
| std::vector<cricket::WebRtcVideoEncoderFactory::VideoCodec>* codecs, |
| const media::VideoEncodeAccelerator::SupportedProfile& profile) { |
| - int width = profile.max_resolution.width(); |
| - int height = profile.max_resolution.height(); |
| - int fps = profile.max_framerate_numerator; |
| + const int width = profile.max_resolution.width(); |
| + const int height = profile.max_resolution.height(); |
| + const int fps = profile.max_framerate_numerator; |
| DCHECK_EQ(profile.max_framerate_denominator, 1U); |
| const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
| @@ -44,26 +44,21 @@ void VEAToWebRTCCodecs( |
| RTCVideoEncoderFactory::RTCVideoEncoderFactory( |
| const scoped_refptr<media::GpuVideoAcceleratorFactories>& gpu_factories) |
| : gpu_factories_(gpu_factories) { |
| - std::vector<media::VideoEncodeAccelerator::SupportedProfile> profiles = |
| + const std::vector<media::VideoEncodeAccelerator::SupportedProfile> profiles = |
|
emircan
2015/03/19 01:16:55
Consider assigning by reference to the rvalue to s
mcasas
2015/03/19 02:54:26
Done.
|
| gpu_factories_->GetVideoEncodeAcceleratorSupportedProfiles(); |
| - for (size_t i = 0; i < profiles.size(); ++i) |
| - VEAToWebRTCCodecs(&codecs_, profiles[i]); |
| + for (const auto& profile : profiles) |
| + VEAToWebRTCCodecs(&codecs_, profile); |
| } |
| RTCVideoEncoderFactory::~RTCVideoEncoderFactory() {} |
| webrtc::VideoEncoder* RTCVideoEncoderFactory::CreateVideoEncoder( |
| webrtc::VideoCodecType type) { |
| - bool found = false; |
| - for (size_t i = 0; i < codecs_.size(); ++i) { |
| - if (codecs_[i].type == type) { |
| - found = true; |
| - break; |
| - } |
| + for (const auto& codec : codecs_) { |
| + if (codec.type == type) |
| + return new RTCVideoEncoder(type, gpu_factories_); |
|
emircan
2015/03/19 01:16:56
Consider using std::find_if for clarity.
mcasas
2015/03/19 02:54:25
Hmm in this case and since VideoCodec does not hav
|
| } |
| - if (!found) |
| - return NULL; |
| - return new RTCVideoEncoder(type, gpu_factories_); |
| + return NULL; |
|
Pawel Osciak
2015/03/19 01:26:33
s/NULL/nullptr/
mcasas
2015/03/19 02:54:25
Done.
|
| } |
| const std::vector<cricket::WebRtcVideoEncoderFactory::VideoCodec>& |