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 <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "content/common/media/media_stream_messages.h" | 11 #include "content/common/media/media_stream_messages.h" |
12 #include "content/public/common/content_switches.h" | 12 #include "content/public/common/content_switches.h" |
13 #include "content/public/renderer/render_thread.h" | 13 #include "content/public/renderer/render_thread.h" |
14 #include "content/renderer/media/media_stream.h" | 14 #include "content/renderer/media/media_stream.h" |
15 #include "content/renderer/media/media_stream_dependency_factory.h" | 15 #include "content/renderer/media/media_stream_dependency_factory.h" |
16 #include "content/renderer/media/media_stream_source.h" | 16 #include "content/renderer/media/media_stream_source.h" |
17 #include "content/renderer/media/media_stream_video_source.h" | |
17 #include "content/renderer/media/media_stream_video_track.h" | 18 #include "content/renderer/media/media_stream_video_track.h" |
19 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" | |
18 #include "third_party/WebKit/public/platform/WebMediaStream.h" | 20 #include "third_party/WebKit/public/platform/WebMediaStream.h" |
19 #include "third_party/WebKit/public/platform/WebMediaStreamCenterClient.h" | 21 #include "third_party/WebKit/public/platform/WebMediaStreamCenterClient.h" |
20 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" | 22 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" |
21 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" | 23 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" |
22 #include "third_party/WebKit/public/platform/WebMediaStreamTrackSourcesRequest.h " | 24 #include "third_party/WebKit/public/platform/WebMediaStreamTrackSourcesRequest.h " |
23 #include "third_party/WebKit/public/platform/WebSourceInfo.h" | 25 #include "third_party/WebKit/public/platform/WebSourceInfo.h" |
24 #include "third_party/WebKit/public/platform/WebVector.h" | 26 #include "third_party/WebKit/public/platform/WebVector.h" |
25 #include "third_party/WebKit/public/web/WebFrame.h" | 27 #include "third_party/WebKit/public/web/WebFrame.h" |
26 | 28 |
27 using blink::WebFrame; | 29 using blink::WebFrame; |
(...skipping 11 matching lines...) Expand all Loading... | |
39 DCHECK_EQ(source.type(), blink::WebMediaStreamSource::TypeAudio); | 41 DCHECK_EQ(source.type(), blink::WebMediaStreamSource::TypeAudio); |
40 factory->CreateLocalAudioTrack(track); | 42 factory->CreateLocalAudioTrack(track); |
41 } | 43 } |
42 | 44 |
43 void CreateNativeVideoMediaStreamTrack( | 45 void CreateNativeVideoMediaStreamTrack( |
44 const blink::WebMediaStreamTrack& track, | 46 const blink::WebMediaStreamTrack& track, |
45 MediaStreamDependencyFactory* factory) { | 47 MediaStreamDependencyFactory* factory) { |
46 DCHECK(track.extraData() == NULL); | 48 DCHECK(track.extraData() == NULL); |
47 blink::WebMediaStreamSource source = track.source(); | 49 blink::WebMediaStreamSource source = track.source(); |
48 DCHECK_EQ(source.type(), blink::WebMediaStreamSource::TypeVideo); | 50 DCHECK_EQ(source.type(), blink::WebMediaStreamSource::TypeVideo); |
49 | 51 MediaStreamVideoSource* native_source = |
50 if (!source.extraData()) { | 52 MediaStreamVideoSource::GetVideoSource(source); |
53 if (!native_source) { | |
51 // TODO(perkj): Implement support for sources from | 54 // TODO(perkj): Implement support for sources from |
52 // remote MediaStreams. | 55 // remote MediaStreams. |
53 NOTIMPLEMENTED(); | 56 NOTIMPLEMENTED(); |
54 return; | 57 return; |
55 } | 58 } |
56 MediaStreamTrack* native_track = new MediaStreamVideoTrack(factory); | 59 MediaStreamVideoTrack::CreateVideoTrack( |
Ronghua Wu (Left Chromium)
2014/03/04 01:04:11
I'm confused, who gets the newly created blink::We
perkj_chrome
2014/03/04 10:44:51
Good catch - right - this is wrong.... |track| has
Ronghua Wu (Left Chromium)
2014/03/04 23:50:55
Not sure if writable_track is the common practice,
| |
57 native_track->SetEnabled(track.isEnabled()); | 60 native_source, source.constraints(), |
58 blink::WebMediaStreamTrack writable_track(track); | 61 MediaStreamVideoSource::ConstraintsCallback(), track.isEnabled(), |
59 writable_track.setExtraData(native_track); | 62 factory); |
60 } | 63 } |
61 | 64 |
62 void CreateNativeMediaStreamTrack(const blink::WebMediaStreamTrack& track, | 65 void CreateNativeMediaStreamTrack(const blink::WebMediaStreamTrack& track, |
63 MediaStreamDependencyFactory* factory) { | 66 MediaStreamDependencyFactory* factory) { |
64 DCHECK(!track.isNull() && !track.extraData()); | 67 DCHECK(!track.isNull() && !track.extraData()); |
65 DCHECK(!track.source().isNull()); | 68 DCHECK(!track.source().isNull()); |
66 | 69 |
67 switch (track.source().type()) { | 70 switch (track.source().type()) { |
68 case blink::WebMediaStreamSource::TypeAudio: | 71 case blink::WebMediaStreamSource::TypeAudio: |
69 CreateNativeAudioMediaStreamTrack(track, factory); | 72 CreateNativeAudioMediaStreamTrack(track, factory); |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
245 device.type == MEDIA_DEVICE_AUDIO_CAPTURE | 248 device.type == MEDIA_DEVICE_AUDIO_CAPTURE |
246 ? blink::WebSourceInfo::SourceKindAudio | 249 ? blink::WebSourceInfo::SourceKindAudio |
247 : blink::WebSourceInfo::SourceKindVideo, | 250 : blink::WebSourceInfo::SourceKindVideo, |
248 blink::WebString::fromUTF8(device.name), | 251 blink::WebString::fromUTF8(device.name), |
249 video_facing); | 252 video_facing); |
250 } | 253 } |
251 request_it->second.requestSucceeded(sourceInfos); | 254 request_it->second.requestSucceeded(sourceInfos); |
252 } | 255 } |
253 | 256 |
254 } // namespace content | 257 } // namespace content |
OLD | NEW |