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

Side by Side Diff: content/renderer/media/media_stream_constraints_util.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: 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/renderer/media/media_stream_constraints_util.h"
6
7 #include "base/strings/string_number_conversions.h"
8 #include "base/strings/utf_string_conversions.h"
9 #include "third_party/WebKit/public/platform/WebMediaConstraints.h"
10 #include "third_party/WebKit/public/platform/WebString.h"
11
12 namespace content {
13
14 bool GetConstraintValue(const blink::WebMediaConstraints& constraints,
15 const std::string& name,
16 bool* value) {
17 int constraint_value = 0;
18 if (!GetConstraintValue(constraints, name, &constraint_value))
19 return false;
20
21 *value = static_cast<bool>(constraint_value);
tommi (sloooow) - chröme 2014/04/08 10:49:30 Are you sure this works? The values of these cons
no longer working on chromium 2014/04/11 08:56:30 Yes, the value is stored as blink::WebString in bl
22 return true;
23 }
24
25 bool GetConstraintValue(const blink::WebMediaConstraints& constraints,
26 const std::string& name,
27 int* value) {
28 return GetManatoryConstraintValue(constraints, name, value) ||
29 GetOptionalConstraintValue(constraints, name, value);
30 }
31
32 bool GetManatoryConstraintValue(const blink::WebMediaConstraints& constraints,
tommi (sloooow) - chröme 2014/04/08 10:49:30 GetMandatoryConstraintValue (missing 'd')
no longer working on chromium 2014/04/11 08:56:30 Done.
33 const std::string& name,
34 int* value) {
35 blink::WebString value_str;
36 if (!constraints.getMandatoryConstraintValue(base::UTF8ToUTF16(name),
37 value_str))
38 return false;
39
40 base::StringToInt(value_str.utf8(), value);
tommi (sloooow) - chröme 2014/04/08 10:49:30 return base::StringToInt(value_str.utf8(), value);
no longer working on chromium 2014/04/11 08:56:30 Done.
41 return true;
42 }
43
44 bool GetOptionalConstraintValue(const blink::WebMediaConstraints& constraints,
45 const std::string& name,
46 int* value) {
47 blink::WebString value_str;
48 if (!constraints.getOptionalConstraintValue(base::UTF8ToUTF16(name),
49 value_str))
tommi (sloooow) - chröme 2014/04/08 10:49:30 {}
no longer working on chromium 2014/04/11 08:56:30 Done.
50 return false;
51
52 base::StringToInt(value_str.utf8(), value);
tommi (sloooow) - chröme 2014/04/08 10:49:30 return base::StringToInt(value_str.utf8(), value);
no longer working on chromium 2014/04/11 08:56:30 Done.
53 return true;
54 }
55
56 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698