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

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

Issue 2964003002: Remove support for old getUserMedia video constraints algorithm. (Closed)
Patch Set: rebase and address hbos@ comments Created 3 years, 5 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
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 4
5 #include "content/renderer/media/media_stream_center.h" 5 #include "content/renderer/media/media_stream_center.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 LOG(DFATAL) << "WebMediaStreamSource missing its MediaStreamAudioSource."; 61 LOG(DFATAL) << "WebMediaStreamSource missing its MediaStreamAudioSource.";
62 } 62 }
63 63
64 void CreateNativeVideoMediaStreamTrack(blink::WebMediaStreamTrack track) { 64 void CreateNativeVideoMediaStreamTrack(blink::WebMediaStreamTrack track) {
65 DCHECK(track.GetTrackData() == NULL); 65 DCHECK(track.GetTrackData() == NULL);
66 blink::WebMediaStreamSource source = track.Source(); 66 blink::WebMediaStreamSource source = track.Source();
67 DCHECK_EQ(source.GetType(), blink::WebMediaStreamSource::kTypeVideo); 67 DCHECK_EQ(source.GetType(), blink::WebMediaStreamSource::kTypeVideo);
68 MediaStreamVideoSource* native_source = 68 MediaStreamVideoSource* native_source =
69 MediaStreamVideoSource::GetVideoSource(source); 69 MediaStreamVideoSource::GetVideoSource(source);
70 DCHECK(native_source); 70 DCHECK(native_source);
71 if (IsOldVideoConstraints()) { 71 track.SetTrackData(new MediaStreamVideoTrack(
72 // TODO(perkj): The constraints to use here should be passed from blink when 72 native_source, MediaStreamVideoSource::ConstraintsCallback(),
73 // a new track is created. For cloning, it should be the constraints of the 73 track.IsEnabled()));
74 // cloned track and not the originating source.
75 // Also - source.constraints() returns an uninitialized constraint if the
76 // source is coming from a remote video track. See http://crbug/287805.
77 blink::WebMediaConstraints constraints = source.Constraints();
78 if (constraints.IsNull())
79 constraints.Initialize();
80 track.SetTrackData(new MediaStreamVideoTrack(
81 native_source, constraints,
82 MediaStreamVideoSource::ConstraintsCallback(), track.IsEnabled()));
83 } else {
84 track.SetTrackData(new MediaStreamVideoTrack(
85 native_source, MediaStreamVideoSource::ConstraintsCallback(),
86 track.IsEnabled()));
87 }
88 } 74 }
89 75
90 void CloneNativeVideoMediaStreamTrack( 76 void CloneNativeVideoMediaStreamTrack(
91 const blink::WebMediaStreamTrack& original, 77 const blink::WebMediaStreamTrack& original,
92 blink::WebMediaStreamTrack clone) { 78 blink::WebMediaStreamTrack clone) {
93 DCHECK(!clone.GetTrackData()); 79 DCHECK(!clone.GetTrackData());
94 blink::WebMediaStreamSource source = clone.Source(); 80 blink::WebMediaStreamSource source = clone.Source();
95 DCHECK_EQ(source.GetType(), blink::WebMediaStreamSource::kTypeVideo); 81 DCHECK_EQ(source.GetType(), blink::WebMediaStreamSource::kTypeVideo);
96 MediaStreamVideoSource* native_source = 82 MediaStreamVideoSource* native_source =
97 MediaStreamVideoSource::GetVideoSource(source); 83 MediaStreamVideoSource::GetVideoSource(source);
98 DCHECK(native_source); 84 DCHECK(native_source);
99 if (IsOldVideoConstraints()) { 85 MediaStreamVideoTrack* original_track =
100 // TODO(perkj): The constraints to use here should be passed from blink when 86 MediaStreamVideoTrack::GetVideoTrack(original);
101 // a new track is created. For cloning, it should be the constraints of the 87 DCHECK(original_track);
102 // cloned track and not the originating source. 88 clone.SetTrackData(new MediaStreamVideoTrack(
103 // Also - source.constraints() returns an uninitialized constraint if the 89 native_source, original_track->adapter_settings(),
104 // source is coming from a remote video track. See http://crbug/287805. 90 original_track->noise_reduction(), original_track->is_screencast(),
105 blink::WebMediaConstraints constraints = source.Constraints(); 91 original_track->min_frame_rate(),
106 if (constraints.IsNull()) 92 MediaStreamVideoSource::ConstraintsCallback(), clone.IsEnabled()));
107 constraints.Initialize();
108 clone.SetTrackData(new MediaStreamVideoTrack(
109 native_source, constraints,
110 MediaStreamVideoSource::ConstraintsCallback(), clone.IsEnabled()));
111 } else {
112 MediaStreamVideoTrack* original_track =
113 MediaStreamVideoTrack::GetVideoTrack(original);
114 DCHECK(original_track);
115 clone.SetTrackData(new MediaStreamVideoTrack(
116 native_source, original_track->adapter_settings(),
117 original_track->noise_reduction(), original_track->is_screencast(),
118 original_track->min_frame_rate(),
119 MediaStreamVideoSource::ConstraintsCallback(), clone.IsEnabled()));
120 }
121 } 93 }
122 94
123 } // namespace 95 } // namespace
124 96
125 MediaStreamCenter::MediaStreamCenter( 97 MediaStreamCenter::MediaStreamCenter(
126 blink::WebMediaStreamCenterClient* client, 98 blink::WebMediaStreamCenterClient* client,
127 PeerConnectionDependencyFactory* factory) {} 99 PeerConnectionDependencyFactory* factory) {}
128 100
129 MediaStreamCenter::~MediaStreamCenter() {} 101 MediaStreamCenter::~MediaStreamCenter() {}
130 102
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 223
252 bool MediaStreamCenter::DidRemoveMediaStreamTrack( 224 bool MediaStreamCenter::DidRemoveMediaStreamTrack(
253 const blink::WebMediaStream& stream, 225 const blink::WebMediaStream& stream,
254 const blink::WebMediaStreamTrack& track) { 226 const blink::WebMediaStreamTrack& track) {
255 DVLOG(1) << "MediaStreamCenter::didRemoveMediaStreamTrack"; 227 DVLOG(1) << "MediaStreamCenter::didRemoveMediaStreamTrack";
256 MediaStream* native_stream = MediaStream::GetMediaStream(stream); 228 MediaStream* native_stream = MediaStream::GetMediaStream(stream);
257 return native_stream->RemoveTrack(track); 229 return native_stream->RemoveTrack(track);
258 } 230 }
259 231
260 } // namespace content 232 } // namespace content
OLDNEW
« no previous file with comments | « content/public/common/content_features.cc ('k') | content/renderer/media/media_stream_video_capturer_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698