| 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/webaudio_capturer_source.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 for (ObserverSet::iterator it = observers_.begin(); it != observers_.end(); | 117 for (ObserverSet::iterator it = observers_.begin(); it != observers_.end(); |
| 118 ++it) { | 118 ++it) { |
| 119 (*it)->OnChanged(); | 119 (*it)->OnChanged(); |
| 120 } | 120 } |
| 121 } | 121 } |
| 122 | 122 |
| 123 MockMediaStream::~MockMediaStream() {} | 123 MockMediaStream::~MockMediaStream() {} |
| 124 | 124 |
| 125 class MockRtcVideoCapturer : public WebRtcVideoCapturerAdapter { | 125 class MockRtcVideoCapturer : public WebRtcVideoCapturerAdapter { |
| 126 public: | 126 public: |
| 127 explicit MockRtcVideoCapturer(bool is_screencast) | 127 MockRtcVideoCapturer( |
| 128 : WebRtcVideoCapturerAdapter(is_screencast), | 128 const scoped_refptr<base::MessageLoopProxy>& worker_thread_proxy, |
| 129 bool is_screencast) |
| 130 : WebRtcVideoCapturerAdapter(worker_thread_proxy, is_screencast), |
| 129 number_of_capturered_frames_(0), | 131 number_of_capturered_frames_(0), |
| 130 width_(0), | 132 width_(0), |
| 131 height_(0) { | 133 height_(0) { |
| 132 } | 134 } |
| 133 | 135 |
| 134 virtual void OnFrameCaptured( | 136 virtual void OnFrameCaptured( |
| 135 const scoped_refptr<media::VideoFrame>& frame) OVERRIDE { | 137 const scoped_refptr<media::VideoFrame>& frame) OVERRIDE { |
| 136 ++number_of_capturered_frames_; | 138 ++number_of_capturered_frames_; |
| 137 width_ = frame->visible_rect().width(); | 139 width_ = frame->visible_rect().width(); |
| 138 height_ = frame->visible_rect().height(); | 140 height_ = frame->visible_rect().height(); |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 MockMediaStreamDependencyFactory::CreateLocalAudioSource( | 452 MockMediaStreamDependencyFactory::CreateLocalAudioSource( |
| 451 const webrtc::MediaConstraintsInterface* constraints) { | 453 const webrtc::MediaConstraintsInterface* constraints) { |
| 452 last_audio_source_ = | 454 last_audio_source_ = |
| 453 new talk_base::RefCountedObject<MockAudioSource>(constraints); | 455 new talk_base::RefCountedObject<MockAudioSource>(constraints); |
| 454 return last_audio_source_; | 456 return last_audio_source_; |
| 455 } | 457 } |
| 456 | 458 |
| 457 WebRtcVideoCapturerAdapter* | 459 WebRtcVideoCapturerAdapter* |
| 458 MockMediaStreamDependencyFactory::CreateVideoCapturer( | 460 MockMediaStreamDependencyFactory::CreateVideoCapturer( |
| 459 bool is_screen_capture) { | 461 bool is_screen_capture) { |
| 460 return new MockRtcVideoCapturer(is_screen_capture); | 462 return new MockRtcVideoCapturer(worker_thread_proxy(), |
| 463 is_screen_capture); |
| 461 } | 464 } |
| 462 | 465 |
| 463 scoped_refptr<webrtc::VideoSourceInterface> | 466 scoped_refptr<webrtc::VideoSourceInterface> |
| 464 MockMediaStreamDependencyFactory::CreateVideoSource( | 467 MockMediaStreamDependencyFactory::CreateVideoSource( |
| 465 cricket::VideoCapturer* capturer, | 468 cricket::VideoCapturer* capturer, |
| 466 const blink::WebMediaConstraints& constraints) { | 469 const blink::WebMediaConstraints& constraints) { |
| 467 last_video_source_ = new talk_base::RefCountedObject<MockVideoSource>(); | 470 last_video_source_ = new talk_base::RefCountedObject<MockVideoSource>(); |
| 468 last_video_source_->SetVideoCapturer(capturer); | 471 last_video_source_->SetVideoCapturer(capturer); |
| 469 return last_video_source_; | 472 return last_video_source_; |
| 470 } | 473 } |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 return WebRtcAudioCapturer::CreateCapturer(-1, device_info, | 535 return WebRtcAudioCapturer::CreateCapturer(-1, device_info, |
| 533 constraints, NULL, audio_source); | 536 constraints, NULL, audio_source); |
| 534 } | 537 } |
| 535 | 538 |
| 536 void MockMediaStreamDependencyFactory::StartLocalAudioTrack( | 539 void MockMediaStreamDependencyFactory::StartLocalAudioTrack( |
| 537 WebRtcLocalAudioTrack* audio_track) { | 540 WebRtcLocalAudioTrack* audio_track) { |
| 538 audio_track->Start(); | 541 audio_track->Start(); |
| 539 } | 542 } |
| 540 | 543 |
| 541 } // namespace content | 544 } // namespace content |
| OLD | NEW |