Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(475)

Unified Diff: content/renderer/media/rtc_video_encoder_factory.cc

Issue 1019033003: RtcVideo{Encoder,Decoder}{Factory,} minor cleanup: consts, range based loops, comments. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: emircan@ and posciak@ comments Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/media/rtc_video_encoder_factory.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..d2c5a02a5c2243744d1128824e759972b6a44068 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 =
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_);
}
- if (!found)
- return NULL;
- return new RTCVideoEncoder(type, gpu_factories_);
+ return nullptr;
}
const std::vector<cricket::WebRtcVideoEncoderFactory::VideoCodec>&
« no previous file with comments | « content/renderer/media/rtc_video_encoder_factory.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698