Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 900 EXPECT_EQ(kMaxOutputSize, samples_per_channel * kChannels); | 900 EXPECT_EQ(kMaxOutputSize, samples_per_channel * kChannels); |
| 901 EXPECT_EQ(kChannels, num_channels); | 901 EXPECT_EQ(kChannels, num_channels); |
| 902 | 902 |
| 903 EXPECT_EQ(NetEq::kOK, neteq_->GetAudio(kMaxOutputSize, output, | 903 EXPECT_EQ(NetEq::kOK, neteq_->GetAudio(kMaxOutputSize, output, |
| 904 &samples_per_channel, &num_channels, | 904 &samples_per_channel, &num_channels, |
| 905 &type)); | 905 &type)); |
| 906 EXPECT_EQ(kMaxOutputSize, samples_per_channel * kChannels); | 906 EXPECT_EQ(kMaxOutputSize, samples_per_channel * kChannels); |
| 907 EXPECT_EQ(kChannels, num_channels); | 907 EXPECT_EQ(kChannels, num_channels); |
| 908 } | 908 } |
| 909 | 909 |
| 910 // This test inserts packets until the buffer is flushed. After that, it asks | |
| 911 // NetEq for the network statistics. The purpose of the test is to make sure | |
| 912 // that even though the buffer size increment is negative (which it becomes when | |
| 913 // the packet causing a flush is inserted), the packet length stored in the | |
| 914 // decision logic remains valid. | |
| 915 TEST_F(NetEqImplTest, FloodBufferAndGetNetworkStats) { | |
| 916 UseNoMocks(); | |
| 917 CreateInstance(); | |
| 918 | |
| 919 const int kPayloadLengthSamples = 80; | |
|
Peter Kasting
2015/08/27 08:45:33
Nit: Use size_t here...
hlundin-webrtc
2015/08/27 09:54:03
Done.
| |
| 920 const size_t kPayloadLengthBytes = 2 * kPayloadLengthSamples; // PCM 16-bit. | |
| 921 const uint8_t kPayloadType = 17; // Just an arbitrary number. | |
| 922 const uint32_t kReceiveTime = 17; // Value doesn't matter for this test. | |
| 923 uint8_t payload[kPayloadLengthBytes] = {0}; | |
| 924 WebRtcRTPHeader rtp_header; | |
| 925 rtp_header.header.payloadType = kPayloadType; | |
| 926 rtp_header.header.sequenceNumber = 0x1234; | |
| 927 rtp_header.header.timestamp = 0x12345678; | |
| 928 rtp_header.header.ssrc = 0x87654321; | |
| 929 | |
| 930 EXPECT_EQ(NetEq::kOK, | |
| 931 neteq_->RegisterPayloadType(kDecoderPCM16B, kPayloadType)); | |
| 932 | |
| 933 // Insert packets until the buffer flushes. | |
| 934 for (size_t i = 0; i <= config_.max_packets_in_buffer; ++i) { | |
| 935 EXPECT_EQ(i, packet_buffer_->NumPacketsInBuffer()); | |
| 936 EXPECT_EQ(NetEq::kOK, | |
| 937 neteq_->InsertPacket(rtp_header, payload, kPayloadLengthBytes, | |
| 938 kReceiveTime)); | |
| 939 rtp_header.header.timestamp += kPayloadLengthSamples; | |
|
Peter Kasting
2015/08/27 08:45:33
Nit: ...and cast to uint32_t here
hlundin-webrtc
2015/08/27 09:54:03
Done.
| |
| 940 rtp_header.header.sequenceNumber += 1; | |
|
Peter Kasting
2015/08/27 08:45:33
Nit: ++rtp_header.header.sequenceNumber;
hlundin-webrtc
2015/08/27 09:54:03
Done.
| |
| 941 } | |
| 942 EXPECT_EQ(1u, packet_buffer_->NumPacketsInBuffer()); | |
| 943 | |
| 944 // Ask for network statistics. This should not crash. | |
| 945 NetEqNetworkStatistics stats; | |
| 946 EXPECT_EQ(NetEq::kOK, neteq_->NetworkStatistics(&stats)); | |
| 947 } | |
| 910 } // namespace webrtc | 948 } // namespace webrtc |
| OLD | NEW |