OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 24 matching lines...) Expand all Loading... |
35 AudioEncoderCopyRedTest() | 35 AudioEncoderCopyRedTest() |
36 : timestamp_(4711), | 36 : timestamp_(4711), |
37 sample_rate_hz_(16000), | 37 sample_rate_hz_(16000), |
38 num_audio_samples_10ms(sample_rate_hz_ / 100), | 38 num_audio_samples_10ms(sample_rate_hz_ / 100), |
39 red_payload_type_(200) { | 39 red_payload_type_(200) { |
40 AudioEncoderCopyRed::Config config; | 40 AudioEncoderCopyRed::Config config; |
41 config.payload_type = red_payload_type_; | 41 config.payload_type = red_payload_type_; |
42 config.speech_encoder = &mock_encoder_; | 42 config.speech_encoder = &mock_encoder_; |
43 red_.reset(new AudioEncoderCopyRed(config)); | 43 red_.reset(new AudioEncoderCopyRed(config)); |
44 memset(audio_, 0, sizeof(audio_)); | 44 memset(audio_, 0, sizeof(audio_)); |
45 EXPECT_CALL(mock_encoder_, NumChannels()).WillRepeatedly(Return(1)); | 45 EXPECT_CALL(mock_encoder_, NumChannels()).WillRepeatedly(Return(1U)); |
46 EXPECT_CALL(mock_encoder_, SampleRateHz()) | 46 EXPECT_CALL(mock_encoder_, SampleRateHz()) |
47 .WillRepeatedly(Return(sample_rate_hz_)); | 47 .WillRepeatedly(Return(sample_rate_hz_)); |
48 EXPECT_CALL(mock_encoder_, MaxEncodedBytes()) | 48 EXPECT_CALL(mock_encoder_, MaxEncodedBytes()) |
49 .WillRepeatedly(Return(kMockMaxEncodedBytes)); | 49 .WillRepeatedly(Return(kMockMaxEncodedBytes)); |
50 encoded_.resize(red_->MaxEncodedBytes(), 0); | 50 encoded_.resize(red_->MaxEncodedBytes(), 0); |
51 } | 51 } |
52 | 52 |
53 void TearDown() override { | 53 void TearDown() override { |
54 red_.reset(); | 54 red_.reset(); |
55 // Don't expect the red_ object to delete the AudioEncoder object. But it | 55 // Don't expect the red_ object to delete the AudioEncoder object. But it |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 103 |
104 TEST_F(AudioEncoderCopyRedTest, CreateAndDestroy) { | 104 TEST_F(AudioEncoderCopyRedTest, CreateAndDestroy) { |
105 } | 105 } |
106 | 106 |
107 TEST_F(AudioEncoderCopyRedTest, CheckSampleRatePropagation) { | 107 TEST_F(AudioEncoderCopyRedTest, CheckSampleRatePropagation) { |
108 EXPECT_CALL(mock_encoder_, SampleRateHz()).WillOnce(Return(17)); | 108 EXPECT_CALL(mock_encoder_, SampleRateHz()).WillOnce(Return(17)); |
109 EXPECT_EQ(17, red_->SampleRateHz()); | 109 EXPECT_EQ(17, red_->SampleRateHz()); |
110 } | 110 } |
111 | 111 |
112 TEST_F(AudioEncoderCopyRedTest, CheckNumChannelsPropagation) { | 112 TEST_F(AudioEncoderCopyRedTest, CheckNumChannelsPropagation) { |
113 EXPECT_CALL(mock_encoder_, NumChannels()).WillOnce(Return(17)); | 113 EXPECT_CALL(mock_encoder_, NumChannels()).WillOnce(Return(17U)); |
114 EXPECT_EQ(17, red_->NumChannels()); | 114 EXPECT_EQ(17U, red_->NumChannels()); |
115 } | 115 } |
116 | 116 |
117 TEST_F(AudioEncoderCopyRedTest, CheckFrameSizePropagation) { | 117 TEST_F(AudioEncoderCopyRedTest, CheckFrameSizePropagation) { |
118 EXPECT_CALL(mock_encoder_, Num10MsFramesInNextPacket()).WillOnce(Return(17U)); | 118 EXPECT_CALL(mock_encoder_, Num10MsFramesInNextPacket()).WillOnce(Return(17U)); |
119 EXPECT_EQ(17U, red_->Num10MsFramesInNextPacket()); | 119 EXPECT_EQ(17U, red_->Num10MsFramesInNextPacket()); |
120 } | 120 } |
121 | 121 |
122 TEST_F(AudioEncoderCopyRedTest, CheckMaxFrameSizePropagation) { | 122 TEST_F(AudioEncoderCopyRedTest, CheckMaxFrameSizePropagation) { |
123 EXPECT_CALL(mock_encoder_, Max10MsFramesInAPacket()).WillOnce(Return(17U)); | 123 EXPECT_CALL(mock_encoder_, Max10MsFramesInAPacket()).WillOnce(Return(17U)); |
124 EXPECT_EQ(17U, red_->Max10MsFramesInAPacket()); | 124 EXPECT_EQ(17U, red_->Max10MsFramesInAPacket()); |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 config.speech_encoder = NULL; | 327 config.speech_encoder = NULL; |
328 EXPECT_DEATH(red = new AudioEncoderCopyRed(config), | 328 EXPECT_DEATH(red = new AudioEncoderCopyRed(config), |
329 "Speech encoder not provided."); | 329 "Speech encoder not provided."); |
330 // The delete operation is needed to avoid leak reports from memcheck. | 330 // The delete operation is needed to avoid leak reports from memcheck. |
331 delete red; | 331 delete red; |
332 } | 332 } |
333 | 333 |
334 #endif // GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID) | 334 #endif // GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID) |
335 | 335 |
336 } // namespace webrtc | 336 } // namespace webrtc |
OLD | NEW |