Chromium Code Reviews| 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 60917261b78a0ce4839e63fdd48a8cc94e8ecc13..7428f22f8bfb6770d33e7b1464b94cd5d9c7b574 100644 |
| --- a/content/renderer/media/media_stream_video_source.cc |
| +++ b/content/renderer/media/media_stream_video_source.cc |
| @@ -10,6 +10,7 @@ |
| #include "base/logging.h" |
| #include "base/strings/string_number_conversions.h" |
| +#include "content/renderer/media/media_stream_constraints_util.h" |
| #include "content/renderer/media/media_stream_dependency_factory.h" |
| #include "content/renderer/media/media_stream_video_track.h" |
| #include "content/renderer/media/webrtc/webrtc_video_capturer_adapter.h" |
| @@ -203,33 +204,12 @@ media::VideoCaptureFormats FilterFormats( |
| return candidates; |
| } |
| -bool GetConstraintValue(const blink::WebMediaConstraints& constraints, |
| - bool mandatory, const blink::WebString& name, |
| - int* value) { |
| - blink::WebString value_str; |
| - bool ret = mandatory ? |
| - constraints.getMandatoryConstraintValue(name, value_str) : |
| - constraints.getOptionalConstraintValue(name, value_str); |
| - if (ret) |
| - base::StringToInt(value_str.utf8(), value); |
| - return ret; |
| -} |
| - |
| // Retrieve the desired max width and height from |constraints|. |
| void GetDesiredMaxWidthAndHeight(const blink::WebMediaConstraints& constraints, |
| int* desired_width, int* desired_height) { |
| - bool mandatory = GetConstraintValue(constraints, true, |
| - MediaStreamVideoSource::kMaxWidth, |
| - desired_width); |
| - mandatory |= GetConstraintValue(constraints, true, |
| - MediaStreamVideoSource::kMaxHeight, |
| - desired_height); |
| - if (mandatory) |
| - return; |
| - |
| - GetConstraintValue(constraints, false, MediaStreamVideoSource::kMaxWidth, |
| + GetConstraintValue(constraints, MediaStreamVideoSource::kMaxWidth, |
| desired_width); |
| - GetConstraintValue(constraints, false, MediaStreamVideoSource::kMaxHeight, |
| + GetConstraintValue(constraints, MediaStreamVideoSource::kMaxHeight, |
| desired_height); |
| } |
| @@ -331,10 +311,11 @@ void MediaStreamVideoSource::AddTrack( |
| // Tab capture and Screen capture needs the maximum requested height |
| // and width to decide on the resolution. |
| int max_requested_width = 0; |
| - GetConstraintValue(constraints, true, kMaxWidth, &max_requested_width); |
| + GetManatoryConstraintValue(constraints, kMaxWidth, &max_requested_width); |
|
tommi (sloooow) - chröme
2014/04/08 10:49:30
typo (here and throughout)
no longer working on chromium
2014/04/11 08:56:30
Done.
|
| int max_requested_height = 0; |
| - GetConstraintValue(constraints, true, kMaxHeight, &max_requested_height); |
| + GetManatoryConstraintValue(constraints, kMaxHeight, |
| + &max_requested_height); |
| state_ = RETRIEVING_CAPABILITIES; |
| GetCurrentSupportedFormats(max_requested_width, |