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 <string> | 6 #include <string> |
7 | 7 |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "content/common/media/media_stream_options.h" | 10 #include "content/common/media/media_stream_options.h" |
11 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" | 11 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" |
12 #include "third_party/WebKit/public/platform/WebCString.h" | 12 #include "third_party/WebKit/public/platform/WebCString.h" |
13 #include "third_party/WebKit/public/platform/WebString.h" | 13 #include "third_party/WebKit/public/platform/WebString.h" |
14 | 14 |
15 namespace content { | 15 namespace content { |
16 namespace { | 16 namespace { |
17 | 17 |
18 void GetNativeMediaConstraints( | 18 void GetNativeMediaConstraints( |
19 const WebKit::WebVector<WebKit::WebMediaConstraint>& constraints, | 19 const blink::WebVector<blink::WebMediaConstraint>& constraints, |
20 webrtc::MediaConstraintsInterface::Constraints* native_constraints) { | 20 webrtc::MediaConstraintsInterface::Constraints* native_constraints) { |
21 DCHECK(native_constraints); | 21 DCHECK(native_constraints); |
22 for (size_t i = 0; i < constraints.size(); ++i) { | 22 for (size_t i = 0; i < constraints.size(); ++i) { |
23 webrtc::MediaConstraintsInterface::Constraint new_constraint; | 23 webrtc::MediaConstraintsInterface::Constraint new_constraint; |
24 new_constraint.key = constraints[i].m_name.utf8(); | 24 new_constraint.key = constraints[i].m_name.utf8(); |
25 new_constraint.value = constraints[i].m_value.utf8(); | 25 new_constraint.value = constraints[i].m_value.utf8(); |
26 | 26 |
27 // Ignore Chrome specific Tab capture constraints. | 27 // Ignore Chrome specific Tab capture constraints. |
28 if (new_constraint.key == kMediaStreamSource || | 28 if (new_constraint.key == kMediaStreamSource || |
29 new_constraint.key == kMediaStreamSourceId) | 29 new_constraint.key == kMediaStreamSourceId) |
(...skipping 11 matching lines...) Expand all Loading... |
41 << " : " << new_constraint.value; | 41 << " : " << new_constraint.value; |
42 native_constraints->push_back(new_constraint); | 42 native_constraints->push_back(new_constraint); |
43 } | 43 } |
44 } | 44 } |
45 | 45 |
46 } // namespace | 46 } // namespace |
47 | 47 |
48 RTCMediaConstraints::RTCMediaConstraints() {} | 48 RTCMediaConstraints::RTCMediaConstraints() {} |
49 | 49 |
50 RTCMediaConstraints::RTCMediaConstraints( | 50 RTCMediaConstraints::RTCMediaConstraints( |
51 const WebKit::WebMediaConstraints& constraints) { | 51 const blink::WebMediaConstraints& constraints) { |
52 if (constraints.isNull()) | 52 if (constraints.isNull()) |
53 return; // Will happen in unit tests. | 53 return; // Will happen in unit tests. |
54 WebKit::WebVector<WebKit::WebMediaConstraint> mandatory; | 54 blink::WebVector<blink::WebMediaConstraint> mandatory; |
55 constraints.getMandatoryConstraints(mandatory); | 55 constraints.getMandatoryConstraints(mandatory); |
56 GetNativeMediaConstraints(mandatory, &mandatory_); | 56 GetNativeMediaConstraints(mandatory, &mandatory_); |
57 WebKit::WebVector<WebKit::WebMediaConstraint> optional; | 57 blink::WebVector<blink::WebMediaConstraint> optional; |
58 constraints.getOptionalConstraints(optional); | 58 constraints.getOptionalConstraints(optional); |
59 GetNativeMediaConstraints(optional, &optional_); | 59 GetNativeMediaConstraints(optional, &optional_); |
60 } | 60 } |
61 | 61 |
62 RTCMediaConstraints::~RTCMediaConstraints() {} | 62 RTCMediaConstraints::~RTCMediaConstraints() {} |
63 | 63 |
64 const webrtc::MediaConstraintsInterface::Constraints& | 64 const webrtc::MediaConstraintsInterface::Constraints& |
65 RTCMediaConstraints::GetMandatory() const { | 65 RTCMediaConstraints::GetMandatory() const { |
66 return mandatory_; | 66 return mandatory_; |
67 } | 67 } |
(...skipping 19 matching lines...) Expand all Loading... |
87 iter->value = value; | 87 iter->value = value; |
88 return override_if_exists; | 88 return override_if_exists; |
89 } | 89 } |
90 } | 90 } |
91 // The key wasn't found, add it. | 91 // The key wasn't found, add it. |
92 mandatory_.push_back(Constraint(key, value)); | 92 mandatory_.push_back(Constraint(key, value)); |
93 return true; | 93 return true; |
94 } | 94 } |
95 | 95 |
96 } // namespace content | 96 } // namespace content |
OLD | NEW |