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/utf_string_conversions.h" |
8 #include "content/renderer/media/mock_peer_connection_impl.h" | 9 #include "content/renderer/media/mock_peer_connection_impl.h" |
9 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" | 10 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" |
10 #include "third_party/libjingle/source/talk/base/scoped_ref_ptr.h" | 11 #include "third_party/libjingle/source/talk/base/scoped_ref_ptr.h" |
| 12 #include "third_party/libjingle/source/talk/media/base/videocapturer.h" |
11 | 13 |
12 using webrtc::AudioSourceInterface; | 14 using webrtc::AudioSourceInterface; |
13 using webrtc::AudioTrackInterface; | 15 using webrtc::AudioTrackInterface; |
14 using webrtc::AudioTrackVector; | 16 using webrtc::AudioTrackVector; |
15 using webrtc::IceCandidateCollection; | 17 using webrtc::IceCandidateCollection; |
16 using webrtc::IceCandidateInterface; | 18 using webrtc::IceCandidateInterface; |
17 using webrtc::MediaStreamInterface; | 19 using webrtc::MediaStreamInterface; |
18 using webrtc::ObserverInterface; | 20 using webrtc::ObserverInterface; |
19 using webrtc::SessionDescriptionInterface; | 21 using webrtc::SessionDescriptionInterface; |
20 using webrtc::VideoRendererInterface; | 22 using webrtc::VideoRendererInterface; |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 webrtc::MediaSourceInterface::SourceState MockAudioSource::state() const { | 148 webrtc::MediaSourceInterface::SourceState MockAudioSource::state() const { |
147 return state_; | 149 return state_; |
148 } | 150 } |
149 | 151 |
150 MockVideoSource::MockVideoSource() | 152 MockVideoSource::MockVideoSource() |
151 : state_(MediaSourceInterface::kInitializing) { | 153 : state_(MediaSourceInterface::kInitializing) { |
152 } | 154 } |
153 | 155 |
154 MockVideoSource::~MockVideoSource() {} | 156 MockVideoSource::~MockVideoSource() {} |
155 | 157 |
| 158 void MockVideoSource::SetVideoCapturer(cricket::VideoCapturer* capturer) { |
| 159 capturer_.reset(capturer); |
| 160 } |
| 161 |
156 cricket::VideoCapturer* MockVideoSource::GetVideoCapturer() { | 162 cricket::VideoCapturer* MockVideoSource::GetVideoCapturer() { |
157 NOTIMPLEMENTED(); | 163 return capturer_.get(); |
158 return NULL; | |
159 } | 164 } |
160 | 165 |
161 void MockVideoSource::AddSink(cricket::VideoRenderer* output) { | 166 void MockVideoSource::AddSink(cricket::VideoRenderer* output) { |
162 NOTIMPLEMENTED(); | 167 NOTIMPLEMENTED(); |
163 } | 168 } |
164 | 169 |
165 void MockVideoSource::RemoveSink(cricket::VideoRenderer* output) { | 170 void MockVideoSource::RemoveSink(cricket::VideoRenderer* output) { |
166 NOTIMPLEMENTED(); | 171 NOTIMPLEMENTED(); |
167 } | 172 } |
168 | 173 |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 MockMediaStreamDependencyFactory::CreateLocalVideoTrack( | 465 MockMediaStreamDependencyFactory::CreateLocalVideoTrack( |
461 const std::string& id, | 466 const std::string& id, |
462 webrtc::VideoSourceInterface* source) { | 467 webrtc::VideoSourceInterface* source) { |
463 DCHECK(mock_pc_factory_created_); | 468 DCHECK(mock_pc_factory_created_); |
464 scoped_refptr<webrtc::VideoTrackInterface> track( | 469 scoped_refptr<webrtc::VideoTrackInterface> track( |
465 new talk_base::RefCountedObject<MockLocalVideoTrack>( | 470 new talk_base::RefCountedObject<MockLocalVideoTrack>( |
466 id, source)); | 471 id, source)); |
467 return track; | 472 return track; |
468 } | 473 } |
469 | 474 |
| 475 scoped_refptr<webrtc::VideoTrackInterface> |
| 476 MockMediaStreamDependencyFactory::CreateLocalVideoTrack( |
| 477 const std::string& id, |
| 478 cricket::VideoCapturer* capturer) { |
| 479 DCHECK(mock_pc_factory_created_); |
| 480 |
| 481 scoped_refptr<MockVideoSource> source = |
| 482 new talk_base::RefCountedObject<MockVideoSource>(); |
| 483 source->SetVideoCapturer(capturer); |
| 484 |
| 485 return new talk_base::RefCountedObject<MockLocalVideoTrack>(id, source); |
| 486 } |
| 487 |
470 scoped_refptr<webrtc::AudioTrackInterface> | 488 scoped_refptr<webrtc::AudioTrackInterface> |
471 MockMediaStreamDependencyFactory::CreateLocalAudioTrack( | 489 MockMediaStreamDependencyFactory::CreateLocalAudioTrack( |
472 const std::string& id, | 490 const std::string& id, |
473 webrtc::AudioSourceInterface* source) { | 491 webrtc::AudioSourceInterface* source) { |
474 DCHECK(mock_pc_factory_created_); | 492 DCHECK(mock_pc_factory_created_); |
475 scoped_refptr<webrtc::AudioTrackInterface> track( | 493 scoped_refptr<webrtc::AudioTrackInterface> track( |
476 new talk_base::RefCountedObject<MockLocalAudioTrack>(id)); | 494 new talk_base::RefCountedObject<MockLocalAudioTrack>(id)); |
477 return track; | 495 return track; |
478 } | 496 } |
479 | 497 |
480 SessionDescriptionInterface* | 498 SessionDescriptionInterface* |
481 MockMediaStreamDependencyFactory::CreateSessionDescription( | 499 MockMediaStreamDependencyFactory::CreateSessionDescription( |
482 const std::string& type, | 500 const std::string& type, |
483 const std::string& sdp, | 501 const std::string& sdp, |
484 webrtc::SdpParseError* error) { | 502 webrtc::SdpParseError* error) { |
485 return new MockSessionDescription(type, sdp); | 503 return new MockSessionDescription(type, sdp); |
486 } | 504 } |
487 | 505 |
488 webrtc::IceCandidateInterface* | 506 webrtc::IceCandidateInterface* |
489 MockMediaStreamDependencyFactory::CreateIceCandidate( | 507 MockMediaStreamDependencyFactory::CreateIceCandidate( |
490 const std::string& sdp_mid, | 508 const std::string& sdp_mid, |
491 int sdp_mline_index, | 509 int sdp_mline_index, |
492 const std::string& sdp) { | 510 const std::string& sdp) { |
493 return new MockIceCandidate(sdp_mid, sdp_mline_index, sdp); | 511 return new MockIceCandidate(sdp_mid, sdp_mline_index, sdp); |
494 } | 512 } |
495 | 513 |
496 } // namespace content | 514 } // namespace content |
OLD | NEW |