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 |
11 #include "webrtc/modules/rtp_rtcp/source/ulpfec_receiver_impl.h" | 11 #include "webrtc/modules/rtp_rtcp/source/ulpfec_receiver_impl.h" |
12 | 12 |
13 #include <memory> | 13 #include <memory> |
14 #include <utility> | 14 #include <utility> |
15 | 15 |
16 #include "webrtc/base/checks.h" | 16 #include "webrtc/base/checks.h" |
17 #include "webrtc/base/logging.h" | 17 #include "webrtc/base/logging.h" |
18 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" | 18 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" |
19 #include "webrtc/modules/rtp_rtcp/source/rtp_receiver_video.h" | 19 #include "webrtc/modules/rtp_rtcp/source/rtp_receiver_video.h" |
| 20 #include "webrtc/system_wrappers/include/clock.h" |
20 | 21 |
21 namespace webrtc { | 22 namespace webrtc { |
22 | 23 |
23 UlpfecReceiver* UlpfecReceiver::Create(RtpData* callback) { | 24 UlpfecReceiver* UlpfecReceiver::Create(RtpData* callback) { |
24 return new UlpfecReceiverImpl(callback); | 25 return new UlpfecReceiverImpl(callback); |
25 } | 26 } |
26 | 27 |
27 UlpfecReceiverImpl::UlpfecReceiverImpl(RtpData* callback) | 28 UlpfecReceiverImpl::UlpfecReceiverImpl(RtpData* callback) |
28 : recovered_packet_callback_(callback), | 29 : recovered_packet_callback_(callback), |
29 fec_(ForwardErrorCorrection::CreateUlpfec()) {} | 30 fec_(ForwardErrorCorrection::CreateUlpfec()) {} |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 return -1; | 119 return -1; |
119 } | 120 } |
120 // Check that the packet is long enough to contain data in the following | 121 // Check that the packet is long enough to contain data in the following |
121 // block. | 122 // block. |
122 if (block_length > payload_data_length - (red_header_length + 1)) { | 123 if (block_length > payload_data_length - (red_header_length + 1)) { |
123 LOG(LS_WARNING) << "Block length longer than packet."; | 124 LOG(LS_WARNING) << "Block length longer than packet."; |
124 return -1; | 125 return -1; |
125 } | 126 } |
126 } | 127 } |
127 ++packet_counter_.num_packets; | 128 ++packet_counter_.num_packets; |
| 129 if (packet_counter_.first_packet_time_ms == -1) { |
| 130 packet_counter_.first_packet_time_ms = |
| 131 Clock::GetRealTimeClock()->TimeInMilliseconds(); |
| 132 } |
128 | 133 |
129 std::unique_ptr<ForwardErrorCorrection::ReceivedPacket> | 134 std::unique_ptr<ForwardErrorCorrection::ReceivedPacket> |
130 second_received_packet; | 135 second_received_packet; |
131 if (block_length > 0) { | 136 if (block_length > 0) { |
132 // Handle block length, split into two packets. | 137 // Handle block length, split into two packets. |
133 red_header_length = 5; | 138 red_header_length = 5; |
134 | 139 |
135 // Copy RTP header. | 140 // Copy RTP header. |
136 memcpy(received_packet->pkt->data, incoming_rtp_packet, | 141 memcpy(received_packet->pkt->data, incoming_rtp_packet, |
137 header.headerLength); | 142 header.headerLength); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 return -1; | 238 return -1; |
234 } | 239 } |
235 crit_sect_.Enter(); | 240 crit_sect_.Enter(); |
236 recovered_packet->returned = true; | 241 recovered_packet->returned = true; |
237 } | 242 } |
238 crit_sect_.Leave(); | 243 crit_sect_.Leave(); |
239 return 0; | 244 return 0; |
240 } | 245 } |
241 | 246 |
242 } // namespace webrtc | 247 } // namespace webrtc |
OLD | NEW |