| Index: webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng_unittest.cc
|
| diff --git a/webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng_unittest.cc b/webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng_unittest.cc
|
| index d16dd3b791a2b708680d4400e6beeab08d8d8cef..a2ab6e8ecbca1225b21b521fbc874bb607295384 100644
|
| --- a/webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng_unittest.cc
|
| +++ b/webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng_unittest.cc
|
| @@ -59,14 +59,14 @@ class AudioEncoderCngTest : public ::testing::Test {
|
| void CreateCng() {
|
| // The config_ parameters may be changed by the TEST_Fs up until CreateCng()
|
| // is called, thus we cannot use the values until now.
|
| - num_audio_samples_10ms_ = 10 * sample_rate_hz_ / 1000;
|
| + num_audio_samples_10ms_ = static_cast<size_t>(10 * sample_rate_hz_ / 1000);
|
| ASSERT_LE(num_audio_samples_10ms_, kMaxNumSamples);
|
| EXPECT_CALL(mock_encoder_, SampleRateHz())
|
| .WillRepeatedly(Return(sample_rate_hz_));
|
| // Max10MsFramesInAPacket() is just used to verify that the SID frame period
|
| // is not too small. The return value does not matter that much, as long as
|
| // it is smaller than 10.
|
| - EXPECT_CALL(mock_encoder_, Max10MsFramesInAPacket()).WillOnce(Return(1));
|
| + EXPECT_CALL(mock_encoder_, Max10MsFramesInAPacket()).WillOnce(Return(1u));
|
| EXPECT_CALL(mock_encoder_, MaxEncodedBytes())
|
| .WillRepeatedly(Return(kMockMaxEncodedBytes));
|
| cng_.reset(new AudioEncoderCng(config_));
|
| @@ -83,10 +83,10 @@ class AudioEncoderCngTest : public ::testing::Test {
|
| // Expect |num_calls| calls to the encoder, all successful. The last call
|
| // claims to have encoded |kMockMaxEncodedBytes| bytes, and all the preceding
|
| // ones 0 bytes.
|
| - void ExpectEncodeCalls(int num_calls) {
|
| + void ExpectEncodeCalls(size_t num_calls) {
|
| InSequence s;
|
| AudioEncoder::EncodedInfo info;
|
| - for (int j = 0; j < num_calls - 1; ++j) {
|
| + for (size_t j = 0; j < num_calls - 1; ++j) {
|
| EXPECT_CALL(mock_encoder_, EncodeInternal(_, _, _, _))
|
| .WillOnce(Return(info));
|
| }
|
| @@ -98,7 +98,7 @@ class AudioEncoderCngTest : public ::testing::Test {
|
| // Verifies that the cng_ object waits until it has collected
|
| // |blocks_per_frame| blocks of audio, and then dispatches all of them to
|
| // the underlying codec (speech or cng).
|
| - void CheckBlockGrouping(int blocks_per_frame, bool active_speech) {
|
| + void CheckBlockGrouping(size_t blocks_per_frame, bool active_speech) {
|
| EXPECT_CALL(mock_encoder_, Num10MsFramesInNextPacket())
|
| .WillRepeatedly(Return(blocks_per_frame));
|
| CreateCng();
|
| @@ -107,7 +107,7 @@ class AudioEncoderCngTest : public ::testing::Test {
|
|
|
| // Don't expect any calls to the encoder yet.
|
| EXPECT_CALL(mock_encoder_, EncodeInternal(_, _, _, _)).Times(0);
|
| - for (int i = 0; i < blocks_per_frame - 1; ++i) {
|
| + for (size_t i = 0; i < blocks_per_frame - 1; ++i) {
|
| Encode();
|
| EXPECT_EQ(0u, encoded_info_.encoded_bytes);
|
| }
|
| @@ -127,14 +127,15 @@ class AudioEncoderCngTest : public ::testing::Test {
|
| void CheckVadInputSize(int input_frame_size_ms,
|
| int expected_first_block_size_ms,
|
| int expected_second_block_size_ms) {
|
| - const int blocks_per_frame = input_frame_size_ms / 10;
|
| + const size_t blocks_per_frame =
|
| + static_cast<size_t>(input_frame_size_ms / 10);
|
|
|
| EXPECT_CALL(mock_encoder_, Num10MsFramesInNextPacket())
|
| .WillRepeatedly(Return(blocks_per_frame));
|
|
|
| // Expect nothing to happen before the last block is sent to cng_.
|
| EXPECT_CALL(*mock_vad_, VoiceActivity(_, _, _)).Times(0);
|
| - for (int i = 0; i < blocks_per_frame - 1; ++i) {
|
| + for (size_t i = 0; i < blocks_per_frame - 1; ++i) {
|
| Encode();
|
| }
|
|
|
| @@ -163,7 +164,7 @@ class AudioEncoderCngTest : public ::testing::Test {
|
| Vad::Activity second_type) {
|
| // Set the speech encoder frame size to 60 ms, to ensure that the VAD will
|
| // be called twice.
|
| - const int blocks_per_frame = 6;
|
| + const size_t blocks_per_frame = 6;
|
| EXPECT_CALL(mock_encoder_, Num10MsFramesInNextPacket())
|
| .WillRepeatedly(Return(blocks_per_frame));
|
| InSequence s;
|
| @@ -175,7 +176,7 @@ class AudioEncoderCngTest : public ::testing::Test {
|
| .WillOnce(Return(second_type));
|
| }
|
| encoded_info_.payload_type = 0;
|
| - for (int i = 0; i < blocks_per_frame; ++i) {
|
| + for (size_t i = 0; i < blocks_per_frame; ++i) {
|
| Encode();
|
| }
|
| return encoded_info_.payload_type != kCngPayloadType;
|
| @@ -199,8 +200,8 @@ TEST_F(AudioEncoderCngTest, CreateAndDestroy) {
|
|
|
| TEST_F(AudioEncoderCngTest, CheckFrameSizePropagation) {
|
| CreateCng();
|
| - EXPECT_CALL(mock_encoder_, Num10MsFramesInNextPacket()).WillOnce(Return(17));
|
| - EXPECT_EQ(17, cng_->Num10MsFramesInNextPacket());
|
| + EXPECT_CALL(mock_encoder_, Num10MsFramesInNextPacket()).WillOnce(Return(17U));
|
| + EXPECT_EQ(17U, cng_->Num10MsFramesInNextPacket());
|
| }
|
|
|
| TEST_F(AudioEncoderCngTest, CheckChangeBitratePropagation) {
|
| @@ -217,7 +218,7 @@ TEST_F(AudioEncoderCngTest, CheckProjectedPacketLossRatePropagation) {
|
|
|
| TEST_F(AudioEncoderCngTest, EncodeCallsVad) {
|
| EXPECT_CALL(mock_encoder_, Num10MsFramesInNextPacket())
|
| - .WillRepeatedly(Return(1));
|
| + .WillRepeatedly(Return(1U));
|
| CreateCng();
|
| EXPECT_CALL(*mock_vad_, VoiceActivity(_, _, _))
|
| .WillOnce(Return(Vad::kPassive));
|
| @@ -249,7 +250,7 @@ TEST_F(AudioEncoderCngTest, EncodeCollects3BlocksActiveSpeech) {
|
| }
|
|
|
| TEST_F(AudioEncoderCngTest, EncodePassive) {
|
| - const int kBlocksPerFrame = 3;
|
| + const size_t kBlocksPerFrame = 3;
|
| EXPECT_CALL(mock_encoder_, Num10MsFramesInNextPacket())
|
| .WillRepeatedly(Return(kBlocksPerFrame));
|
| CreateCng();
|
| @@ -258,7 +259,7 @@ TEST_F(AudioEncoderCngTest, EncodePassive) {
|
| // Expect no calls at all to the speech encoder mock.
|
| EXPECT_CALL(mock_encoder_, EncodeInternal(_, _, _, _)).Times(0);
|
| uint32_t expected_timestamp = timestamp_;
|
| - for (int i = 0; i < 100; ++i) {
|
| + for (size_t i = 0; i < 100; ++i) {
|
| Encode();
|
| // Check if it was time to call the cng encoder. This is done once every
|
| // |kBlocksPerFrame| calls.
|
| @@ -339,7 +340,7 @@ TEST_F(AudioEncoderCngTest, VadInputSize60Ms) {
|
| TEST_F(AudioEncoderCngTest, VerifyCngPayloadType) {
|
| CreateCng();
|
| EXPECT_CALL(mock_encoder_, EncodeInternal(_, _, _, _)).Times(0);
|
| - EXPECT_CALL(mock_encoder_, Num10MsFramesInNextPacket()).WillOnce(Return(1));
|
| + EXPECT_CALL(mock_encoder_, Num10MsFramesInNextPacket()).WillOnce(Return(1U));
|
| EXPECT_CALL(*mock_vad_, VoiceActivity(_, _, _))
|
| .WillOnce(Return(Vad::kPassive));
|
| encoded_info_.payload_type = 0;
|
| @@ -352,7 +353,7 @@ TEST_F(AudioEncoderCngTest, VerifyCngPayloadType) {
|
| TEST_F(AudioEncoderCngTest, VerifySidFrameAfterSpeech) {
|
| CreateCng();
|
| EXPECT_CALL(mock_encoder_, Num10MsFramesInNextPacket())
|
| - .WillRepeatedly(Return(1));
|
| + .WillRepeatedly(Return(1U));
|
| // Start with encoding noise.
|
| EXPECT_CALL(*mock_vad_, VoiceActivity(_, _, _))
|
| .Times(2)
|
| @@ -443,7 +444,7 @@ TEST_F(AudioEncoderCngDeathTest, Stereo) {
|
| TEST_F(AudioEncoderCngDeathTest, EncoderFrameSizeTooLarge) {
|
| CreateCng();
|
| EXPECT_CALL(mock_encoder_, Num10MsFramesInNextPacket())
|
| - .WillRepeatedly(Return(7));
|
| + .WillRepeatedly(Return(7U));
|
| for (int i = 0; i < 6; ++i)
|
| Encode();
|
| EXPECT_DEATH(Encode(),
|
|
|