| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <utility> | 13 #include <utility> |
| 14 | 14 |
| 15 #include "webrtc/api/audiotrack.h" | 15 #include "webrtc/api/audiotrack.h" |
| 16 #include "webrtc/api/fakemediacontroller.h" | 16 #include "webrtc/api/fakemediacontroller.h" |
| 17 #include "webrtc/api/localaudiosource.h" | 17 #include "webrtc/api/localaudiosource.h" |
| 18 #include "webrtc/api/mediastream.h" | 18 #include "webrtc/api/mediastream.h" |
| 19 #include "webrtc/api/remoteaudiosource.h" | 19 #include "webrtc/api/remoteaudiosource.h" |
| 20 #include "webrtc/api/rtpreceiver.h" | 20 #include "webrtc/api/rtpreceiver.h" |
| 21 #include "webrtc/api/rtpsender.h" | 21 #include "webrtc/api/rtpsender.h" |
| 22 #include "webrtc/api/streamcollection.h" | 22 #include "webrtc/api/streamcollection.h" |
| 23 #include "webrtc/api/test/fakevideotracksource.h" | 23 #include "webrtc/api/test/fakevideotracksource.h" |
| 24 #include "webrtc/api/videotrack.h" | 24 #include "webrtc/api/videotrack.h" |
| 25 #include "webrtc/api/videotracksource.h" | 25 #include "webrtc/api/videotracksource.h" |
| 26 #include "webrtc/base/gunit.h" | 26 #include "webrtc/base/gunit.h" |
| 27 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" |
| 27 #include "webrtc/media/base/fakemediaengine.h" | 28 #include "webrtc/media/base/fakemediaengine.h" |
| 28 #include "webrtc/media/base/mediachannel.h" | 29 #include "webrtc/media/base/mediachannel.h" |
| 29 #include "webrtc/media/engine/fakewebrtccall.h" | 30 #include "webrtc/media/engine/fakewebrtccall.h" |
| 30 #include "webrtc/p2p/base/faketransportcontroller.h" | 31 #include "webrtc/p2p/base/faketransportcontroller.h" |
| 31 #include "webrtc/pc/channelmanager.h" | 32 #include "webrtc/pc/channelmanager.h" |
| 32 #include "webrtc/test/gmock.h" | 33 #include "webrtc/test/gmock.h" |
| 33 #include "webrtc/test/gtest.h" | 34 #include "webrtc/test/gtest.h" |
| 34 | 35 |
| 35 using ::testing::_; | 36 using ::testing::_; |
| 36 using ::testing::Exactly; | 37 using ::testing::Exactly; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 49 | 50 |
| 50 class RtpSenderReceiverTest : public testing::Test { | 51 class RtpSenderReceiverTest : public testing::Test { |
| 51 public: | 52 public: |
| 52 RtpSenderReceiverTest() | 53 RtpSenderReceiverTest() |
| 53 : // Create fake media engine/etc. so we can create channels to use to | 54 : // Create fake media engine/etc. so we can create channels to use to |
| 54 // test RtpSenders/RtpReceivers. | 55 // test RtpSenders/RtpReceivers. |
| 55 media_engine_(new cricket::FakeMediaEngine()), | 56 media_engine_(new cricket::FakeMediaEngine()), |
| 56 channel_manager_(media_engine_, | 57 channel_manager_(media_engine_, |
| 57 rtc::Thread::Current(), | 58 rtc::Thread::Current(), |
| 58 rtc::Thread::Current()), | 59 rtc::Thread::Current()), |
| 59 fake_call_(webrtc::Call::Config()), | 60 fake_call_(Call::Config(&event_log_)), |
| 60 fake_media_controller_(&channel_manager_, &fake_call_), | 61 fake_media_controller_(&channel_manager_, &fake_call_), |
| 61 stream_(MediaStream::Create(kStreamLabel1)) { | 62 stream_(MediaStream::Create(kStreamLabel1)) { |
| 62 // Create channels to be used by the RtpSenders and RtpReceivers. | 63 // Create channels to be used by the RtpSenders and RtpReceivers. |
| 63 channel_manager_.Init(); | 64 channel_manager_.Init(); |
| 64 voice_channel_ = channel_manager_.CreateVoiceChannel( | 65 voice_channel_ = channel_manager_.CreateVoiceChannel( |
| 65 &fake_media_controller_, &fake_transport_controller_, cricket::CN_AUDIO, | 66 &fake_media_controller_, &fake_transport_controller_, cricket::CN_AUDIO, |
| 66 nullptr, false, cricket::AudioOptions()); | 67 nullptr, false, cricket::AudioOptions()); |
| 67 video_channel_ = channel_manager_.CreateVideoChannel( | 68 video_channel_ = channel_manager_.CreateVideoChannel( |
| 68 &fake_media_controller_, &fake_transport_controller_, cricket::CN_VIDEO, | 69 &fake_media_controller_, &fake_transport_controller_, cricket::CN_VIDEO, |
| 69 nullptr, false, cricket::VideoOptions()); | 70 nullptr, false, cricket::VideoOptions()); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 EXPECT_TRUE(voice_media_channel_->GetOutputVolume(kAudioSsrc, &volume)); | 212 EXPECT_TRUE(voice_media_channel_->GetOutputVolume(kAudioSsrc, &volume)); |
| 212 EXPECT_EQ(0, volume); | 213 EXPECT_EQ(0, volume); |
| 213 } | 214 } |
| 214 | 215 |
| 215 void VerifyVideoChannelNoOutput() { | 216 void VerifyVideoChannelNoOutput() { |
| 216 // Verify that the media channel's sink is reset. | 217 // Verify that the media channel's sink is reset. |
| 217 EXPECT_FALSE(video_media_channel_->HasSink(kVideoSsrc)); | 218 EXPECT_FALSE(video_media_channel_->HasSink(kVideoSsrc)); |
| 218 } | 219 } |
| 219 | 220 |
| 220 protected: | 221 protected: |
| 222 webrtc::RtcEventLogNullImpl event_log_; |
| 221 cricket::FakeMediaEngine* media_engine_; | 223 cricket::FakeMediaEngine* media_engine_; |
| 222 cricket::FakeTransportController fake_transport_controller_; | 224 cricket::FakeTransportController fake_transport_controller_; |
| 223 cricket::ChannelManager channel_manager_; | 225 cricket::ChannelManager channel_manager_; |
| 224 cricket::FakeCall fake_call_; | 226 cricket::FakeCall fake_call_; |
| 225 cricket::FakeMediaController fake_media_controller_; | 227 cricket::FakeMediaController fake_media_controller_; |
| 226 cricket::VoiceChannel* voice_channel_; | 228 cricket::VoiceChannel* voice_channel_; |
| 227 cricket::VideoChannel* video_channel_; | 229 cricket::VideoChannel* video_channel_; |
| 228 cricket::FakeVoiceMediaChannel* voice_media_channel_; | 230 cricket::FakeVoiceMediaChannel* voice_media_channel_; |
| 229 cricket::FakeVideoMediaChannel* video_media_channel_; | 231 cricket::FakeVideoMediaChannel* video_media_channel_; |
| 230 rtc::scoped_refptr<AudioRtpSender> audio_rtp_sender_; | 232 rtc::scoped_refptr<AudioRtpSender> audio_rtp_sender_; |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 CreateVideoRtpReceiver(); | 613 CreateVideoRtpReceiver(); |
| 612 | 614 |
| 613 RtpParameters params = video_rtp_receiver_->GetParameters(); | 615 RtpParameters params = video_rtp_receiver_->GetParameters(); |
| 614 EXPECT_EQ(1u, params.encodings.size()); | 616 EXPECT_EQ(1u, params.encodings.size()); |
| 615 EXPECT_TRUE(video_rtp_receiver_->SetParameters(params)); | 617 EXPECT_TRUE(video_rtp_receiver_->SetParameters(params)); |
| 616 | 618 |
| 617 DestroyVideoRtpReceiver(); | 619 DestroyVideoRtpReceiver(); |
| 618 } | 620 } |
| 619 | 621 |
| 620 } // namespace webrtc | 622 } // namespace webrtc |
| OLD | NEW |