Implement Opus bandwidth adjustment behind a FieldTrial

Bug: webrtc:8522
Change-Id: I3a32ebfecd27ff74b507c2cee9e16aab17153442
Reviewed-on: https://webrtc-review.googlesource.com/22210
Commit-Queue: Alejandro Luebs <aluebs@webrtc.org>
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20799}
This commit is contained in:
Alex Luebs
2017-11-20 11:13:56 -08:00
committed by Commit Bot
parent 64eaa99cfc
commit eeb2765f6c
9 changed files with 368 additions and 3 deletions

View File

@ -81,10 +81,11 @@ float OpusSpeedTest::DecodeABlock(const uint8_t* bit_stream,
return 1000.0 * clocks / CLOCKS_PER_SEC;
}
/* Test audio length in second. */
constexpr size_t kDurationSec = 400;
#define ADD_TEST(complexity) \
TEST_P(OpusSpeedTest, OpusSetComplexityTest##complexity) { \
/* Test audio length in second. */ \
size_t kDurationSec = 400; \
/* Set complexity. */ \
printf("Setting complexity to %d ...\n", complexity); \
EXPECT_EQ(0, WebRtcOpus_SetComplexity(opus_encoder_, complexity)); \
@ -103,6 +104,20 @@ ADD_TEST(2);
ADD_TEST(1);
ADD_TEST(0);
#define ADD_BANDWIDTH_TEST(bandwidth) \
TEST_P(OpusSpeedTest, OpusSetBandwidthTest##bandwidth) { \
/* Set bandwidth. */ \
printf("Setting bandwidth to %d ...\n", bandwidth); \
EXPECT_EQ(0, WebRtcOpus_SetBandwidth(opus_encoder_, bandwidth)); \
EncodeDecode(kDurationSec); \
}
ADD_BANDWIDTH_TEST(OPUS_BANDWIDTH_NARROWBAND);
ADD_BANDWIDTH_TEST(OPUS_BANDWIDTH_MEDIUMBAND);
ADD_BANDWIDTH_TEST(OPUS_BANDWIDTH_WIDEBAND);
ADD_BANDWIDTH_TEST(OPUS_BANDWIDTH_SUPERWIDEBAND);
ADD_BANDWIDTH_TEST(OPUS_BANDWIDTH_FULLBAND);
// List all test cases: (channel, bit rat, filename, extension).
const coding_param param_set[] = {
std::make_tuple(1,