OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 #include "webrtc/base/checks.h" | 10 #include "webrtc/base/checks.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 i += payload_size + rtp_header_length; | 38 i += payload_size + rtp_header_length; |
39 // Make sure sequence numbers are increasing. | 39 // Make sure sequence numbers are increasing. |
40 const int kRedPayloadType = 98; | 40 const int kRedPayloadType = 98; |
41 rtc::scoped_ptr<RedPacket> red_packet(producer.BuildRedPacket( | 41 rtc::scoped_ptr<RedPacket> red_packet(producer.BuildRedPacket( |
42 packet.get(), payload_size, rtp_header_length, kRedPayloadType)); | 42 packet.get(), payload_size, rtp_header_length, kRedPayloadType)); |
43 const bool protect = data[i++] % 2 == 1; | 43 const bool protect = data[i++] % 2 == 1; |
44 if (protect) { | 44 if (protect) { |
45 producer.AddRtpPacketAndGenerateFec(packet.get(), payload_size, | 45 producer.AddRtpPacketAndGenerateFec(packet.get(), payload_size, |
46 rtp_header_length); | 46 rtp_header_length); |
47 } | 47 } |
48 uint16_t num_fec_packets = producer.NumAvailableFecPackets(); | 48 const size_t num_fec_packets = producer.NumAvailableFecPackets(); |
49 std::vector<RedPacket*> fec_packets; | |
50 if (num_fec_packets > 0) { | 49 if (num_fec_packets > 0) { |
51 fec_packets = | 50 std::vector<RedPacket*> fec_packets = |
52 producer.GetFecPackets(kRedPayloadType, 99, 100, rtp_header_length); | 51 producer.GetFecPackets(kRedPayloadType, 99, 100, rtp_header_length); |
53 RTC_CHECK_EQ(num_fec_packets, fec_packets.size()); | 52 RTC_CHECK_EQ(num_fec_packets, fec_packets.size()); |
54 } | 53 for (RedPacket* fec_packet : fec_packets) |
55 for (RedPacket* fec_packet : fec_packets) { | 54 delete fec_packet; |
56 delete fec_packet; | |
57 } | 55 } |
58 } | 56 } |
59 } | 57 } |
60 } // namespace webrtc | 58 } // namespace webrtc |
OLD | NEW |