Reformat the WebRTC code base
Running clang-format with chromium's style guide. The goal is n-fold: * providing consistency and readability (that's what code guidelines are for) * preventing noise with presubmit checks and git cl format * building on the previous point: making it easier to automatically fix format issues * you name it Please consider using git-hyper-blame to ignore this commit. Bug: webrtc:9340 Change-Id: I694567c4cdf8cee2860958cfe82bfaf25848bb87 Reviewed-on: https://webrtc-review.googlesource.com/81185 Reviewed-by: Patrik Höglund <phoglund@webrtc.org> Cr-Commit-Position: refs/heads/master@{#23660}
This commit is contained in:
@ -23,9 +23,12 @@ class OpusSpeedTest : public AudioCodecSpeedTest {
|
||||
OpusSpeedTest();
|
||||
void SetUp() override;
|
||||
void TearDown() override;
|
||||
float EncodeABlock(int16_t* in_data, uint8_t* bit_stream,
|
||||
size_t max_bytes, size_t* encoded_bytes) override;
|
||||
float DecodeABlock(const uint8_t* bit_stream, size_t encoded_bytes,
|
||||
float EncodeABlock(int16_t* in_data,
|
||||
uint8_t* bit_stream,
|
||||
size_t max_bytes,
|
||||
size_t* encoded_bytes) override;
|
||||
float DecodeABlock(const uint8_t* bit_stream,
|
||||
size_t encoded_bytes,
|
||||
int16_t* out_data) override;
|
||||
WebRtcOpusEncInst* opus_encoder_;
|
||||
WebRtcOpusDecInst* opus_decoder_;
|
||||
@ -36,8 +39,7 @@ OpusSpeedTest::OpusSpeedTest()
|
||||
kOpusSamplingKhz,
|
||||
kOpusSamplingKhz),
|
||||
opus_encoder_(NULL),
|
||||
opus_decoder_(NULL) {
|
||||
}
|
||||
opus_decoder_(NULL) {}
|
||||
|
||||
void OpusSpeedTest::SetUp() {
|
||||
AudioCodecSpeedTest::SetUp();
|
||||
@ -57,12 +59,13 @@ void OpusSpeedTest::TearDown() {
|
||||
EXPECT_EQ(0, WebRtcOpus_DecoderFree(opus_decoder_));
|
||||
}
|
||||
|
||||
float OpusSpeedTest::EncodeABlock(int16_t* in_data, uint8_t* bit_stream,
|
||||
size_t max_bytes, size_t* encoded_bytes) {
|
||||
float OpusSpeedTest::EncodeABlock(int16_t* in_data,
|
||||
uint8_t* bit_stream,
|
||||
size_t max_bytes,
|
||||
size_t* encoded_bytes) {
|
||||
clock_t clocks = clock();
|
||||
int value = WebRtcOpus_Encode(opus_encoder_, in_data,
|
||||
input_length_sample_, max_bytes,
|
||||
bit_stream);
|
||||
int value = WebRtcOpus_Encode(opus_encoder_, in_data, input_length_sample_,
|
||||
max_bytes, bit_stream);
|
||||
clocks = clock() - clocks;
|
||||
EXPECT_GT(value, 0);
|
||||
*encoded_bytes = static_cast<size_t>(value);
|
||||
@ -70,7 +73,8 @@ float OpusSpeedTest::EncodeABlock(int16_t* in_data, uint8_t* bit_stream,
|
||||
}
|
||||
|
||||
float OpusSpeedTest::DecodeABlock(const uint8_t* bit_stream,
|
||||
size_t encoded_bytes, int16_t* out_data) {
|
||||
size_t encoded_bytes,
|
||||
int16_t* out_data) {
|
||||
int value;
|
||||
int16_t audio_type;
|
||||
clock_t clocks = clock();
|
||||
@ -84,13 +88,13 @@ float OpusSpeedTest::DecodeABlock(const uint8_t* bit_stream,
|
||||
/* Test audio length in second. */
|
||||
constexpr size_t kDurationSec = 400;
|
||||
|
||||
#define ADD_TEST(complexity) \
|
||||
TEST_P(OpusSpeedTest, OpusSetComplexityTest##complexity) { \
|
||||
/* Set complexity. */ \
|
||||
printf("Setting complexity to %d ...\n", complexity); \
|
||||
EXPECT_EQ(0, WebRtcOpus_SetComplexity(opus_encoder_, complexity)); \
|
||||
EncodeDecode(kDurationSec); \
|
||||
}
|
||||
#define ADD_TEST(complexity) \
|
||||
TEST_P(OpusSpeedTest, OpusSetComplexityTest##complexity) { \
|
||||
/* Set complexity. */ \
|
||||
printf("Setting complexity to %d ...\n", complexity); \
|
||||
EXPECT_EQ(0, WebRtcOpus_SetComplexity(opus_encoder_, complexity)); \
|
||||
EncodeDecode(kDurationSec); \
|
||||
}
|
||||
|
||||
ADD_TEST(10);
|
||||
ADD_TEST(9);
|
||||
@ -136,7 +140,6 @@ const coding_param param_set[] = {
|
||||
string("pcm"),
|
||||
true)};
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(AllTest, OpusSpeedTest,
|
||||
::testing::ValuesIn(param_set));
|
||||
INSTANTIATE_TEST_CASE_P(AllTest, OpusSpeedTest, ::testing::ValuesIn(param_set));
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
Reference in New Issue
Block a user