| 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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 PacketList packet_list; | 304 PacketList packet_list; |
| 305 for (uint8_t i = 0; i <= 3; ++i) { | 305 for (uint8_t i = 0; i <= 3; ++i) { |
| 306 // Create packet with payload type |i|, payload length 10 bytes, all 0. | 306 // Create packet with payload type |i|, payload length 10 bytes, all 0. |
| 307 Packet* packet = CreatePacket(i, 10, 0); | 307 Packet* packet = CreatePacket(i, 10, 0); |
| 308 packet_list.push_back(packet); | 308 packet_list.push_back(packet); |
| 309 } | 309 } |
| 310 | 310 |
| 311 // Use a real DecoderDatabase object here instead of a mock, since it is | 311 // Use a real DecoderDatabase object here instead of a mock, since it is |
| 312 // easier to just register the payload types and let the actual implementation | 312 // easier to just register the payload types and let the actual implementation |
| 313 // do its job. | 313 // do its job. |
| 314 std::unique_ptr<MockAudioDecoderFactory> factory(new MockAudioDecoderFactory); | 314 DecoderDatabase decoder_database( |
| 315 DecoderDatabase decoder_database(std::move(factory)); | 315 new rtc::RefCountedObject<MockAudioDecoderFactory>); |
| 316 decoder_database.RegisterPayload(0, NetEqDecoder::kDecoderCNGnb, "cng-nb"); | 316 decoder_database.RegisterPayload(0, NetEqDecoder::kDecoderCNGnb, "cng-nb"); |
| 317 decoder_database.RegisterPayload(1, NetEqDecoder::kDecoderPCMu, "pcmu"); | 317 decoder_database.RegisterPayload(1, NetEqDecoder::kDecoderPCMu, "pcmu"); |
| 318 decoder_database.RegisterPayload(2, NetEqDecoder::kDecoderAVT, "avt"); | 318 decoder_database.RegisterPayload(2, NetEqDecoder::kDecoderAVT, "avt"); |
| 319 decoder_database.RegisterPayload(3, NetEqDecoder::kDecoderILBC, "ilbc"); | 319 decoder_database.RegisterPayload(3, NetEqDecoder::kDecoderILBC, "ilbc"); |
| 320 | 320 |
| 321 PayloadSplitter splitter; | 321 PayloadSplitter splitter; |
| 322 splitter.CheckRedPayloads(&packet_list, decoder_database); | 322 splitter.CheckRedPayloads(&packet_list, decoder_database); |
| 323 | 323 |
| 324 ASSERT_EQ(3u, packet_list.size()); // Should have dropped the last packet. | 324 ASSERT_EQ(3u, packet_list.size()); // Should have dropped the last packet. |
| 325 // Verify packets. The loop verifies that payload types 0, 1, and 2 are in the | 325 // Verify packets. The loop verifies that payload types 0, 1, and 2 are in the |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 EXPECT_EQ(kBaseTimestamp - kTimestampOffset, packet->header.timestamp); | 856 EXPECT_EQ(kBaseTimestamp - kTimestampOffset, packet->header.timestamp); |
| 857 EXPECT_EQ(kPayloadLength, packet->payload_length); | 857 EXPECT_EQ(kPayloadLength, packet->payload_length); |
| 858 EXPECT_TRUE(packet->primary); | 858 EXPECT_TRUE(packet->primary); |
| 859 EXPECT_EQ(packet->payload[3], 0); | 859 EXPECT_EQ(packet->payload[3], 0); |
| 860 delete [] packet->payload; | 860 delete [] packet->payload; |
| 861 delete packet; | 861 delete packet; |
| 862 packet_list.pop_front(); | 862 packet_list.pop_front(); |
| 863 } | 863 } |
| 864 | 864 |
| 865 } // namespace webrtc | 865 } // namespace webrtc |
| OLD | NEW |