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

Side by Side Diff: webrtc/modules/audio_coding/neteq/neteq_impl_unittest.cc

Issue 2870043003: Handle padded audio packets correctly (Closed)
Patch Set: const size_t Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 1266 matching lines...) Expand 10 before | Expand all | Expand 10 after
1277 CreateInstance(); 1277 CreateInstance();
1278 // Let the dummy target delay be 17 packets. 1278 // Let the dummy target delay be 17 packets.
1279 constexpr int kTargetLevelPacketsQ8 = 17 << 8; 1279 constexpr int kTargetLevelPacketsQ8 = 17 << 8;
1280 EXPECT_CALL(*mock_delay_manager_, TargetLevel()) 1280 EXPECT_CALL(*mock_delay_manager_, TargetLevel())
1281 .WillOnce(Return(kTargetLevelPacketsQ8)); 1281 .WillOnce(Return(kTargetLevelPacketsQ8));
1282 // Default packet size before any packet has been decoded is 30 ms, so we are 1282 // Default packet size before any packet has been decoded is 30 ms, so we are
1283 // expecting 17 * 30 = 510 ms target delay. 1283 // expecting 17 * 30 = 510 ms target delay.
1284 EXPECT_EQ(17 * 30, neteq_->TargetDelayMs()); 1284 EXPECT_EQ(17 * 30, neteq_->TargetDelayMs());
1285 } 1285 }
1286 1286
1287 TEST_F(NetEqImplTest, InsertEmptyPacket) {
1288 UseNoMocks();
1289 use_mock_delay_manager_ = true;
1290 CreateInstance();
1291
1292 RTPHeader rtp_header;
1293 rtp_header.payloadType = 17;
1294 rtp_header.sequenceNumber = 0x1234;
1295 rtp_header.timestamp = 0x12345678;
1296 rtp_header.ssrc = 0x87654321;
1297
1298 EXPECT_CALL(*mock_delay_manager_, RegisterEmptyPacket());
1299 neteq_->InsertEmptyPacket(rtp_header);
1300 }
1301
1287 class Decoder120ms : public AudioDecoder { 1302 class Decoder120ms : public AudioDecoder {
1288 public: 1303 public:
1289 Decoder120ms(int sample_rate_hz, SpeechType speech_type) 1304 Decoder120ms(int sample_rate_hz, SpeechType speech_type)
1290 : sample_rate_hz_(sample_rate_hz), 1305 : sample_rate_hz_(sample_rate_hz),
1291 next_value_(1), 1306 next_value_(1),
1292 speech_type_(speech_type) {} 1307 speech_type_(speech_type) {}
1293 1308
1294 int DecodeInternal(const uint8_t* encoded, 1309 int DecodeInternal(const uint8_t* encoded,
1295 size_t encoded_len, 1310 size_t encoded_len,
1296 int sample_rate_hz, 1311 int sample_rate_hz,
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
1502 EXPECT_CALL(*mock_delay_manager_, BufferLimits(_, _)) 1517 EXPECT_CALL(*mock_delay_manager_, BufferLimits(_, _))
1503 .Times(1) 1518 .Times(1)
1504 .WillOnce(DoAll(SetArgPointee<0>(1), SetArgPointee<1>(2))); 1519 .WillOnce(DoAll(SetArgPointee<0>(1), SetArgPointee<1>(2)));
1505 1520
1506 bool muted; 1521 bool muted;
1507 EXPECT_EQ(NetEq::kOK, neteq_->GetAudio(&output_, &muted)); 1522 EXPECT_EQ(NetEq::kOK, neteq_->GetAudio(&output_, &muted));
1508 EXPECT_EQ(kAccelerate, neteq_->last_operation_for_test()); 1523 EXPECT_EQ(kAccelerate, neteq_->last_operation_for_test());
1509 } 1524 }
1510 1525
1511 }// namespace webrtc 1526 }// namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/neteq/neteq_impl.cc ('k') | webrtc/modules/rtp_rtcp/source/rtp_receiver_audio.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698