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 | 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 void CreateNativeVideoMediaStreamTrack( | 64 void CreateNativeVideoMediaStreamTrack( |
65 const blink::WebMediaStreamTrack& track) { | 65 const blink::WebMediaStreamTrack& track) { |
66 DCHECK(track.getTrackData() == NULL); | 66 DCHECK(track.getTrackData() == NULL); |
67 blink::WebMediaStreamSource source = track.source(); | 67 blink::WebMediaStreamSource source = track.source(); |
68 DCHECK_EQ(source.getType(), blink::WebMediaStreamSource::TypeVideo); | 68 DCHECK_EQ(source.getType(), blink::WebMediaStreamSource::TypeVideo); |
69 MediaStreamVideoSource* native_source = | 69 MediaStreamVideoSource* native_source = |
70 MediaStreamVideoSource::GetVideoSource(source); | 70 MediaStreamVideoSource::GetVideoSource(source); |
71 DCHECK(native_source); | 71 DCHECK(native_source); |
72 blink::WebMediaStreamTrack writable_track(track); | 72 blink::WebMediaStreamTrack writable_track(track); |
73 // TODO(perkj): The constraints to use here should be passed from blink when | 73 if (IsOldVideoConstraints()) { |
74 // a new track is created. For cloning, it should be the constraints of the | 74 // TODO(perkj): The constraints to use here should be passed from blink when |
75 // cloned track and not the originating source. | 75 // a new track is created. For cloning, it should be the constraints of the |
76 // Also - source.constraints() returns an uninitialized constraint if the | 76 // cloned track and not the originating source. |
77 // source is coming from a remote video track. See http://crbug/287805. | 77 // Also - source.constraints() returns an uninitialized constraint if the |
78 blink::WebMediaConstraints constraints = source.constraints(); | 78 // source is coming from a remote video track. See http://crbug/287805. |
79 if (constraints.isNull()) | 79 blink::WebMediaConstraints constraints = source.constraints(); |
80 constraints.initialize(); | 80 if (constraints.isNull()) |
81 writable_track.setTrackData(new MediaStreamVideoTrack( | 81 constraints.initialize(); |
82 native_source, constraints, MediaStreamVideoSource::ConstraintsCallback(), | 82 writable_track.setTrackData(new MediaStreamVideoTrack( |
83 track.isEnabled())); | 83 native_source, constraints, |
| 84 MediaStreamVideoSource::ConstraintsCallback(), track.isEnabled())); |
| 85 } else { |
| 86 // TODO(guidou): All existing uses are without constraints except for the |
| 87 // case of cloning a track. To fix this, create a new function in |
| 88 // MediaStreamCenter specifically for cloning. |
| 89 writable_track.setTrackData(new MediaStreamVideoTrack( |
| 90 native_source, MediaStreamVideoSource::ConstraintsCallback(), |
| 91 track.isEnabled())); |
| 92 } |
84 } | 93 } |
85 | 94 |
86 } // namespace | 95 } // namespace |
87 | 96 |
88 MediaStreamCenter::MediaStreamCenter( | 97 MediaStreamCenter::MediaStreamCenter( |
89 blink::WebMediaStreamCenterClient* client, | 98 blink::WebMediaStreamCenterClient* client, |
90 PeerConnectionDependencyFactory* factory) {} | 99 PeerConnectionDependencyFactory* factory) {} |
91 | 100 |
92 MediaStreamCenter::~MediaStreamCenter() {} | 101 MediaStreamCenter::~MediaStreamCenter() {} |
93 | 102 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 | 206 |
198 bool MediaStreamCenter::didRemoveMediaStreamTrack( | 207 bool MediaStreamCenter::didRemoveMediaStreamTrack( |
199 const blink::WebMediaStream& stream, | 208 const blink::WebMediaStream& stream, |
200 const blink::WebMediaStreamTrack& track) { | 209 const blink::WebMediaStreamTrack& track) { |
201 DVLOG(1) << "MediaStreamCenter::didRemoveMediaStreamTrack"; | 210 DVLOG(1) << "MediaStreamCenter::didRemoveMediaStreamTrack"; |
202 MediaStream* native_stream = MediaStream::GetMediaStream(stream); | 211 MediaStream* native_stream = MediaStream::GetMediaStream(stream); |
203 return native_stream->RemoveTrack(track); | 212 return native_stream->RemoveTrack(track); |
204 } | 213 } |
205 | 214 |
206 } // namespace content | 215 } // namespace content |
OLD | NEW |