| 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 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 97 |
| 98 void RTPSenderVideo::SendVideoPacket(uint8_t* data_buffer, | 98 void RTPSenderVideo::SendVideoPacket(uint8_t* data_buffer, |
| 99 const size_t payload_length, | 99 const size_t payload_length, |
| 100 const size_t rtp_header_length, | 100 const size_t rtp_header_length, |
| 101 uint16_t seq_num, | 101 uint16_t seq_num, |
| 102 const uint32_t capture_timestamp, | 102 const uint32_t capture_timestamp, |
| 103 int64_t capture_time_ms, | 103 int64_t capture_time_ms, |
| 104 StorageType storage) { | 104 StorageType storage) { |
| 105 if (_rtpSender.SendToNetwork(data_buffer, payload_length, rtp_header_length, | 105 if (_rtpSender.SendToNetwork(data_buffer, payload_length, rtp_header_length, |
| 106 capture_time_ms, storage, | 106 capture_time_ms, storage, |
| 107 PacedSender::kNormalPriority) == 0) { | 107 RtpPacketSender::kNormalPriority) == 0) { |
| 108 _videoBitrate.Update(payload_length + rtp_header_length); | 108 _videoBitrate.Update(payload_length + rtp_header_length); |
| 109 TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), | 109 TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), |
| 110 "Video::PacketNormal", "timestamp", capture_timestamp, | 110 "Video::PacketNormal", "timestamp", capture_timestamp, |
| 111 "seqnum", seq_num); | 111 "seqnum", seq_num); |
| 112 } else { | 112 } else { |
| 113 LOG(LS_WARNING) << "Failed to send video packet " << seq_num; | 113 LOG(LS_WARNING) << "Failed to send video packet " << seq_num; |
| 114 } | 114 } |
| 115 } | 115 } |
| 116 | 116 |
| 117 void RTPSenderVideo::SendVideoPacketAsRed(uint8_t* data_buffer, | 117 void RTPSenderVideo::SendVideoPacketAsRed(uint8_t* data_buffer, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 143 _payloadTypeRED, _payloadTypeFEC, next_fec_sequence_number, | 143 _payloadTypeRED, _payloadTypeFEC, next_fec_sequence_number, |
| 144 rtp_header_length); | 144 rtp_header_length); |
| 145 RTC_DCHECK_EQ(num_fec_packets, fec_packets.size()); | 145 RTC_DCHECK_EQ(num_fec_packets, fec_packets.size()); |
| 146 if (_retransmissionSettings & kRetransmitFECPackets) | 146 if (_retransmissionSettings & kRetransmitFECPackets) |
| 147 fec_storage = kAllowRetransmission; | 147 fec_storage = kAllowRetransmission; |
| 148 } | 148 } |
| 149 } | 149 } |
| 150 if (_rtpSender.SendToNetwork( | 150 if (_rtpSender.SendToNetwork( |
| 151 red_packet->data(), red_packet->length() - rtp_header_length, | 151 red_packet->data(), red_packet->length() - rtp_header_length, |
| 152 rtp_header_length, capture_time_ms, media_packet_storage, | 152 rtp_header_length, capture_time_ms, media_packet_storage, |
| 153 PacedSender::kNormalPriority) == 0) { | 153 RtpPacketSender::kNormalPriority) == 0) { |
| 154 _videoBitrate.Update(red_packet->length()); | 154 _videoBitrate.Update(red_packet->length()); |
| 155 TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), | 155 TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), |
| 156 "Video::PacketRed", "timestamp", capture_timestamp, | 156 "Video::PacketRed", "timestamp", capture_timestamp, |
| 157 "seqnum", media_seq_num); | 157 "seqnum", media_seq_num); |
| 158 } else { | 158 } else { |
| 159 LOG(LS_WARNING) << "Failed to send RED packet " << media_seq_num; | 159 LOG(LS_WARNING) << "Failed to send RED packet " << media_seq_num; |
| 160 } | 160 } |
| 161 for (RedPacket* fec_packet : fec_packets) { | 161 for (RedPacket* fec_packet : fec_packets) { |
| 162 if (_rtpSender.SendToNetwork( | 162 if (_rtpSender.SendToNetwork( |
| 163 fec_packet->data(), fec_packet->length() - rtp_header_length, | 163 fec_packet->data(), fec_packet->length() - rtp_header_length, |
| 164 rtp_header_length, capture_time_ms, fec_storage, | 164 rtp_header_length, capture_time_ms, fec_storage, |
| 165 PacedSender::kNormalPriority) == 0) { | 165 RtpPacketSender::kNormalPriority) == 0) { |
| 166 _fecOverheadRate.Update(fec_packet->length()); | 166 _fecOverheadRate.Update(fec_packet->length()); |
| 167 TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), | 167 TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), |
| 168 "Video::PacketFec", "timestamp", capture_timestamp, | 168 "Video::PacketFec", "timestamp", capture_timestamp, |
| 169 "seqnum", next_fec_sequence_number); | 169 "seqnum", next_fec_sequence_number); |
| 170 } else { | 170 } else { |
| 171 LOG(LS_WARNING) << "Failed to send FEC packet " | 171 LOG(LS_WARNING) << "Failed to send FEC packet " |
| 172 << next_fec_sequence_number; | 172 << next_fec_sequence_number; |
| 173 } | 173 } |
| 174 delete fec_packet; | 174 delete fec_packet; |
| 175 ++next_fec_sequence_number; | 175 ++next_fec_sequence_number; |
| 176 } | 176 } |
| 177 } | 177 } |
| 178 | 178 |
| 179 int32_t RTPSenderVideo::SendRTPIntraRequest() { | 179 int32_t RTPSenderVideo::SendRTPIntraRequest() { |
| 180 // RFC 2032 | 180 // RFC 2032 |
| 181 // 5.2.1. Full intra-frame Request (FIR) packet | 181 // 5.2.1. Full intra-frame Request (FIR) packet |
| 182 | 182 |
| 183 size_t length = 8; | 183 size_t length = 8; |
| 184 uint8_t data[8]; | 184 uint8_t data[8]; |
| 185 data[0] = 0x80; | 185 data[0] = 0x80; |
| 186 data[1] = 192; | 186 data[1] = 192; |
| 187 data[2] = 0; | 187 data[2] = 0; |
| 188 data[3] = 1; // length | 188 data[3] = 1; // length |
| 189 | 189 |
| 190 ByteWriter<uint32_t>::WriteBigEndian(data + 4, _rtpSender.SSRC()); | 190 ByteWriter<uint32_t>::WriteBigEndian(data + 4, _rtpSender.SSRC()); |
| 191 | 191 |
| 192 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), | 192 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), |
| 193 "Video::IntraRequest", "seqnum", | 193 "Video::IntraRequest", "seqnum", |
| 194 _rtpSender.SequenceNumber()); | 194 _rtpSender.SequenceNumber()); |
| 195 return _rtpSender.SendToNetwork( | 195 return _rtpSender.SendToNetwork(data, 0, length, -1, kDontStore, |
| 196 data, 0, length, -1, kDontStore, PacedSender::kNormalPriority); | 196 RtpPacketSender::kNormalPriority); |
| 197 } | 197 } |
| 198 | 198 |
| 199 void RTPSenderVideo::SetGenericFECStatus(const bool enable, | 199 void RTPSenderVideo::SetGenericFECStatus(const bool enable, |
| 200 const uint8_t payloadTypeRED, | 200 const uint8_t payloadTypeRED, |
| 201 const uint8_t payloadTypeFEC) { | 201 const uint8_t payloadTypeFEC) { |
| 202 CriticalSectionScoped cs(crit_.get()); | 202 CriticalSectionScoped cs(crit_.get()); |
| 203 _fecEnabled = enable; | 203 _fecEnabled = enable; |
| 204 _payloadTypeRED = payloadTypeRED; | 204 _payloadTypeRED = payloadTypeRED; |
| 205 _payloadTypeFEC = payloadTypeFEC; | 205 _payloadTypeFEC = payloadTypeFEC; |
| 206 memset(&delta_fec_params_, 0, sizeof(delta_fec_params_)); | 206 memset(&delta_fec_params_, 0, sizeof(delta_fec_params_)); |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 CriticalSectionScoped cs(crit_.get()); | 370 CriticalSectionScoped cs(crit_.get()); |
| 371 return _retransmissionSettings; | 371 return _retransmissionSettings; |
| 372 } | 372 } |
| 373 | 373 |
| 374 void RTPSenderVideo::SetSelectiveRetransmissions(uint8_t settings) { | 374 void RTPSenderVideo::SetSelectiveRetransmissions(uint8_t settings) { |
| 375 CriticalSectionScoped cs(crit_.get()); | 375 CriticalSectionScoped cs(crit_.get()); |
| 376 _retransmissionSettings = settings; | 376 _retransmissionSettings = settings; |
| 377 } | 377 } |
| 378 | 378 |
| 379 } // namespace webrtc | 379 } // namespace webrtc |
| OLD | NEW |