| Index: content/renderer/media/media_stream_video_source.cc
|
| diff --git a/content/renderer/media/media_stream_video_source.cc b/content/renderer/media/media_stream_video_source.cc
|
| index 8493fe9856c43ea3c6ccc31fadbe0e588c7c826a..1cfd80a6db22aeacfd1688adbaa1f50c6dfbac68 100644
|
| --- a/content/renderer/media/media_stream_video_source.cc
|
| +++ b/content/renderer/media/media_stream_video_source.cc
|
| @@ -104,29 +104,26 @@ void GetDesiredMinAndMaxAspectRatio(
|
| if (mandatory)
|
| return;
|
|
|
| - GetOptionalConstraintValueAsDouble(
|
| - constraints,
|
| - MediaStreamVideoSource::kMinAspectRatio,
|
| - min_aspect_ratio);
|
| - GetOptionalConstraintValueAsDouble(
|
| - constraints,
|
| - MediaStreamVideoSource::kMaxAspectRatio,
|
| - max_aspect_ratio);
|
| + GetOptionalConstraintValueAsDouble(constraints,
|
| + MediaStreamVideoSource::kMinAspectRatio,
|
| + min_aspect_ratio);
|
| + GetOptionalConstraintValueAsDouble(constraints,
|
| + MediaStreamVideoSource::kMaxAspectRatio,
|
| + max_aspect_ratio);
|
| }
|
|
|
| // Returns true if |constraint| is fulfilled. |format| can be changed by a
|
| // constraint, e.g. the frame rate can be changed by setting maxFrameRate.
|
| -bool UpdateFormatForConstraint(
|
| - const blink::WebMediaConstraint& constraint,
|
| - bool mandatory,
|
| - media::VideoCaptureFormat* format) {
|
| +bool UpdateFormatForConstraint(const blink::WebMediaConstraint& constraint,
|
| + bool mandatory,
|
| + media::VideoCaptureFormat* format) {
|
| DCHECK(format != NULL);
|
|
|
| if (!format->IsValid())
|
| return false;
|
|
|
| - std::string constraint_name = constraint.m_name.utf8();
|
| - std::string constraint_value = constraint.m_value.utf8();
|
| + const std::string constraint_name = constraint.m_name.utf8();
|
| + const std::string constraint_value = constraint.m_value.utf8();
|
|
|
| if (constraint_name.find(kGooglePrefix) == 0) {
|
| // These are actually options, not constraints, so they can be satisfied
|
| @@ -192,10 +189,9 @@ bool UpdateFormatForConstraint(
|
|
|
| // Removes media::VideoCaptureFormats from |formats| that don't meet
|
| // |constraint|.
|
| -void FilterFormatsByConstraint(
|
| - const blink::WebMediaConstraint& constraint,
|
| - bool mandatory,
|
| - media::VideoCaptureFormats* formats) {
|
| +void FilterFormatsByConstraint(const blink::WebMediaConstraint& constraint,
|
| + bool mandatory,
|
| + media::VideoCaptureFormats* formats) {
|
| DVLOG(3) << "FilterFormatsByConstraint("
|
| << "{ constraint.m_name = " << constraint.m_name.utf8()
|
| << " constraint.m_value = " << constraint.m_value.utf8()
|
| @@ -264,10 +260,10 @@ media::VideoCaptureFormats FilterFormats(
|
| constraints.getMandatoryConstraints(mandatory);
|
| constraints.getOptionalConstraints(optional);
|
| media::VideoCaptureFormats candidates = supported_formats;
|
| - for (size_t i = 0; i < mandatory.size(); ++i) {
|
| - FilterFormatsByConstraint(mandatory[i], true, &candidates);
|
| + for (const auto& constraint : mandatory) {
|
| + FilterFormatsByConstraint(constraint, true, &candidates);
|
| if (candidates.empty()) {
|
| - *unsatisfied_constraint = mandatory[i].m_name;
|
| + *unsatisfied_constraint = constraint.m_name;
|
| return candidates;
|
| }
|
| }
|
| @@ -281,9 +277,9 @@ media::VideoCaptureFormats FilterFormats(
|
| // But if a constraint produce zero candidates, the constraint is ignored and
|
| // the next constraint is tested.
|
| // http://dev.w3.org/2011/webrtc/editor/getusermedia.html#idl-def-Constraints
|
| - for (size_t i = 0; i < optional.size(); ++i) {
|
| + for (const auto& constraint : optional) {
|
| media::VideoCaptureFormats current_candidates = candidates;
|
| - FilterFormatsByConstraint(optional[i], false, ¤t_candidates);
|
| + FilterFormatsByConstraint(constraint, false, ¤t_candidates);
|
| if (!current_candidates.empty())
|
| candidates = current_candidates;
|
| }
|
| @@ -314,10 +310,9 @@ const media::VideoCaptureFormat& GetBestFormatBasedOnArea(
|
| // resolution since higher resolutions cost more in terms of complexity and
|
| // many cameras have lower frame rate and have more noise in the image at
|
| // their maximum supported resolution.
|
| -void GetBestCaptureFormat(
|
| - const media::VideoCaptureFormats& formats,
|
| - const blink::WebMediaConstraints& constraints,
|
| - media::VideoCaptureFormat* capture_format) {
|
| +void GetBestCaptureFormat(const media::VideoCaptureFormats& formats,
|
| + const blink::WebMediaConstraints& constraints,
|
| + media::VideoCaptureFormat* capture_format) {
|
| DCHECK(!formats.empty());
|
|
|
| int max_width;
|
| @@ -367,8 +362,7 @@ void MediaStreamVideoSource::AddTrack(
|
| const ConstraintsCallback& callback) {
|
| DCHECK(CalledOnValidThread());
|
| DCHECK(!constraints.isNull());
|
| - DCHECK(std::find(tracks_.begin(), tracks_.end(),
|
| - track) == tracks_.end());
|
| + DCHECK(std::find(tracks_.begin(), tracks_.end(), track) == tracks_.end());
|
| tracks_.push_back(track);
|
|
|
| requested_constraints_.push_back(
|
|
|