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

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

Issue 212973002: Refactor VideoDestinationHandler to implement MediaStreamVideoSource. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased 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 | 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 <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 "content/renderer/media/media_stream_video_source.h"
11 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" 12 #include "third_party/WebKit/public/platform/WebMediaConstraints.h"
12 #include "third_party/WebKit/public/platform/WebCString.h" 13 #include "third_party/WebKit/public/platform/WebCString.h"
13 #include "third_party/WebKit/public/platform/WebString.h" 14 #include "third_party/WebKit/public/platform/WebString.h"
14 15
15 namespace content { 16 namespace content {
16 namespace { 17 namespace {
17 18
18 void GetNativeMediaConstraints( 19 void GetNativeMediaConstraints(
19 const blink::WebVector<blink::WebMediaConstraint>& constraints, 20 const blink::WebVector<blink::WebMediaConstraint>& constraints,
20 webrtc::MediaConstraintsInterface::Constraints* native_constraints) { 21 webrtc::MediaConstraintsInterface::Constraints* native_constraints) {
21 DCHECK(native_constraints); 22 DCHECK(native_constraints);
22 for (size_t i = 0; i < constraints.size(); ++i) { 23 for (size_t i = 0; i < constraints.size(); ++i) {
23 webrtc::MediaConstraintsInterface::Constraint new_constraint; 24 webrtc::MediaConstraintsInterface::Constraint new_constraint;
24 new_constraint.key = constraints[i].m_name.utf8(); 25 new_constraint.key = constraints[i].m_name.utf8();
25 new_constraint.value = constraints[i].m_value.utf8(); 26 new_constraint.value = constraints[i].m_value.utf8();
26 27
27 // Ignore Chrome specific Tab capture constraints. 28 // Ignore Chrome specific Tab capture constraints.
28 if (new_constraint.key == kMediaStreamSource || 29 if (new_constraint.key == kMediaStreamSource ||
29 new_constraint.key == kMediaStreamSourceId) 30 new_constraint.key == kMediaStreamSourceId)
30 continue; 31 continue;
31 32
32 // Ignore sourceId constraint since that has nothing to do with webrtc. 33 // Ignore sourceId constraint since that has nothing to do with webrtc.
33 if (new_constraint.key == kMediaStreamSourceInfoId) 34 if (new_constraint.key == kMediaStreamSourceInfoId)
34 continue; 35 continue;
35 36
37 // Ignore constraints that are handled by Chrome in MediaStreamVideoSource.
38 if (MediaStreamVideoSource::IsConstraintSupported(new_constraint.key))
39 continue;
40
36 DVLOG(3) << "MediaStreamConstraints:" << new_constraint.key 41 DVLOG(3) << "MediaStreamConstraints:" << new_constraint.key
37 << " : " << new_constraint.value; 42 << " : " << new_constraint.value;
38 native_constraints->push_back(new_constraint); 43 native_constraints->push_back(new_constraint);
39 } 44 }
40 } 45 }
41 46
42 } // namespace 47 } // namespace
43 48
44 RTCMediaConstraints::RTCMediaConstraints() {} 49 RTCMediaConstraints::RTCMediaConstraints() {}
45 50
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 iter->value = value; 96 iter->value = value;
92 return override_if_exists; 97 return override_if_exists;
93 } 98 }
94 } 99 }
95 // The key wasn't found, add it. 100 // The key wasn't found, add it.
96 constraints->push_back(Constraint(key, value)); 101 constraints->push_back(Constraint(key, value));
97 return true; 102 return true;
98 } 103 }
99 104
100 } // namespace content 105 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/mock_media_stream_video_sink.cc ('k') | content/renderer/media/video_destination_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698