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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 | 405 |
410 scoped_refptr<webrtc::VideoTrackSourceInterface> | 406 scoped_refptr<webrtc::VideoTrackSourceInterface> |
411 MockPeerConnectionDependencyFactory::CreateVideoSource( | 407 MockPeerConnectionDependencyFactory::CreateVideoSource( |
412 cricket::VideoCapturer* capturer) { | 408 cricket::VideoCapturer* capturer) { |
413 // Video source normally take ownership of |capturer|. | 409 // Video source normally take ownership of |capturer|. |
414 delete capturer; | 410 delete capturer; |
415 NOTIMPLEMENTED(); | 411 NOTIMPLEMENTED(); |
416 return nullptr; | 412 return nullptr; |
417 } | 413 } |
418 | 414 |
419 void MockPeerConnectionDependencyFactory::CreateWebAudioSource( | |
420 blink::WebMediaStreamSource* source) {} | |
421 | |
422 scoped_refptr<webrtc::MediaStreamInterface> | 415 scoped_refptr<webrtc::MediaStreamInterface> |
423 MockPeerConnectionDependencyFactory::CreateLocalMediaStream( | 416 MockPeerConnectionDependencyFactory::CreateLocalMediaStream( |
424 const std::string& label) { | 417 const std::string& label) { |
425 return new rtc::RefCountedObject<MockMediaStream>(label); | 418 return new rtc::RefCountedObject<MockMediaStream>(label); |
426 } | 419 } |
427 | 420 |
428 scoped_refptr<webrtc::VideoTrackInterface> | 421 scoped_refptr<webrtc::VideoTrackInterface> |
429 MockPeerConnectionDependencyFactory::CreateLocalVideoTrack( | 422 MockPeerConnectionDependencyFactory::CreateLocalVideoTrack( |
430 const std::string& id, | 423 const std::string& id, |
431 webrtc::VideoTrackSourceInterface* source) { | 424 webrtc::VideoTrackSourceInterface* source) { |
(...skipping 19 matching lines...) Expand all Loading... |
451 } | 444 } |
452 | 445 |
453 webrtc::IceCandidateInterface* | 446 webrtc::IceCandidateInterface* |
454 MockPeerConnectionDependencyFactory::CreateIceCandidate( | 447 MockPeerConnectionDependencyFactory::CreateIceCandidate( |
455 const std::string& sdp_mid, | 448 const std::string& sdp_mid, |
456 int sdp_mline_index, | 449 int sdp_mline_index, |
457 const std::string& sdp) { | 450 const std::string& sdp) { |
458 return new MockIceCandidate(sdp_mid, sdp_mline_index, sdp); | 451 return new MockIceCandidate(sdp_mid, sdp_mline_index, sdp); |
459 } | 452 } |
460 | 453 |
461 std::unique_ptr<WebRtcAudioCapturer> | |
462 MockPeerConnectionDependencyFactory::CreateAudioCapturer( | |
463 int render_frame_id, | |
464 const StreamDeviceInfo& device_info, | |
465 const blink::WebMediaConstraints& constraints, | |
466 MediaStreamAudioSource* audio_source) { | |
467 if (fail_to_create_next_audio_capturer_) { | |
468 fail_to_create_next_audio_capturer_ = false; | |
469 return NULL; | |
470 } | |
471 DCHECK(audio_source); | |
472 return WebRtcAudioCapturer::CreateCapturer(-1, device_info, constraints, NULL, | |
473 audio_source); | |
474 } | |
475 | |
476 } // namespace content | 454 } // namespace content |
OLD | NEW |