| OLD | NEW |
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
| 9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | 23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
| 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
| 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 26 */ | 26 */ |
| 27 | 27 |
| 28 #include <string> | 28 #include <string> |
| 29 | 29 |
| 30 #include "talk/app/webrtc/audiotrack.h" | 30 #include "talk/app/webrtc/audiotrack.h" |
| 31 #include "talk/app/webrtc/mediastream.h" | 31 #include "talk/app/webrtc/mediastream.h" |
| 32 #include "talk/app/webrtc/remoteaudiosource.h" | 32 #include "talk/app/webrtc/remoteaudiosource.h" |
| 33 #include "talk/app/webrtc/remoteaudiotrack.h" |
| 33 #include "talk/app/webrtc/rtpreceiver.h" | 34 #include "talk/app/webrtc/rtpreceiver.h" |
| 34 #include "talk/app/webrtc/rtpsender.h" | 35 #include "talk/app/webrtc/rtpsender.h" |
| 35 #include "talk/app/webrtc/streamcollection.h" | 36 #include "talk/app/webrtc/streamcollection.h" |
| 36 #include "talk/app/webrtc/videosource.h" | 37 #include "talk/app/webrtc/videosource.h" |
| 37 #include "talk/app/webrtc/videotrack.h" | 38 #include "talk/app/webrtc/videotrack.h" |
| 38 #include "talk/media/base/fakevideocapturer.h" | 39 #include "talk/media/base/fakevideocapturer.h" |
| 39 #include "talk/media/base/mediachannel.h" | 40 #include "talk/media/base/mediachannel.h" |
| 40 #include "testing/gmock/include/gmock/gmock.h" | 41 #include "testing/gmock/include/gmock/gmock.h" |
| 41 #include "testing/gtest/include/gtest/gtest.h" | 42 #include "testing/gtest/include/gtest/gtest.h" |
| 42 #include "webrtc/base/gunit.h" | 43 #include "webrtc/base/gunit.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 60 virtual ~MockAudioProvider() {} | 61 virtual ~MockAudioProvider() {} |
| 61 MOCK_METHOD2(SetAudioPlayout, | 62 MOCK_METHOD2(SetAudioPlayout, |
| 62 void(uint32_t ssrc, | 63 void(uint32_t ssrc, |
| 63 bool enable)); | 64 bool enable)); |
| 64 MOCK_METHOD4(SetAudioSend, | 65 MOCK_METHOD4(SetAudioSend, |
| 65 void(uint32_t ssrc, | 66 void(uint32_t ssrc, |
| 66 bool enable, | 67 bool enable, |
| 67 const cricket::AudioOptions& options, | 68 const cricket::AudioOptions& options, |
| 68 cricket::AudioRenderer* renderer)); | 69 cricket::AudioRenderer* renderer)); |
| 69 MOCK_METHOD2(SetAudioPlayoutVolume, void(uint32_t ssrc, double volume)); | 70 MOCK_METHOD2(SetAudioPlayoutVolume, void(uint32_t ssrc, double volume)); |
| 71 MOCK_METHOD2(SetRawAudioSink, void(uint32_t, cricket::AudioRenderer::Sink*)); |
| 70 }; | 72 }; |
| 71 | 73 |
| 72 // Helper class to test RtpSender/RtpReceiver. | 74 // Helper class to test RtpSender/RtpReceiver. |
| 73 class MockVideoProvider : public VideoProviderInterface { | 75 class MockVideoProvider : public VideoProviderInterface { |
| 74 public: | 76 public: |
| 75 virtual ~MockVideoProvider() {} | 77 virtual ~MockVideoProvider() {} |
| 76 MOCK_METHOD2(SetCaptureDevice, | 78 MOCK_METHOD2(SetCaptureDevice, |
| 77 bool(uint32_t ssrc, cricket::VideoCapturer* camera)); | 79 bool(uint32_t ssrc, cricket::VideoCapturer* camera)); |
| 78 MOCK_METHOD3(SetVideoPlayout, | 80 MOCK_METHOD3(SetVideoPlayout, |
| 79 void(uint32_t ssrc, | 81 void(uint32_t ssrc, |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 audio_rtp_sender_ = nullptr; | 146 audio_rtp_sender_ = nullptr; |
| 145 } | 147 } |
| 146 | 148 |
| 147 void DestroyVideoRtpSender() { | 149 void DestroyVideoRtpSender() { |
| 148 EXPECT_CALL(video_provider_, SetCaptureDevice(kVideoSsrc, NULL)).Times(1); | 150 EXPECT_CALL(video_provider_, SetCaptureDevice(kVideoSsrc, NULL)).Times(1); |
| 149 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc, false, _)).Times(1); | 151 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc, false, _)).Times(1); |
| 150 video_rtp_sender_ = nullptr; | 152 video_rtp_sender_ = nullptr; |
| 151 } | 153 } |
| 152 | 154 |
| 153 void CreateAudioRtpReceiver() { | 155 void CreateAudioRtpReceiver() { |
| 154 audio_track_ = | 156 audio_track_ = RemoteAudioTrack::Create( |
| 155 AudioTrack::Create(kAudioTrackId, RemoteAudioSource::Create().get()); | 157 kAudioTrackId, RemoteAudioSource::Create(kAudioSsrc, &audio_provider_)); |
| 156 EXPECT_TRUE(stream_->AddTrack(audio_track_)); | 158 EXPECT_TRUE(stream_->AddTrack(audio_track_)); |
| 157 EXPECT_CALL(audio_provider_, SetAudioPlayout(kAudioSsrc, true)); | 159 EXPECT_CALL(audio_provider_, SetAudioPlayout(kAudioSsrc, true)); |
| 158 audio_rtp_receiver_ = new AudioRtpReceiver(stream_->GetAudioTracks()[0], | 160 audio_rtp_receiver_ = new AudioRtpReceiver(stream_->GetAudioTracks()[0], |
| 159 kAudioSsrc, &audio_provider_); | 161 kAudioSsrc, &audio_provider_); |
| 160 } | 162 } |
| 161 | 163 |
| 162 void CreateVideoRtpReceiver() { | 164 void CreateVideoRtpReceiver() { |
| 163 EXPECT_CALL(video_provider_, | 165 EXPECT_CALL(video_provider_, |
| 164 SetVideoPlayout(kVideoSsrc, true, | 166 SetVideoPlayout(kVideoSsrc, true, |
| 165 video_track_->GetSource()->FrameInput())); | 167 video_track_->GetSource()->FrameInput())); |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 video_track_->GetSource()->GetVideoCapturer())); | 483 video_track_->GetSource()->GetVideoCapturer())); |
| 482 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc2, true, _)); | 484 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc2, true, _)); |
| 483 sender->SetSsrc(kVideoSsrc2); | 485 sender->SetSsrc(kVideoSsrc2); |
| 484 | 486 |
| 485 // Calls expected from destructor. | 487 // Calls expected from destructor. |
| 486 EXPECT_CALL(video_provider_, SetCaptureDevice(kVideoSsrc2, nullptr)).Times(1); | 488 EXPECT_CALL(video_provider_, SetCaptureDevice(kVideoSsrc2, nullptr)).Times(1); |
| 487 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc2, false, _)).Times(1); | 489 EXPECT_CALL(video_provider_, SetVideoSend(kVideoSsrc2, false, _)).Times(1); |
| 488 } | 490 } |
| 489 | 491 |
| 490 } // namespace webrtc | 492 } // namespace webrtc |
| OLD | NEW |