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

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

Issue 12383016: Merge AssociateStreamWithProducer message into CreateStream message for both audio output and input. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 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 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"
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 // webKitRTCPeerConnection. 220 // webKitRTCPeerConnection.
221 UpdateWebRTCMethodCount(WEBKIT_RTC_PEER_CONNECTION); 221 UpdateWebRTCMethodCount(WEBKIT_RTC_PEER_CONNECTION);
222 222
223 if (!EnsurePeerConnectionFactory()) 223 if (!EnsurePeerConnectionFactory())
224 return NULL; 224 return NULL;
225 225
226 return new RTCPeerConnectionHandler(client, this); 226 return new RTCPeerConnectionHandler(client, this);
227 } 227 }
228 228
229 void MediaStreamDependencyFactory::CreateNativeMediaSources( 229 void MediaStreamDependencyFactory::CreateNativeMediaSources(
230 int render_view_id,
230 const WebKit::WebMediaConstraints& audio_constraints, 231 const WebKit::WebMediaConstraints& audio_constraints,
231 const WebKit::WebMediaConstraints& video_constraints, 232 const WebKit::WebMediaConstraints& video_constraints,
232 WebKit::WebMediaStream* description, 233 WebKit::WebMediaStream* description,
233 const MediaSourcesCreatedCallback& sources_created) { 234 const MediaSourcesCreatedCallback& sources_created) {
234 DVLOG(1) << "MediaStreamDependencyFactory::CreateNativeMediaSources()"; 235 DVLOG(1) << "MediaStreamDependencyFactory::CreateNativeMediaSources()";
235 if (!EnsurePeerConnectionFactory()) { 236 if (!EnsurePeerConnectionFactory()) {
236 sources_created.Run(description, false); 237 sources_created.Run(description, false);
237 return; 238 return;
238 } 239 }
239 240
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 MediaStreamSourceExtraData* source_data = 278 MediaStreamSourceExtraData* source_data =
278 static_cast<MediaStreamSourceExtraData*>(source.extraData()); 279 static_cast<MediaStreamSourceExtraData*>(source.extraData());
279 if (!source_data) { 280 if (!source_data) {
280 // TODO(henrika): Implement support for sources from remote MediaStreams. 281 // TODO(henrika): Implement support for sources from remote MediaStreams.
281 NOTIMPLEMENTED(); 282 NOTIMPLEMENTED();
282 continue; 283 continue;
283 } 284 }
284 285
285 const StreamDeviceInfo device_info = source_data->device_info(); 286 const StreamDeviceInfo device_info = source_data->device_info();
286 if (IsAudioMediaType(device_info.device.type)) { 287 if (IsAudioMediaType(device_info.device.type)) {
287 if (!InitializeAudioSource(device_info)) { 288 if (!InitializeAudioSource(render_view_id, device_info)) {
288 DLOG(WARNING) << "Unsupported audio source"; 289 DLOG(WARNING) << "Unsupported audio source";
289 sources_created.Run(description, false); 290 sources_created.Run(description, false);
290 return; 291 return;
291 } 292 }
292 } 293 }
293 294
294 // Creates a LocalAudioSource object which holds audio options. 295 // Creates a LocalAudioSource object which holds audio options.
295 source_data->SetLocalAudioSource( 296 source_data->SetLocalAudioSource(
296 CreateLocalAudioSource(&native_audio_constraints)); 297 CreateLocalAudioSource(&native_audio_constraints));
297 source_observer->AddSource(source_data->local_audio_source()); 298 source_observer->AddSource(source_data->local_audio_source());
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 RtcVideoCapturer* capturer = new RtcVideoCapturer( 480 RtcVideoCapturer* capturer = new RtcVideoCapturer(
480 video_session_id, vc_manager_.get(), is_screencast); 481 video_session_id, vc_manager_.get(), is_screencast);
481 482
482 // The video source takes ownership of |capturer|. 483 // The video source takes ownership of |capturer|.
483 scoped_refptr<webrtc::VideoSourceInterface> source = 484 scoped_refptr<webrtc::VideoSourceInterface> source =
484 pc_factory_->CreateVideoSource(capturer, constraints).get(); 485 pc_factory_->CreateVideoSource(capturer, constraints).get();
485 return source; 486 return source;
486 } 487 }
487 488
488 bool MediaStreamDependencyFactory::InitializeAudioSource( 489 bool MediaStreamDependencyFactory::InitializeAudioSource(
489 const StreamDeviceInfo& device_info) { 490 int render_view_id,
491 const StreamDeviceInfo& device_info) {
490 DVLOG(1) << "MediaStreamDependencyFactory::InitializeAudioSource()"; 492 DVLOG(1) << "MediaStreamDependencyFactory::InitializeAudioSource()";
491 493
492 // TODO(henrika): the current design does not support a unique source 494 // TODO(henrika): the current design does not support a unique source
493 // for each audio track. 495 // for each audio track.
494 if (device_info.session_id <= 0) 496 if (device_info.session_id <= 0)
495 return false; 497 return false;
496 498
497 // Initialize the source using audio parameters for the selected 499 // Initialize the source using audio parameters for the selected
498 // capture device. 500 // capture device.
499 WebRtcAudioCapturer* capturer = GetWebRtcAudioDevice()->capturer(); 501 WebRtcAudioCapturer* capturer = GetWebRtcAudioDevice()->capturer();
500 // TODO(henrika): refactor \content\public\common\media_stream_request.h 502 // TODO(henrika): refactor \content\public\common\media_stream_request.h
501 // to allow dependency of media::ChannelLayout and avoid static_cast. 503 // to allow dependency of media::ChannelLayout and avoid static_cast.
502 if (!capturer->Initialize( 504 if (!capturer->Initialize(
505 render_view_id,
503 static_cast<media::ChannelLayout>(device_info.device.channel_layout), 506 static_cast<media::ChannelLayout>(device_info.device.channel_layout),
504 device_info.device.sample_rate, device_info.session_id)) 507 device_info.device.sample_rate, device_info.session_id))
505 return false; 508 return false;
506 509
507 return true; 510 return true;
508 } 511 }
509 512
510 bool MediaStreamDependencyFactory::CreateWebAudioSource( 513 bool MediaStreamDependencyFactory::CreateWebAudioSource(
511 WebKit::WebMediaStreamSource* source) { 514 WebKit::WebMediaStreamSource* source) {
512 DVLOG(1) << "MediaStreamDependencyFactory::CreateWebAudioSource()"; 515 DVLOG(1) << "MediaStreamDependencyFactory::CreateWebAudioSource()";
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 // processed before returning. We wait for the above task to finish before 692 // processed before returning. We wait for the above task to finish before
690 // letting the the function continue to avoid any potential race issues. 693 // letting the the function continue to avoid any potential race issues.
691 chrome_worker_thread_.Stop(); 694 chrome_worker_thread_.Stop();
692 } else { 695 } else {
693 NOTREACHED() << "Worker thread not running."; 696 NOTREACHED() << "Worker thread not running.";
694 } 697 }
695 } 698 }
696 } 699 }
697 700
698 } // namespace content 701 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698