OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/webrtc/mock_peer_connection_dependency_factory.
h" | 5 #include "content/renderer/media/webrtc/mock_peer_connection_dependency_factory.
h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
11 #include "content/renderer/media/mock_peer_connection_impl.h" | 11 #include "content/renderer/media/mock_peer_connection_impl.h" |
12 #include "content/renderer/media/webaudio_capturer_source.h" | |
13 #include "content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h" | |
14 #include "content/renderer/media/webrtc/webrtc_video_capturer_adapter.h" | 12 #include "content/renderer/media/webrtc/webrtc_video_capturer_adapter.h" |
15 #include "content/renderer/media/webrtc_audio_capturer.h" | |
16 #include "content/renderer/media/webrtc_local_audio_track.h" | |
17 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" | 13 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" |
18 #include "third_party/webrtc/api/mediastreaminterface.h" | 14 #include "third_party/webrtc/api/mediastreaminterface.h" |
19 #include "third_party/webrtc/base/scoped_ref_ptr.h" | 15 #include "third_party/webrtc/base/scoped_ref_ptr.h" |
20 #include "third_party/webrtc/media/base/videocapturer.h" | 16 #include "third_party/webrtc/media/base/videocapturer.h" |
21 | 17 |
22 using webrtc::AudioSourceInterface; | 18 using webrtc::AudioSourceInterface; |
23 using webrtc::AudioTrackInterface; | 19 using webrtc::AudioTrackInterface; |
24 using webrtc::AudioTrackVector; | 20 using webrtc::AudioTrackVector; |
25 using webrtc::IceCandidateCollection; | 21 using webrtc::IceCandidateCollection; |
26 using webrtc::IceCandidateInterface; | 22 using webrtc::IceCandidateInterface; |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 | 459 |
464 scoped_refptr<webrtc::VideoSourceInterface> | 460 scoped_refptr<webrtc::VideoSourceInterface> |
465 MockPeerConnectionDependencyFactory::CreateVideoSource( | 461 MockPeerConnectionDependencyFactory::CreateVideoSource( |
466 cricket::VideoCapturer* capturer, | 462 cricket::VideoCapturer* capturer, |
467 const blink::WebMediaConstraints& constraints) { | 463 const blink::WebMediaConstraints& constraints) { |
468 last_video_source_ = new rtc::RefCountedObject<MockVideoSource>(false); | 464 last_video_source_ = new rtc::RefCountedObject<MockVideoSource>(false); |
469 last_video_source_->SetVideoCapturer(capturer); | 465 last_video_source_->SetVideoCapturer(capturer); |
470 return last_video_source_; | 466 return last_video_source_; |
471 } | 467 } |
472 | 468 |
473 scoped_refptr<WebAudioCapturerSource> | |
474 MockPeerConnectionDependencyFactory::CreateWebAudioSource( | |
475 blink::WebMediaStreamSource* source) { | |
476 return NULL; | |
477 } | |
478 | |
479 scoped_refptr<webrtc::MediaStreamInterface> | 469 scoped_refptr<webrtc::MediaStreamInterface> |
480 MockPeerConnectionDependencyFactory::CreateLocalMediaStream( | 470 MockPeerConnectionDependencyFactory::CreateLocalMediaStream( |
481 const std::string& label) { | 471 const std::string& label) { |
482 return new rtc::RefCountedObject<MockMediaStream>(label); | 472 return new rtc::RefCountedObject<MockMediaStream>(label); |
483 } | 473 } |
484 | 474 |
485 scoped_refptr<webrtc::VideoTrackInterface> | 475 scoped_refptr<webrtc::VideoTrackInterface> |
486 MockPeerConnectionDependencyFactory::CreateLocalVideoTrack( | 476 MockPeerConnectionDependencyFactory::CreateLocalVideoTrack( |
487 const std::string& id, | 477 const std::string& id, |
488 webrtc::VideoSourceInterface* source) { | 478 webrtc::VideoSourceInterface* source) { |
(...skipping 23 matching lines...) Expand all Loading... |
512 } | 502 } |
513 | 503 |
514 webrtc::IceCandidateInterface* | 504 webrtc::IceCandidateInterface* |
515 MockPeerConnectionDependencyFactory::CreateIceCandidate( | 505 MockPeerConnectionDependencyFactory::CreateIceCandidate( |
516 const std::string& sdp_mid, | 506 const std::string& sdp_mid, |
517 int sdp_mline_index, | 507 int sdp_mline_index, |
518 const std::string& sdp) { | 508 const std::string& sdp) { |
519 return new MockIceCandidate(sdp_mid, sdp_mline_index, sdp); | 509 return new MockIceCandidate(sdp_mid, sdp_mline_index, sdp); |
520 } | 510 } |
521 | 511 |
522 scoped_refptr<WebRtcAudioCapturer> | |
523 MockPeerConnectionDependencyFactory::CreateAudioCapturer( | |
524 int render_frame_id, | |
525 const StreamDeviceInfo& device_info, | |
526 const blink::WebMediaConstraints& constraints, | |
527 MediaStreamAudioSource* audio_source) { | |
528 if (fail_to_create_next_audio_capturer_) { | |
529 fail_to_create_next_audio_capturer_ = false; | |
530 return NULL; | |
531 } | |
532 DCHECK(audio_source); | |
533 return WebRtcAudioCapturer::CreateCapturer(-1, device_info, constraints, NULL, | |
534 audio_source); | |
535 } | |
536 | |
537 void MockPeerConnectionDependencyFactory::StartLocalAudioTrack( | |
538 WebRtcLocalAudioTrack* audio_track) { | |
539 audio_track->Start(); | |
540 } | |
541 | |
542 } // namespace content | 512 } // namespace content |
OLD | NEW |