| 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/mock_media_stream_dependency_factory.h" | 5 #include "content/renderer/media/mock_media_stream_dependency_factory.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "content/renderer/media/mock_peer_connection_impl.h" | 9 #include "content/renderer/media/mock_peer_connection_impl.h" |
| 10 #include "content/renderer/media/webaudio_capturer_source.h" |
| 10 #include "content/renderer/media/webrtc_audio_capturer.h" | 11 #include "content/renderer/media/webrtc_audio_capturer.h" |
| 11 #include "content/renderer/media/webrtc_local_audio_track.h" | 12 #include "content/renderer/media/webrtc_local_audio_track.h" |
| 12 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" | 13 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" |
| 13 #include "third_party/libjingle/source/talk/base/scoped_ref_ptr.h" | 14 #include "third_party/libjingle/source/talk/base/scoped_ref_ptr.h" |
| 14 #include "third_party/libjingle/source/talk/media/base/videocapturer.h" | 15 #include "third_party/libjingle/source/talk/media/base/videocapturer.h" |
| 15 | 16 |
| 16 using webrtc::AudioSourceInterface; | 17 using webrtc::AudioSourceInterface; |
| 17 using webrtc::AudioTrackInterface; | 18 using webrtc::AudioTrackInterface; |
| 18 using webrtc::AudioTrackVector; | 19 using webrtc::AudioTrackVector; |
| 19 using webrtc::IceCandidateCollection; | 20 using webrtc::IceCandidateCollection; |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 | 400 |
| 400 scoped_refptr<webrtc::VideoSourceInterface> | 401 scoped_refptr<webrtc::VideoSourceInterface> |
| 401 MockMediaStreamDependencyFactory::CreateLocalVideoSource( | 402 MockMediaStreamDependencyFactory::CreateLocalVideoSource( |
| 402 int video_session_id, | 403 int video_session_id, |
| 403 bool is_screencast, | 404 bool is_screencast, |
| 404 const webrtc::MediaConstraintsInterface* constraints) { | 405 const webrtc::MediaConstraintsInterface* constraints) { |
| 405 last_video_source_ = new talk_base::RefCountedObject<MockVideoSource>(); | 406 last_video_source_ = new talk_base::RefCountedObject<MockVideoSource>(); |
| 406 return last_video_source_; | 407 return last_video_source_; |
| 407 } | 408 } |
| 408 | 409 |
| 409 scoped_refptr<WebRtcAudioCapturer> | 410 scoped_refptr<WebAudioCapturerSource> |
| 410 MockMediaStreamDependencyFactory::CreateWebAudioSource( | 411 MockMediaStreamDependencyFactory::CreateWebAudioSource( |
| 411 WebKit::WebMediaStreamSource* source, | 412 WebKit::WebMediaStreamSource* source, |
| 412 RTCMediaConstraints* constraints) { | 413 RTCMediaConstraints* constraints) { |
| 413 return NULL; | 414 return NULL; |
| 414 } | 415 } |
| 415 | 416 |
| 416 scoped_refptr<webrtc::MediaStreamInterface> | 417 scoped_refptr<webrtc::MediaStreamInterface> |
| 417 MockMediaStreamDependencyFactory::CreateLocalMediaStream( | 418 MockMediaStreamDependencyFactory::CreateLocalMediaStream( |
| 418 const std::string& label) { | 419 const std::string& label) { |
| 419 DCHECK(mock_pc_factory_created_); | 420 DCHECK(mock_pc_factory_created_); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 441 new talk_base::RefCountedObject<MockVideoSource>(); | 442 new talk_base::RefCountedObject<MockVideoSource>(); |
| 442 source->SetVideoCapturer(capturer); | 443 source->SetVideoCapturer(capturer); |
| 443 | 444 |
| 444 return new talk_base::RefCountedObject<MockLocalVideoTrack>(id, source.get()); | 445 return new talk_base::RefCountedObject<MockLocalVideoTrack>(id, source.get()); |
| 445 } | 446 } |
| 446 | 447 |
| 447 scoped_refptr<webrtc::AudioTrackInterface> | 448 scoped_refptr<webrtc::AudioTrackInterface> |
| 448 MockMediaStreamDependencyFactory::CreateLocalAudioTrack( | 449 MockMediaStreamDependencyFactory::CreateLocalAudioTrack( |
| 449 const std::string& id, | 450 const std::string& id, |
| 450 const scoped_refptr<WebRtcAudioCapturer>& capturer, | 451 const scoped_refptr<WebRtcAudioCapturer>& capturer, |
| 452 WebAudioCapturerSource* webaudio_source, |
| 451 webrtc::AudioSourceInterface* source, | 453 webrtc::AudioSourceInterface* source, |
| 452 const webrtc::MediaConstraintsInterface* constraints) { | 454 const webrtc::MediaConstraintsInterface* constraints) { |
| 453 DCHECK(mock_pc_factory_created_); | 455 DCHECK(mock_pc_factory_created_); |
| 454 DCHECK(!capturer.get()); | 456 DCHECK(!capturer.get()); |
| 455 return WebRtcLocalAudioTrack::Create( | 457 return WebRtcLocalAudioTrack::Create( |
| 456 id, WebRtcAudioCapturer::CreateCapturer(), source, constraints); | 458 id, WebRtcAudioCapturer::CreateCapturer(), webaudio_source, |
| 459 source, constraints); |
| 457 } | 460 } |
| 458 | 461 |
| 459 SessionDescriptionInterface* | 462 SessionDescriptionInterface* |
| 460 MockMediaStreamDependencyFactory::CreateSessionDescription( | 463 MockMediaStreamDependencyFactory::CreateSessionDescription( |
| 461 const std::string& type, | 464 const std::string& type, |
| 462 const std::string& sdp, | 465 const std::string& sdp, |
| 463 webrtc::SdpParseError* error) { | 466 webrtc::SdpParseError* error) { |
| 464 return new MockSessionDescription(type, sdp); | 467 return new MockSessionDescription(type, sdp); |
| 465 } | 468 } |
| 466 | 469 |
| 467 webrtc::IceCandidateInterface* | 470 webrtc::IceCandidateInterface* |
| 468 MockMediaStreamDependencyFactory::CreateIceCandidate( | 471 MockMediaStreamDependencyFactory::CreateIceCandidate( |
| 469 const std::string& sdp_mid, | 472 const std::string& sdp_mid, |
| 470 int sdp_mline_index, | 473 int sdp_mline_index, |
| 471 const std::string& sdp) { | 474 const std::string& sdp) { |
| 472 return new MockIceCandidate(sdp_mid, sdp_mline_index, sdp); | 475 return new MockIceCandidate(sdp_mid, sdp_mline_index, sdp); |
| 473 } | 476 } |
| 474 | 477 |
| 475 scoped_refptr<WebRtcAudioCapturer> | 478 scoped_refptr<WebRtcAudioCapturer> |
| 476 MockMediaStreamDependencyFactory::MaybeCreateAudioCapturer( | 479 MockMediaStreamDependencyFactory::MaybeCreateAudioCapturer( |
| 477 int render_view_id, const StreamDeviceInfo& device_info) { | 480 int render_view_id, const StreamDeviceInfo& device_info) { |
| 478 return WebRtcAudioCapturer::CreateCapturer(); | 481 return WebRtcAudioCapturer::CreateCapturer(); |
| 479 } | 482 } |
| 480 | 483 |
| 481 } // namespace content | 484 } // namespace content |
| OLD | NEW |