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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 | 346 |
351 scoped_refptr<webrtc::VideoTrackSourceInterface> | 347 scoped_refptr<webrtc::VideoTrackSourceInterface> |
352 MockPeerConnectionDependencyFactory::CreateVideoSource( | 348 MockPeerConnectionDependencyFactory::CreateVideoSource( |
353 cricket::VideoCapturer* capturer) { | 349 cricket::VideoCapturer* capturer) { |
354 // Video source normally take ownership of |capturer|. | 350 // Video source normally take ownership of |capturer|. |
355 delete capturer; | 351 delete capturer; |
356 NOTIMPLEMENTED(); | 352 NOTIMPLEMENTED(); |
357 return nullptr; | 353 return nullptr; |
358 } | 354 } |
359 | 355 |
360 void MockPeerConnectionDependencyFactory::CreateWebAudioSource( | |
361 blink::WebMediaStreamSource* source) {} | |
362 | |
363 scoped_refptr<webrtc::MediaStreamInterface> | 356 scoped_refptr<webrtc::MediaStreamInterface> |
364 MockPeerConnectionDependencyFactory::CreateLocalMediaStream( | 357 MockPeerConnectionDependencyFactory::CreateLocalMediaStream( |
365 const std::string& label) { | 358 const std::string& label) { |
366 return new rtc::RefCountedObject<MockMediaStream>(label); | 359 return new rtc::RefCountedObject<MockMediaStream>(label); |
367 } | 360 } |
368 | 361 |
369 scoped_refptr<webrtc::VideoTrackInterface> | 362 scoped_refptr<webrtc::VideoTrackInterface> |
370 MockPeerConnectionDependencyFactory::CreateLocalVideoTrack( | 363 MockPeerConnectionDependencyFactory::CreateLocalVideoTrack( |
371 const std::string& id, | 364 const std::string& id, |
372 webrtc::VideoTrackSourceInterface* source) { | 365 webrtc::VideoTrackSourceInterface* source) { |
(...skipping 19 matching lines...) Expand all Loading... |
392 } | 385 } |
393 | 386 |
394 webrtc::IceCandidateInterface* | 387 webrtc::IceCandidateInterface* |
395 MockPeerConnectionDependencyFactory::CreateIceCandidate( | 388 MockPeerConnectionDependencyFactory::CreateIceCandidate( |
396 const std::string& sdp_mid, | 389 const std::string& sdp_mid, |
397 int sdp_mline_index, | 390 int sdp_mline_index, |
398 const std::string& sdp) { | 391 const std::string& sdp) { |
399 return new MockIceCandidate(sdp_mid, sdp_mline_index, sdp); | 392 return new MockIceCandidate(sdp_mid, sdp_mline_index, sdp); |
400 } | 393 } |
401 | 394 |
402 scoped_ptr<WebRtcAudioCapturer> | |
403 MockPeerConnectionDependencyFactory::CreateAudioCapturer( | |
404 int render_frame_id, | |
405 const StreamDeviceInfo& device_info, | |
406 const blink::WebMediaConstraints& constraints, | |
407 MediaStreamAudioSource* audio_source) { | |
408 if (fail_to_create_next_audio_capturer_) { | |
409 fail_to_create_next_audio_capturer_ = false; | |
410 return NULL; | |
411 } | |
412 DCHECK(audio_source); | |
413 return WebRtcAudioCapturer::CreateCapturer(-1, device_info, constraints, NULL, | |
414 audio_source); | |
415 } | |
416 | |
417 } // namespace content | 395 } // namespace content |
OLD | NEW |