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

Unified Diff: webrtc/voice_engine/test/auto_test/voe_conference_test.cc

Issue 1236793003: Add LoudestFilter in ConferenceTransport (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 4 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
Index: webrtc/voice_engine/test/auto_test/voe_conference_test.cc
diff --git a/webrtc/voice_engine/test/auto_test/voe_conference_test.cc b/webrtc/voice_engine/test/auto_test/voe_conference_test.cc
index 20a74b46b0880147edae791ffc36161b5be8fae6..caadae8cbdc97659c5c73dfeab42dc733cc52dac 100644
--- a/webrtc/voice_engine/test/auto_test/voe_conference_test.cc
+++ b/webrtc/voice_engine/test/auto_test/voe_conference_test.cc
@@ -14,6 +14,7 @@
#include "webrtc/base/format_macros.h"
#include "webrtc/base/timeutils.h"
#include "webrtc/system_wrappers/interface/sleep.h"
+#include "webrtc/test/testsupport/fileutils.h"
#include "webrtc/voice_engine/test/auto_test/fakes/conference_transport.h"
namespace {
@@ -27,6 +28,10 @@ namespace {
namespace voetest {
TEST(VoeConferenceTest, RttAndStartNtpTime) {
+ const std::string kInputFileName =
Andrew MacDonald 2015/08/05 16:37:07 nit: not a compile-time const.
minyue-webrtc 2015/08/06 13:31:22 Done.
minyue-webrtc 2015/08/06 14:57:14 Hi Andrew, Per offline talk with Tina, I think I
Andrew MacDonald 2015/08/13 19:48:11 Right, it's not a compile-time const (i.e. can onl
+ webrtc::test::ResourcePath("audio_coding/testfile32kHz", "pcm");
+ const webrtc::FileFormats kInputFormat = webrtc::kFileFormatPcm32kHzFile;
+
struct Stats {
Stats(int64_t rtt_receiver_1, int64_t rtt_receiver_2, int64_t ntp_delay)
: rtt_receiver_1_(rtt_receiver_1),
@@ -42,8 +47,8 @@ TEST(VoeConferenceTest, RttAndStartNtpTime) {
ConferenceTransport trans;
trans.SetRtt(kRttMs);
- unsigned int id_1 = trans.AddStream();
- unsigned int id_2 = trans.AddStream();
+ unsigned int id_1 = trans.AddStream(kInputFileName, kInputFormat);
+ unsigned int id_2 = trans.AddStream(kInputFileName, kInputFormat);
EXPECT_TRUE(trans.StartPlayout(id_1));
// Start NTP time is the time when a stream is played out, rather than
@@ -105,4 +110,46 @@ TEST(VoeConferenceTest, RttAndStartNtpTime) {
}
}
}
+
+
+TEST(VoeConferenceTest, ReceivedPackets) {
+ const std::string kInputFileName =
+ webrtc::test::ResourcePath("audio_coding/testfile32kHz", "pcm");
+ const webrtc::FileFormats kInputFormat = webrtc::kFileFormatPcm32kHzFile;
+ const int kPackets = 50;
+ const int kPacketDurationMs = 20; // Correspond to Opus.
+
+ ConferenceTransport trans;
+ // Add silence to stream 0, so that it will be filtered out.
+ unsigned int id_0 = trans.AddStream(
+ webrtc::test::ResourcePath("audio_coding/silence", "pcm"),
+ kInputFormat);
+ unsigned int id_1 = trans.AddStream(kInputFileName, kInputFormat);
+ unsigned int id_2 = trans.AddStream(kInputFileName, kInputFormat);
+ unsigned int id_3 = trans.AddStream(kInputFileName, kInputFormat);
+
+ EXPECT_TRUE(trans.StartPlayout(id_0));
+ EXPECT_TRUE(trans.StartPlayout(id_1));
+ EXPECT_TRUE(trans.StartPlayout(id_2));
+ EXPECT_TRUE(trans.StartPlayout(id_3));
+
+ webrtc::SleepMs(kPacketDurationMs * kPackets);
+
+ webrtc::CallStatistics stats_0;
+ webrtc::CallStatistics stats_1;
+ webrtc::CallStatistics stats_2;
+ webrtc::CallStatistics stats_3;
+ EXPECT_TRUE(trans.GetReceiverStatistics(id_0, &stats_0));
+ EXPECT_TRUE(trans.GetReceiverStatistics(id_1, &stats_1));
+ EXPECT_TRUE(trans.GetReceiverStatistics(id_2, &stats_2));
+ EXPECT_TRUE(trans.GetReceiverStatistics(id_3, &stats_3));
+
+ // Cannot be accurate since stream 0 started the earliest.
tlegrand-webrtc 2015/08/05 13:32:44 Can you explain this comment? I'm not following.
minyue-webrtc 2015/08/06 13:31:22 I have updated the comments.
tlegrand-webrtc 2015/08/06 14:51:55 Acknowledged.
+ EXPECT_NEAR(stats_0.packetsReceived, 0, 2);
+ // Cannot be accurate since it replies on the sleep timer.
+ EXPECT_NEAR(stats_1.packetsReceived, kPackets, 2);
+ EXPECT_NEAR(stats_2.packetsReceived, kPackets, 2);
+ EXPECT_NEAR(stats_3.packetsReceived, kPackets, 2);
+}
+
} // namespace voetest

Powered by Google App Engine
This is Rietveld 408576698