Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 return; | 52 return; |
| 53 } | 53 } |
| 54 ProcessReceivedPackets(); | 54 ProcessReceivedPackets(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 FecPacketCounter FlexfecReceiver::GetPacketCounter() const { | 57 FecPacketCounter FlexfecReceiver::GetPacketCounter() const { |
| 58 RTC_DCHECK_CALLED_SEQUENTIALLY(&sequence_checker_); | 58 RTC_DCHECK_CALLED_SEQUENTIALLY(&sequence_checker_); |
| 59 return packet_counter_; | 59 return packet_counter_; |
| 60 } | 60 } |
| 61 | 61 |
| 62 // TODO(eladalon): Consider using packet.recovered() to avoid processing | |
| 63 // recovered packets here. | |
| 62 bool FlexfecReceiver::AddReceivedPacket(const RtpPacketReceived& packet) { | 64 bool FlexfecReceiver::AddReceivedPacket(const RtpPacketReceived& packet) { |
| 63 RTC_DCHECK_CALLED_SEQUENTIALLY(&sequence_checker_); | 65 RTC_DCHECK_CALLED_SEQUENTIALLY(&sequence_checker_); |
| 64 | 66 |
| 65 // RTP packets with a full base header (12 bytes), but without payload, | 67 // RTP packets with a full base header (12 bytes), but without payload, |
| 66 // could conceivably be useful in the decoding. Therefore we check | 68 // could conceivably be useful in the decoding. Therefore we check |
| 67 // with a non-strict inequality here. | 69 // with a non-strict inequality here. |
| 68 RTC_DCHECK_GE(packet.size(), kRtpHeaderSize); | 70 RTC_DCHECK_GE(packet.size(), kRtpHeaderSize); |
| 69 | 71 |
| 70 // Demultiplex based on SSRC, and insert into erasure code decoder. | 72 // Demultiplex based on SSRC, and insert into erasure code decoder. |
| 71 std::unique_ptr<ReceivedPacket> received_packet(new ReceivedPacket()); | 73 std::unique_ptr<ReceivedPacket> received_packet(new ReceivedPacket()); |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 86 received_packet->pkt = rtc::scoped_refptr<Packet>(new Packet()); | 88 received_packet->pkt = rtc::scoped_refptr<Packet>(new Packet()); |
| 87 auto payload = packet.payload(); | 89 auto payload = packet.payload(); |
| 88 memcpy(received_packet->pkt->data, payload.data(), payload.size()); | 90 memcpy(received_packet->pkt->data, payload.data(), payload.size()); |
| 89 received_packet->pkt->length = payload.size(); | 91 received_packet->pkt->length = payload.size(); |
| 90 } else { | 92 } else { |
| 91 // This is a media packet, or a FlexFEC packet belonging to some | 93 // This is a media packet, or a FlexFEC packet belonging to some |
| 92 // other FlexFEC stream. | 94 // other FlexFEC stream. |
| 93 if (received_packet->ssrc != protected_media_ssrc_) { | 95 if (received_packet->ssrc != protected_media_ssrc_) { |
| 94 return false; | 96 return false; |
| 95 } | 97 } |
| 98 // TODO(eladalon): It seems like, because of return-statement above, | |
|
danilchap
2017/07/24 15:37:25
received_packet is a local variable: if return abo
eladalon
2017/07/24 15:53:55
Right you are. Looks like I was confused between |
| |
| 99 // it could be that nobody ever ends up updating |is_fec|. Specifically, | |
| 100 // it seems like a media packet would never be set to |is_fec=false| | |
| 101 // if there is no FlexFEC stream protecting it. | |
| 102 // https://bugs.chromium.org/p/webrtc/issues/detail?id=7954 | |
| 96 received_packet->is_fec = false; | 103 received_packet->is_fec = false; |
| 97 | 104 |
| 98 // Insert entire packet into erasure code. | 105 // Insert entire packet into erasure code. |
| 99 // TODO(brandtr): Remove this memcpy too. | 106 // TODO(brandtr): Remove this memcpy too. |
| 100 received_packet->pkt = rtc::scoped_refptr<Packet>(new Packet()); | 107 received_packet->pkt = rtc::scoped_refptr<Packet>(new Packet()); |
| 101 memcpy(received_packet->pkt->data, packet.data(), packet.size()); | 108 memcpy(received_packet->pkt->data, packet.data(), packet.size()); |
| 102 received_packet->pkt->length = packet.size(); | 109 received_packet->pkt->length = packet.size(); |
| 103 } | 110 } |
| 104 | 111 |
| 105 received_packets_.push_back(std::move(received_packet)); | 112 received_packets_.push_back(std::move(received_packet)); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 145 ForwardErrorCorrection::ParseSsrc(recovered_packet->pkt->data); | 152 ForwardErrorCorrection::ParseSsrc(recovered_packet->pkt->data); |
| 146 LOG(LS_VERBOSE) << "Recovered media packet with SSRC: " << media_ssrc | 153 LOG(LS_VERBOSE) << "Recovered media packet with SSRC: " << media_ssrc |
| 147 << " from FlexFEC stream with SSRC: " << ssrc_ << "."; | 154 << " from FlexFEC stream with SSRC: " << ssrc_ << "."; |
| 148 last_recovered_packet_ms_ = now_ms; | 155 last_recovered_packet_ms_ = now_ms; |
| 149 } | 156 } |
| 150 } | 157 } |
| 151 return true; | 158 return true; |
| 152 } | 159 } |
| 153 | 160 |
| 154 } // namespace webrtc | 161 } // namespace webrtc |
| OLD | NEW |