OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 #include <functional> | 10 #include <functional> |
11 #include <list> | 11 #include <list> |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 | 15 |
| 16 #include "webrtc/audio_state.h" |
16 #include "webrtc/base/checks.h" | 17 #include "webrtc/base/checks.h" |
17 #include "webrtc/base/scoped_ptr.h" | 18 #include "webrtc/base/scoped_ptr.h" |
18 #include "webrtc/base/thread_annotations.h" | 19 #include "webrtc/base/thread_annotations.h" |
19 #include "webrtc/call.h" | 20 #include "webrtc/call.h" |
20 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" | 21 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" |
21 #include "webrtc/system_wrappers/include/event_wrapper.h" | 22 #include "webrtc/system_wrappers/include/event_wrapper.h" |
22 #include "webrtc/system_wrappers/include/trace.h" | 23 #include "webrtc/system_wrappers/include/trace.h" |
23 #include "webrtc/test/call_test.h" | 24 #include "webrtc/test/call_test.h" |
24 #include "webrtc/test/direct_transport.h" | 25 #include "webrtc/test/direct_transport.h" |
25 #include "webrtc/test/encoder_settings.h" | 26 #include "webrtc/test/encoder_settings.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 117 |
117 class BitrateEstimatorTest : public test::CallTest { | 118 class BitrateEstimatorTest : public test::CallTest { |
118 public: | 119 public: |
119 BitrateEstimatorTest() : receive_config_(nullptr) {} | 120 BitrateEstimatorTest() : receive_config_(nullptr) {} |
120 | 121 |
121 virtual ~BitrateEstimatorTest() { | 122 virtual ~BitrateEstimatorTest() { |
122 EXPECT_TRUE(streams_.empty()); | 123 EXPECT_TRUE(streams_.empty()); |
123 } | 124 } |
124 | 125 |
125 virtual void SetUp() { | 126 virtual void SetUp() { |
| 127 AudioState::Config audio_state_config; |
| 128 audio_state_config.voice_engine = &fake_voice_engine_; |
126 Call::Config config; | 129 Call::Config config; |
127 config.voice_engine = &fake_voice_engine_; | 130 config.audio_state = AudioState::Create(audio_state_config); |
128 receiver_call_.reset(Call::Create(config)); | 131 receiver_call_.reset(Call::Create(config)); |
129 sender_call_.reset(Call::Create(config)); | 132 sender_call_.reset(Call::Create(config)); |
130 | 133 |
131 send_transport_.reset(new test::DirectTransport(sender_call_.get())); | 134 send_transport_.reset(new test::DirectTransport(sender_call_.get())); |
132 send_transport_->SetReceiver(receiver_call_->Receiver()); | 135 send_transport_->SetReceiver(receiver_call_->Receiver()); |
133 receive_transport_.reset(new test::DirectTransport(receiver_call_.get())); | 136 receive_transport_.reset(new test::DirectTransport(receiver_call_.get())); |
134 receive_transport_->SetReceiver(sender_call_->Receiver()); | 137 receive_transport_->SetReceiver(sender_call_->Receiver()); |
135 | 138 |
136 send_config_ = VideoSendStream::Config(send_transport_.get()); | 139 send_config_ = VideoSendStream::Config(send_transport_.get()); |
137 send_config_.rtp.ssrcs.push_back(kSendSsrcs[0]); | 140 send_config_.rtp.ssrcs.push_back(kSendSsrcs[0]); |
(...skipping 20 matching lines...) Expand all Loading... |
158 | 161 |
159 send_transport_->StopSending(); | 162 send_transport_->StopSending(); |
160 receive_transport_->StopSending(); | 163 receive_transport_->StopSending(); |
161 | 164 |
162 while (!streams_.empty()) { | 165 while (!streams_.empty()) { |
163 delete streams_.back(); | 166 delete streams_.back(); |
164 streams_.pop_back(); | 167 streams_.pop_back(); |
165 } | 168 } |
166 | 169 |
167 receiver_call_.reset(); | 170 receiver_call_.reset(); |
| 171 sender_call_.reset(); |
168 } | 172 } |
169 | 173 |
170 protected: | 174 protected: |
171 friend class Stream; | 175 friend class Stream; |
172 | 176 |
173 class Stream { | 177 class Stream { |
174 public: | 178 public: |
175 Stream(BitrateEstimatorTest* test, bool receive_audio) | 179 Stream(BitrateEstimatorTest* test, bool receive_audio) |
176 : test_(test), | 180 : test_(test), |
177 is_sending_receiving_(false), | 181 is_sending_receiving_(false), |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 RtpExtension(RtpExtension::kTOffset, kTOFExtensionId); | 361 RtpExtension(RtpExtension::kTOffset, kTOFExtensionId); |
358 receiver_trace_.PushExpectedLogLine( | 362 receiver_trace_.PushExpectedLogLine( |
359 "WrappingBitrateEstimator: Switching to transmission time offset RBE."); | 363 "WrappingBitrateEstimator: Switching to transmission time offset RBE."); |
360 receiver_trace_.PushExpectedLogLine(kSingleStreamLog); | 364 receiver_trace_.PushExpectedLogLine(kSingleStreamLog); |
361 streams_.push_back(new Stream(this, false)); | 365 streams_.push_back(new Stream(this, false)); |
362 streams_[0]->StopSending(); | 366 streams_[0]->StopSending(); |
363 streams_[1]->StopSending(); | 367 streams_[1]->StopSending(); |
364 EXPECT_EQ(kEventSignaled, receiver_trace_.Wait()); | 368 EXPECT_EQ(kEventSignaled, receiver_trace_.Wait()); |
365 } | 369 } |
366 } // namespace webrtc | 370 } // namespace webrtc |
OLD | NEW |