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

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

Issue 227743004: Added a kEchoCancellation constraint to turn off the audio processing. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: moved some of the constraints code to MediaAudioConstraints class, and hope it makes the code more … Created 6 years, 8 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
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 d9827ffa23b03839afb4a79ffe648e9edd7373cf..f19d85fe26396ed34db7ac7825360ddbd3c015f6 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,
perkj_chrome 2014/04/14 12:15:19 this is an unwanted behaviour change. Ie- if wit
no longer working on chromium 2014/04/14 14:40:50 I changed it back and added a comment to explain.
desired_height);
}
@@ -328,10 +308,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);
+ GetMandatoryConstraintValue(constraints, kMaxWidth, &max_requested_width);
int max_requested_height = 0;
- GetConstraintValue(constraints, true, kMaxHeight, &max_requested_height);
+ GetMandatoryConstraintValue(constraints, kMaxHeight,
+ &max_requested_height);
state_ = RETRIEVING_CAPABILITIES;
GetCurrentSupportedFormats(max_requested_width,

Powered by Google App Engine
This is Rietveld 408576698