Index: webrtc/audio/audio_send_stream_unittest.cc |
diff --git a/webrtc/audio/audio_send_stream_unittest.cc b/webrtc/audio/audio_send_stream_unittest.cc |
index eed97c7fa0f2015a5256a7ac2ef05327b32dd44b..17bf80a8093189d313630298615e7c03434f9b26 100644 |
--- a/webrtc/audio/audio_send_stream_unittest.cc |
+++ b/webrtc/audio/audio_send_stream_unittest.cc |
@@ -13,8 +13,11 @@ |
#include "webrtc/audio/audio_send_stream.h" |
#include "webrtc/audio/audio_state.h" |
#include "webrtc/audio/conversion.h" |
+#include "webrtc/call/congestion_controller.h" |
+#include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" |
#include "webrtc/test/mock_voe_channel_proxy.h" |
#include "webrtc/test/mock_voice_engine.h" |
+#include "webrtc/video_engine/call_stats.h" |
the sun
2015/11/30 12:37:20
Should call_stats be moved to webrtc/call?
stefan-webrtc
2015/11/30 15:22:02
Yes, it definitely should. I plan on doing that se
the sun
2015/12/01 10:25:35
Acknowledged.
|
namespace webrtc { |
namespace test { |
@@ -38,6 +41,13 @@ const CallStatistics kCallStats = { |
const CodecInst kCodecInst = {-121, "codec_name_send", 48000, -231, -451, -671}; |
const ReportBlock kReportBlock = {456, 780, 123, 567, 890, 132, 143, 13354}; |
+class NullBitrateObserver : public BitrateObserver { |
+ public: |
+ virtual void OnNetworkChanged(uint32_t bitrate_bps, |
+ uint8_t fraction_loss, |
+ int64_t rtt_ms) {} |
+}; |
+ |
struct ConfigHelper { |
ConfigHelper() : stream_config_(nullptr) { |
using testing::Invoke; |
@@ -62,6 +72,11 @@ struct ConfigHelper { |
SetSendAbsoluteSenderTimeStatus(true, kAbsSendTimeId)).Times(1); |
EXPECT_CALL(*channel_proxy_, |
SetSendAudioLevelIndicationStatus(true, kAudioLevelId)).Times(1); |
the sun
2015/11/30 12:37:20
You're missing an EXPECT_CALL(*channel_proxy, SetS
stefan-webrtc
2015/11/30 15:22:02
Done.
|
+ EXPECT_CALL(*channel_proxy_, SetCongestionControlObjects(_, _, _)) |
the sun
2015/11/30 12:37:20
By moving the common config stuff in here you coul
stefan-webrtc
2015/11/30 15:22:02
Done.
|
+ .Times(1); |
+ EXPECT_CALL(*channel_proxy_, |
+ SetCongestionControlObjects(nullptr, nullptr, nullptr)) |
+ .Times(1); |
return channel_proxy_; |
})); |
stream_config_.voe_channel_id = kChannelId; |
@@ -136,12 +151,26 @@ TEST(AudioSendStreamTest, ConfigToString) { |
TEST(AudioSendStreamTest, ConstructDestruct) { |
ConfigHelper helper; |
- internal::AudioSendStream send_stream(helper.config(), helper.audio_state()); |
+ rtc::scoped_ptr<ProcessThread> thread( |
the sun
2015/11/30 12:37:20
Put the common configuration stuff in ConfigHelper
stefan-webrtc
2015/11/30 15:22:02
Done.
|
+ ProcessThread::Create("AudioTestThread")); |
+ CallStats call_stats; |
+ NullBitrateObserver bitrate_observer; |
+ CongestionController congestion_controller(thread.get(), &call_stats, |
+ &bitrate_observer); |
+ internal::AudioSendStream send_stream(helper.config(), helper.audio_state(), |
+ &congestion_controller); |
} |
TEST(AudioSendStreamTest, GetStats) { |
ConfigHelper helper; |
- internal::AudioSendStream send_stream(helper.config(), helper.audio_state()); |
+ rtc::scoped_ptr<ProcessThread> thread( |
+ ProcessThread::Create("AudioTestThread")); |
+ CallStats call_stats; |
+ NullBitrateObserver bitrate_observer; |
+ CongestionController congestion_controller(thread.get(), &call_stats, |
+ &bitrate_observer); |
+ internal::AudioSendStream send_stream(helper.config(), helper.audio_state(), |
+ &congestion_controller); |
helper.SetupMockForGetStats(); |
AudioSendStream::Stats stats = send_stream.GetStats(); |
EXPECT_EQ(kSsrc, stats.local_ssrc); |
@@ -168,7 +197,14 @@ TEST(AudioSendStreamTest, GetStats) { |
TEST(AudioSendStreamTest, GetStatsTypingNoiseDetected) { |
ConfigHelper helper; |
- internal::AudioSendStream send_stream(helper.config(), helper.audio_state()); |
+ rtc::scoped_ptr<ProcessThread> thread( |
+ ProcessThread::Create("AudioTestThread")); |
+ CallStats call_stats; |
+ NullBitrateObserver bitrate_observer; |
+ CongestionController congestion_controller(thread.get(), &call_stats, |
+ &bitrate_observer); |
+ internal::AudioSendStream send_stream(helper.config(), helper.audio_state(), |
+ &congestion_controller); |
helper.SetupMockForGetStats(); |
EXPECT_FALSE(send_stream.GetStats().typing_noise_detected); |