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

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

Issue 2506373004: RtpPacket::payload() return rtc::ArrayView instead of raw pointer (Closed)
Patch Set: Created 4 years, 1 month 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) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 if (parsed_packet.payload_size() < kMinFlexfecHeaderSize) { 90 if (parsed_packet.payload_size() < kMinFlexfecHeaderSize) {
91 LOG(LS_WARNING) << "Truncated FlexFEC packet, discarding."; 91 LOG(LS_WARNING) << "Truncated FlexFEC packet, discarding.";
92 return false; 92 return false;
93 } 93 }
94 received_packet->is_fec = true; 94 received_packet->is_fec = true;
95 ++packet_counter_.num_fec_packets; 95 ++packet_counter_.num_fec_packets;
96 // Insert packet payload into erasure code. 96 // Insert packet payload into erasure code.
97 // TODO(brandtr): Remove this memcpy when the FEC packet classes 97 // TODO(brandtr): Remove this memcpy when the FEC packet classes
98 // are using COW buffers internally. 98 // are using COW buffers internally.
99 received_packet->pkt = rtc::scoped_refptr<Packet>(new Packet()); 99 received_packet->pkt = rtc::scoped_refptr<Packet>(new Packet());
100 memcpy(received_packet->pkt->data, parsed_packet.payload(), 100 auto payload = parsed_packet.payload();
101 parsed_packet.payload_size()); 101 memcpy(received_packet->pkt->data, payload.data(), payload.size());
102 received_packet->pkt->length = parsed_packet.payload_size(); 102 received_packet->pkt->length = payload.size();
103 } else { 103 } else {
104 // This is a media packet, or a FlexFEC packet belonging to some 104 // This is a media packet, or a FlexFEC packet belonging to some
105 // other FlexFEC stream. 105 // other FlexFEC stream.
106 if (received_packet->ssrc != protected_media_ssrc_) { 106 if (received_packet->ssrc != protected_media_ssrc_) {
107 return false; 107 return false;
108 } 108 }
109 received_packet->is_fec = false; 109 received_packet->is_fec = false;
110 // Insert entire packet into erasure code. 110 // Insert entire packet into erasure code.
111 // TODO(brandtr): Remove this memcpy too. 111 // TODO(brandtr): Remove this memcpy too.
112 received_packet->pkt = rtc::scoped_refptr<Packet>(new Packet()); 112 received_packet->pkt = rtc::scoped_refptr<Packet>(new Packet());
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 ForwardErrorCorrection::ParseSsrc(recovered_packet->pkt->data); 157 ForwardErrorCorrection::ParseSsrc(recovered_packet->pkt->data);
158 LOG(LS_INFO) << "Recovered media packet with SSRC: " << media_ssrc 158 LOG(LS_INFO) << "Recovered media packet with SSRC: " << media_ssrc
159 << " from FlexFEC stream with SSRC: " << ssrc_ << "."; 159 << " from FlexFEC stream with SSRC: " << ssrc_ << ".";
160 last_recovered_packet_ms_ = now_ms; 160 last_recovered_packet_ms_ = now_ms;
161 } 161 }
162 } 162 }
163 return true; 163 return true;
164 } 164 }
165 165
166 } // namespace webrtc 166 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/rtp_rtcp/source/rtp_packet.h » ('j') | webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698