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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/ulpfec_receiver_impl.cc

Issue 2893293003: Only compare sequence numbers from the same SSRC in ForwardErrorCorrection. (Closed)
Patch Set: Typo fix. Created 3 years, 6 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 } 83 }
84 84
85 // Remove RED header of incoming packet and store as a virtual RTP packet. 85 // Remove RED header of incoming packet and store as a virtual RTP packet.
86 std::unique_ptr<ForwardErrorCorrection::ReceivedPacket> received_packet( 86 std::unique_ptr<ForwardErrorCorrection::ReceivedPacket> received_packet(
87 new ForwardErrorCorrection::ReceivedPacket()); 87 new ForwardErrorCorrection::ReceivedPacket());
88 received_packet->pkt = new ForwardErrorCorrection::Packet(); 88 received_packet->pkt = new ForwardErrorCorrection::Packet();
89 89
90 // Get payload type from RED header and sequence number from RTP header. 90 // Get payload type from RED header and sequence number from RTP header.
91 uint8_t payload_type = incoming_rtp_packet[header.headerLength] & 0x7f; 91 uint8_t payload_type = incoming_rtp_packet[header.headerLength] & 0x7f;
92 received_packet->is_fec = payload_type == ulpfec_payload_type; 92 received_packet->is_fec = payload_type == ulpfec_payload_type;
93 received_packet->ssrc = header.ssrc;
93 received_packet->seq_num = header.sequenceNumber; 94 received_packet->seq_num = header.sequenceNumber;
94 95
95 uint16_t block_length = 0; 96 uint16_t block_length = 0;
96 if (incoming_rtp_packet[header.headerLength] & 0x80) { 97 if (incoming_rtp_packet[header.headerLength] & 0x80) {
97 // f bit set in RED header, i.e. there are more than one RED header blocks. 98 // f bit set in RED header, i.e. there are more than one RED header blocks.
98 red_header_length = 4; 99 red_header_length = 4;
99 if (payload_data_length < red_header_length + 1u) { 100 if (payload_data_length < red_header_length + 1u) {
100 LOG(LS_WARNING) << "Corrupt/truncated FEC packet."; 101 LOG(LS_WARNING) << "Corrupt/truncated FEC packet.";
101 return -1; 102 return -1;
102 } 103 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 // Copy payload data. 149 // Copy payload data.
149 memcpy(received_packet->pkt->data + header.headerLength, 150 memcpy(received_packet->pkt->data + header.headerLength,
150 incoming_rtp_packet + header.headerLength + red_header_length, 151 incoming_rtp_packet + header.headerLength + red_header_length,
151 block_length); 152 block_length);
152 received_packet->pkt->length = block_length; 153 received_packet->pkt->length = block_length;
153 154
154 second_received_packet.reset(new ForwardErrorCorrection::ReceivedPacket); 155 second_received_packet.reset(new ForwardErrorCorrection::ReceivedPacket);
155 second_received_packet->pkt = new ForwardErrorCorrection::Packet; 156 second_received_packet->pkt = new ForwardErrorCorrection::Packet;
156 157
157 second_received_packet->is_fec = true; 158 second_received_packet->is_fec = true;
159 second_received_packet->ssrc = header.ssrc;
158 second_received_packet->seq_num = header.sequenceNumber; 160 second_received_packet->seq_num = header.sequenceNumber;
159 ++packet_counter_.num_fec_packets; 161 ++packet_counter_.num_fec_packets;
160 162
161 // Copy FEC payload data. 163 // Copy FEC payload data.
162 memcpy(second_received_packet->pkt->data, 164 memcpy(second_received_packet->pkt->data,
163 incoming_rtp_packet + header.headerLength + red_header_length + 165 incoming_rtp_packet + header.headerLength + red_header_length +
164 block_length, 166 block_length,
165 payload_data_length - red_header_length - block_length); 167 payload_data_length - red_header_length - block_length);
166 168
167 second_received_packet->pkt->length = 169 second_received_packet->pkt->length =
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 return -1; 240 return -1;
239 } 241 }
240 crit_sect_.Enter(); 242 crit_sect_.Enter();
241 recovered_packet->returned = true; 243 recovered_packet->returned = true;
242 } 244 }
243 crit_sect_.Leave(); 245 crit_sect_.Leave();
244 return 0; 246 return 0;
245 } 247 }
246 248
247 } // namespace webrtc 249 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_fec_unittest.cc ('k') | webrtc/modules/rtp_rtcp/test/testFec/test_fec.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698