Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(254)

Side by Side Diff: webrtc/call/bitrate_estimator_tests.cc

Issue 1403363003: Move VoiceEngineObserver into AudioSendStream so that we detect typing noises and return properly i… (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: that's all folks! (incl rebase), or is it? Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/call.h ('k') | webrtc/call/call.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 static const int kTOFExtensionId = 4; 111 static const int kTOFExtensionId = 4;
111 static const int kASTExtensionId = 5; 112 static const int kASTExtensionId = 5;
112 113
113 class BitrateEstimatorTest : public test::CallTest { 114 class BitrateEstimatorTest : public test::CallTest {
114 public: 115 public:
115 BitrateEstimatorTest() : receive_config_(nullptr) {} 116 BitrateEstimatorTest() : receive_config_(nullptr) {}
116 117
117 virtual ~BitrateEstimatorTest() { EXPECT_TRUE(streams_.empty()); } 118 virtual ~BitrateEstimatorTest() { EXPECT_TRUE(streams_.empty()); }
118 119
119 virtual void SetUp() { 120 virtual void SetUp() {
121 EXPECT_CALL(mock_voice_engine_,
122 RegisterVoiceEngineObserver(testing::_)).WillOnce(testing::Return(0));
123 EXPECT_CALL(mock_voice_engine_,
124 DeRegisterVoiceEngineObserver()).WillOnce(testing::Return(0));
120 EXPECT_CALL(mock_voice_engine_, GetEventLog()) 125 EXPECT_CALL(mock_voice_engine_, GetEventLog())
121 .WillRepeatedly(testing::Return(nullptr)); 126 .WillRepeatedly(testing::Return(nullptr));
122 127
128 AudioState::Config audio_state_config;
129 audio_state_config.voice_engine = &mock_voice_engine_;
123 Call::Config config; 130 Call::Config config;
124 config.voice_engine = &mock_voice_engine_; 131 config.audio_state = AudioState::Create(audio_state_config);
125 receiver_call_.reset(Call::Create(config)); 132 receiver_call_.reset(Call::Create(config));
126 sender_call_.reset(Call::Create(config)); 133 sender_call_.reset(Call::Create(config));
127 134
128 send_transport_.reset(new test::DirectTransport(sender_call_.get())); 135 send_transport_.reset(new test::DirectTransport(sender_call_.get()));
129 send_transport_->SetReceiver(receiver_call_->Receiver()); 136 send_transport_->SetReceiver(receiver_call_->Receiver());
130 receive_transport_.reset(new test::DirectTransport(receiver_call_.get())); 137 receive_transport_.reset(new test::DirectTransport(receiver_call_.get()));
131 receive_transport_->SetReceiver(sender_call_->Receiver()); 138 receive_transport_->SetReceiver(sender_call_->Receiver());
132 139
133 send_config_ = VideoSendStream::Config(send_transport_.get()); 140 send_config_ = VideoSendStream::Config(send_transport_.get());
134 send_config_.rtp.ssrcs.push_back(kSendSsrcs[0]); 141 send_config_.rtp.ssrcs.push_back(kSendSsrcs[0]);
(...skipping 20 matching lines...) Expand all
155 162
156 send_transport_->StopSending(); 163 send_transport_->StopSending();
157 receive_transport_->StopSending(); 164 receive_transport_->StopSending();
158 165
159 while (!streams_.empty()) { 166 while (!streams_.empty()) {
160 delete streams_.back(); 167 delete streams_.back();
161 streams_.pop_back(); 168 streams_.pop_back();
162 } 169 }
163 170
164 receiver_call_.reset(); 171 receiver_call_.reset();
172 sender_call_.reset();
165 } 173 }
166 174
167 protected: 175 protected:
168 friend class Stream; 176 friend class Stream;
169 177
170 class Stream { 178 class Stream {
171 public: 179 public:
172 Stream(BitrateEstimatorTest* test, bool receive_audio) 180 Stream(BitrateEstimatorTest* test, bool receive_audio)
173 : test_(test), 181 : test_(test),
174 is_sending_receiving_(false), 182 is_sending_receiving_(false),
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 RtpExtension(RtpExtension::kTOffset, kTOFExtensionId); 360 RtpExtension(RtpExtension::kTOffset, kTOFExtensionId);
353 receiver_trace_.PushExpectedLogLine( 361 receiver_trace_.PushExpectedLogLine(
354 "WrappingBitrateEstimator: Switching to transmission time offset RBE."); 362 "WrappingBitrateEstimator: Switching to transmission time offset RBE.");
355 receiver_trace_.PushExpectedLogLine(kSingleStreamLog); 363 receiver_trace_.PushExpectedLogLine(kSingleStreamLog);
356 streams_.push_back(new Stream(this, false)); 364 streams_.push_back(new Stream(this, false));
357 streams_[0]->StopSending(); 365 streams_[0]->StopSending();
358 streams_[1]->StopSending(); 366 streams_[1]->StopSending();
359 EXPECT_EQ(kEventSignaled, receiver_trace_.Wait()); 367 EXPECT_EQ(kEventSignaled, receiver_trace_.Wait());
360 } 368 }
361 } // namespace webrtc 369 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/call.h ('k') | webrtc/call/call.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698