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

Unified Diff: webrtc/audio/audio_send_stream_unittest.cc

Issue 2165743003: Variable audio bitrate. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase Created 4 years, 5 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/audio/audio_send_stream.cc ('k') | webrtc/audio_send_stream.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ea70d304d79acb3e7526b3caf01dcd4f5d8d1a90..7f940fc767f85e4d6f391308d84a7e6213ce1eda 100644
--- a/webrtc/audio/audio_send_stream_unittest.cc
+++ b/webrtc/audio/audio_send_stream_unittest.cc
@@ -50,6 +50,13 @@ const int kTelephoneEventPayloadType = 123;
const int kTelephoneEventCode = 45;
const int kTelephoneEventDuration = 6789;
+class MockLimitObserver : public BitrateAllocator::LimitObserver {
+ public:
+ MOCK_METHOD2(OnAllocationLimitsChanged,
+ void(uint32_t min_send_bitrate_bps,
+ uint32_t max_padding_bitrate_bps));
+};
+
struct ConfigHelper {
ConfigHelper()
: simulated_clock_(123456),
@@ -57,7 +64,8 @@ struct ConfigHelper {
congestion_controller_(&simulated_clock_,
&bitrate_observer_,
&remote_bitrate_observer_,
- &event_log_) {
+ &event_log_),
+ bitrate_allocator_(&limit_observer_) {
using testing::Invoke;
using testing::StrEq;
@@ -116,6 +124,7 @@ struct ConfigHelper {
CongestionController* congestion_controller() {
return &congestion_controller_;
}
+ BitrateAllocator* bitrate_allocator() { return &bitrate_allocator_; }
void SetupMockForSendTelephoneEvent() {
EXPECT_TRUE(channel_proxy_);
@@ -170,6 +179,8 @@ struct ConfigHelper {
testing::NiceMock<MockRemoteBitrateObserver> remote_bitrate_observer_;
CongestionController congestion_controller_;
MockRtcEventLog event_log_;
+ testing::NiceMock<MockLimitObserver> limit_observer_;
+ BitrateAllocator bitrate_allocator_;
};
} // namespace
@@ -192,13 +203,15 @@ TEST(AudioSendStreamTest, ConfigToString) {
TEST(AudioSendStreamTest, ConstructDestruct) {
ConfigHelper helper;
internal::AudioSendStream send_stream(helper.config(), helper.audio_state(),
- helper.congestion_controller());
+ helper.congestion_controller(),
+ helper.bitrate_allocator());
}
TEST(AudioSendStreamTest, SendTelephoneEvent) {
ConfigHelper helper;
internal::AudioSendStream send_stream(helper.config(), helper.audio_state(),
- helper.congestion_controller());
+ helper.congestion_controller(),
+ helper.bitrate_allocator());
helper.SetupMockForSendTelephoneEvent();
EXPECT_TRUE(send_stream.SendTelephoneEvent(kTelephoneEventPayloadType,
kTelephoneEventCode, kTelephoneEventDuration));
@@ -207,7 +220,8 @@ TEST(AudioSendStreamTest, SendTelephoneEvent) {
TEST(AudioSendStreamTest, SetMuted) {
ConfigHelper helper;
internal::AudioSendStream send_stream(helper.config(), helper.audio_state(),
- helper.congestion_controller());
+ helper.congestion_controller(),
+ helper.bitrate_allocator());
EXPECT_CALL(*helper.channel_proxy(), SetInputMute(true));
send_stream.SetMuted(true);
}
@@ -215,7 +229,8 @@ TEST(AudioSendStreamTest, SetMuted) {
TEST(AudioSendStreamTest, GetStats) {
ConfigHelper helper;
internal::AudioSendStream send_stream(helper.config(), helper.audio_state(),
- helper.congestion_controller());
+ helper.congestion_controller(),
+ helper.bitrate_allocator());
helper.SetupMockForGetStats();
AudioSendStream::Stats stats = send_stream.GetStats();
EXPECT_EQ(kSsrc, stats.local_ssrc);
@@ -243,7 +258,8 @@ TEST(AudioSendStreamTest, GetStats) {
TEST(AudioSendStreamTest, GetStatsTypingNoiseDetected) {
ConfigHelper helper;
internal::AudioSendStream send_stream(helper.config(), helper.audio_state(),
- helper.congestion_controller());
+ helper.congestion_controller(),
+ helper.bitrate_allocator());
helper.SetupMockForGetStats();
EXPECT_FALSE(send_stream.GetStats().typing_noise_detected);
« no previous file with comments | « webrtc/audio/audio_send_stream.cc ('k') | webrtc/audio_send_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698