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

Side by Side Diff: content/renderer/media/rtc_media_constraints.cc

Issue 11339014: Move content\browser\renderer_host\media to content namespace. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 1 month 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 | Annotate | Revision Log
OLDNEW
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 7
8 #include "content/common/media/media_stream_options.h" 8 #include "content/common/media/media_stream_options.h"
9 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaConstraints .h" 9 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaConstraints .h"
10 #include "third_party/WebKit/Source/Platform/chromium/public/WebCString.h" 10 #include "third_party/WebKit/Source/Platform/chromium/public/WebCString.h"
11 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" 11 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h"
12 12
13 namespace content {
13 namespace { 14 namespace {
14 15
15 void GetNativeMediaConstraints( 16 void GetNativeMediaConstraints(
16 const WebKit::WebVector<WebKit::WebMediaConstraint>& constraints, 17 const WebKit::WebVector<WebKit::WebMediaConstraint>& constraints,
17 webrtc::MediaConstraintsInterface::Constraints* native_constraints) { 18 webrtc::MediaConstraintsInterface::Constraints* native_constraints) {
18 DCHECK(native_constraints); 19 DCHECK(native_constraints);
19 for (size_t i = 0; i < constraints.size(); ++i) { 20 for (size_t i = 0; i < constraints.size(); ++i) {
20 webrtc::MediaConstraintsInterface::Constraint new_constraint; 21 webrtc::MediaConstraintsInterface::Constraint new_constraint;
21 new_constraint.key = constraints[i].m_name.utf8(); 22 new_constraint.key = constraints[i].m_name.utf8();
22 new_constraint.value = constraints[i].m_value.utf8(); 23 new_constraint.value = constraints[i].m_value.utf8();
23 24
24 // Ignore Chrome specific Tab capture constraints. 25 // Ignore Chrome specific Tab capture constraints.
25 if (new_constraint.key == media_stream::kMediaStreamSource || 26 if (new_constraint.key == kMediaStreamSource ||
26 new_constraint.key == media_stream::kMediaStreamSourceId) 27 new_constraint.key == kMediaStreamSourceId)
27 continue; 28 continue;
28 DVLOG(3) << "MediaStreamConstraints:" << new_constraint.key 29 DVLOG(3) << "MediaStreamConstraints:" << new_constraint.key
29 << " : " << new_constraint.value; 30 << " : " << new_constraint.value;
30 native_constraints->push_back(new_constraint); 31 native_constraints->push_back(new_constraint);
31 } 32 }
32 } 33 }
33 34
34 } // namespace 35 } // namespace
35 36
36 namespace content {
37
38 RTCMediaConstraints::RTCMediaConstraints( 37 RTCMediaConstraints::RTCMediaConstraints(
39 const WebKit::WebMediaConstraints& constraints) { 38 const WebKit::WebMediaConstraints& constraints) {
40 if (constraints.isNull()) 39 if (constraints.isNull())
41 return; // Will happen in unit tests. 40 return; // Will happen in unit tests.
42 WebKit::WebVector<WebKit::WebMediaConstraint> mandatory; 41 WebKit::WebVector<WebKit::WebMediaConstraint> mandatory;
43 constraints.getMandatoryConstraints(mandatory); 42 constraints.getMandatoryConstraints(mandatory);
44 GetNativeMediaConstraints(mandatory, &mandatory_); 43 GetNativeMediaConstraints(mandatory, &mandatory_);
45 WebKit::WebVector<WebKit::WebMediaConstraint> optional; 44 WebKit::WebVector<WebKit::WebMediaConstraint> optional;
46 constraints.getOptionalConstraints(optional); 45 constraints.getOptionalConstraints(optional);
47 GetNativeMediaConstraints(optional, &optional_); 46 GetNativeMediaConstraints(optional, &optional_);
48 } 47 }
49 48
50 RTCMediaConstraints::~RTCMediaConstraints() {} 49 RTCMediaConstraints::~RTCMediaConstraints() {}
51 50
52 const webrtc::MediaConstraintsInterface::Constraints& 51 const webrtc::MediaConstraintsInterface::Constraints&
53 RTCMediaConstraints::GetMandatory() const { 52 RTCMediaConstraints::GetMandatory() const {
54 return mandatory_; 53 return mandatory_;
55 } 54 }
56 55
57 const webrtc::MediaConstraintsInterface::Constraints& 56 const webrtc::MediaConstraintsInterface::Constraints&
58 RTCMediaConstraints::GetOptional() const { 57 RTCMediaConstraints::GetOptional() const {
59 return optional_; 58 return optional_;
60 } 59 }
61 60
62 } // namespace content 61 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698