OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 #include "content/renderer/media/rtc_media_constraints.h" | 4 #include "content/renderer/media/rtc_media_constraints.h" |
5 | 5 |
6 #include "base/logging.h" | 6 #include "base/logging.h" |
7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
8 #include "content/common/media/media_stream_options.h" | 8 #include "content/common/media/media_stream_options.h" |
9 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" | 9 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" |
10 #include "third_party/WebKit/public/platform/WebCString.h" | 10 #include "third_party/WebKit/public/platform/WebCString.h" |
11 #include "third_party/WebKit/public/platform/WebString.h" | 11 #include "third_party/WebKit/public/platform/WebString.h" |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 namespace { | 14 namespace { |
15 | 15 |
16 void GetNativeMediaConstraints( | 16 void GetNativeMediaConstraints( |
17 const WebKit::WebVector<WebKit::WebMediaConstraint>& constraints, | 17 const WebKit::WebVector<WebKit::WebMediaConstraint>& constraints, |
18 webrtc::MediaConstraintsInterface::Constraints* native_constraints) { | 18 webrtc::MediaConstraintsInterface::Constraints* native_constraints) { |
19 DCHECK(native_constraints); | 19 DCHECK(native_constraints); |
20 for (size_t i = 0; i < constraints.size(); ++i) { | 20 for (size_t i = 0; i < constraints.size(); ++i) { |
21 webrtc::MediaConstraintsInterface::Constraint new_constraint; | 21 webrtc::MediaConstraintsInterface::Constraint new_constraint; |
22 new_constraint.key = constraints[i].m_name.utf8(); | 22 new_constraint.key = constraints[i].m_name.utf8(); |
23 new_constraint.value = constraints[i].m_value.utf8(); | 23 new_constraint.value = constraints[i].m_value.utf8(); |
24 | 24 |
25 // Ignore Chrome specific Tab capture constraints. | 25 // Ignore Chrome specific Tab capture constraints. |
26 if (new_constraint.key == kMediaStreamSource || | 26 if (new_constraint.key == kMediaStreamSource || |
27 new_constraint.key == kMediaStreamSourceId) | 27 new_constraint.key == kMediaStreamSourceId) |
28 continue; | 28 continue; |
29 | 29 |
30 // Ignore internal constraints set by JS. | |
Ami GONE FROM CHROMIUM
2013/10/23 21:33:11
Just to make sure: you're ok with internal constra
perkj_chrome
2013/11/01 09:12:54
All internal constraints are removed as far as I k
| |
31 // TODO(jiayl): replace the hard coded string with | |
32 // webrtc::MediaConstraintsInterface::kInternalConstraintPrefix when | |
33 // the Libjingle change is rolled. | |
34 if (StartsWithASCII(new_constraint.key, "internal", true)) | |
35 continue; | |
36 | |
37 DVLOG(3) << "MediaStreamConstraints:" << new_constraint.key | 30 DVLOG(3) << "MediaStreamConstraints:" << new_constraint.key |
38 << " : " << new_constraint.value; | 31 << " : " << new_constraint.value; |
39 native_constraints->push_back(new_constraint); | 32 native_constraints->push_back(new_constraint); |
40 } | 33 } |
41 } | 34 } |
42 | 35 |
43 } // namespace | 36 } // namespace |
44 | 37 |
45 RTCMediaConstraints::RTCMediaConstraints() {} | 38 RTCMediaConstraints::RTCMediaConstraints() {} |
46 | 39 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
84 iter->value = value; | 77 iter->value = value; |
85 return override_if_exists; | 78 return override_if_exists; |
86 } | 79 } |
87 } | 80 } |
88 // The key wasn't found, add it. | 81 // The key wasn't found, add it. |
89 mandatory_.push_back(Constraint(key, value)); | 82 mandatory_.push_back(Constraint(key, value)); |
90 return true; | 83 return true; |
91 } | 84 } |
92 | 85 |
93 } // namespace content | 86 } // namespace content |
OLD | NEW |