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_dependency_factory.h" | 5 #include "content/renderer/media/media_stream_dependency_factory.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
11 #include "content/renderer/media/media_stream_source_extra_data.h" | 11 #include "content/renderer/media/media_stream_source_extra_data.h" |
| 12 #include "content/renderer/media/media_stream_source_observer.h" |
12 #include "content/renderer/media/rtc_media_constraints.h" | 13 #include "content/renderer/media/rtc_media_constraints.h" |
13 #include "content/renderer/media/rtc_peer_connection_handler.h" | 14 #include "content/renderer/media/rtc_peer_connection_handler.h" |
14 #include "content/renderer/media/rtc_video_capturer.h" | 15 #include "content/renderer/media/rtc_video_capturer.h" |
15 #include "content/renderer/media/video_capture_impl_manager.h" | 16 #include "content/renderer/media/video_capture_impl_manager.h" |
16 #include "content/renderer/media/webaudio_capturer_source.h" | 17 #include "content/renderer/media/webaudio_capturer_source.h" |
17 #include "content/renderer/media/webrtc_audio_device_impl.h" | 18 #include "content/renderer/media/webrtc_audio_device_impl.h" |
18 #include "content/renderer/media/webrtc_uma_histograms.h" | 19 #include "content/renderer/media/webrtc_uma_histograms.h" |
19 #include "content/renderer/p2p/ipc_network_manager.h" | 20 #include "content/renderer/p2p/ipc_network_manager.h" |
20 #include "content/renderer/p2p/ipc_socket_factory.h" | 21 #include "content/renderer/p2p/ipc_socket_factory.h" |
21 #include "content/renderer/p2p/port_allocator.h" | 22 #include "content/renderer/p2p/port_allocator.h" |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 } | 258 } |
258 const bool is_screencast = | 259 const bool is_screencast = |
259 source_data->device_info().device.type == | 260 source_data->device_info().device.type == |
260 content::MEDIA_TAB_VIDEO_CAPTURE || | 261 content::MEDIA_TAB_VIDEO_CAPTURE || |
261 source_data->device_info().device.type == | 262 source_data->device_info().device.type == |
262 content::MEDIA_SCREEN_VIDEO_CAPTURE; | 263 content::MEDIA_SCREEN_VIDEO_CAPTURE; |
263 source_data->SetVideoSource( | 264 source_data->SetVideoSource( |
264 CreateLocalVideoSource(source_data->device_info().session_id, | 265 CreateLocalVideoSource(source_data->device_info().session_id, |
265 is_screencast, | 266 is_screencast, |
266 &native_video_constraints)); | 267 &native_video_constraints)); |
| 268 source_data->SetSourceObserver(new MediaStreamSourceObserver( |
| 269 source_data->video_source(), |
| 270 video_tracks[i].source())); |
| 271 |
267 source_observer->AddSource(source_data->video_source()); | 272 source_observer->AddSource(source_data->video_source()); |
268 } | 273 } |
269 | 274 |
270 // Do additional source initialization if the audio source is a valid | 275 // Do additional source initialization if the audio source is a valid |
271 // microphone or tab audio. | 276 // microphone or tab audio. |
272 RTCMediaConstraints native_audio_constraints(audio_constraints); | 277 RTCMediaConstraints native_audio_constraints(audio_constraints); |
273 WebKit::WebVector<WebKit::WebMediaStreamTrack> audio_tracks; | 278 WebKit::WebVector<WebKit::WebMediaStreamTrack> audio_tracks; |
274 description->audioSources(audio_tracks); | 279 description->audioSources(audio_tracks); |
275 for (size_t i = 0; i < audio_tracks.size(); ++i) { | 280 for (size_t i = 0; i < audio_tracks.size(); ++i) { |
276 const WebKit::WebMediaStreamSource& source = audio_tracks[i].source(); | 281 const WebKit::WebMediaStreamSource& source = audio_tracks[i].source(); |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 // processed before returning. We wait for the above task to finish before | 694 // processed before returning. We wait for the above task to finish before |
690 // letting the the function continue to avoid any potential race issues. | 695 // letting the the function continue to avoid any potential race issues. |
691 chrome_worker_thread_.Stop(); | 696 chrome_worker_thread_.Stop(); |
692 } else { | 697 } else { |
693 NOTREACHED() << "Worker thread not running."; | 698 NOTREACHED() << "Worker thread not running."; |
694 } | 699 } |
695 } | 700 } |
696 } | 701 } |
697 | 702 |
698 } // namespace content | 703 } // namespace content |
OLD | NEW |