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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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() { | |
180 // RFC 2032 | |
181 // 5.2.1. Full intra-frame Request (FIR) packet | |
182 | |
183 size_t length = 8; | |
184 uint8_t data[8]; | |
185 data[0] = 0x80; | |
186 data[1] = 192; | |
187 data[2] = 0; | |
188 data[3] = 1; // length | |
189 | |
190 ByteWriter<uint32_t>::WriteBigEndian(data + 4, _rtpSender.SSRC()); | |
191 | |
192 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), | |
193 "Video::IntraRequest", "seqnum", | |
194 _rtpSender.SequenceNumber()); | |
195 return _rtpSender.SendToNetwork(data, 0, length, -1, kDontStore, | |
196 RtpPacketSender::kNormalPriority); | |
197 } | |
198 | |
199 void RTPSenderVideo::SetGenericFECStatus(const bool enable, | 179 void RTPSenderVideo::SetGenericFECStatus(const bool enable, |
200 const uint8_t payloadTypeRED, | 180 const uint8_t payloadTypeRED, |
201 const uint8_t payloadTypeFEC) { | 181 const uint8_t payloadTypeFEC) { |
202 CriticalSectionScoped cs(crit_.get()); | 182 CriticalSectionScoped cs(crit_.get()); |
203 _fecEnabled = enable; | 183 _fecEnabled = enable; |
204 _payloadTypeRED = payloadTypeRED; | 184 _payloadTypeRED = payloadTypeRED; |
205 _payloadTypeFEC = payloadTypeFEC; | 185 _payloadTypeFEC = payloadTypeFEC; |
206 memset(&delta_fec_params_, 0, sizeof(delta_fec_params_)); | 186 memset(&delta_fec_params_, 0, sizeof(delta_fec_params_)); |
207 memset(&key_fec_params_, 0, sizeof(key_fec_params_)); | 187 memset(&key_fec_params_, 0, sizeof(key_fec_params_)); |
208 delta_fec_params_.max_fec_frames = key_fec_params_.max_fec_frames = 1; | 188 delta_fec_params_.max_fec_frames = key_fec_params_.max_fec_frames = 1; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 const RTPFragmentationHeader* fragmentation, | 232 const RTPFragmentationHeader* fragmentation, |
253 const RTPVideoHeader* rtpHdr) { | 233 const RTPVideoHeader* rtpHdr) { |
254 if (payloadSize == 0) { | 234 if (payloadSize == 0) { |
255 return -1; | 235 return -1; |
256 } | 236 } |
257 | 237 |
258 rtc::scoped_ptr<RtpPacketizer> packetizer( | 238 rtc::scoped_ptr<RtpPacketizer> packetizer( |
259 RtpPacketizer::Create(videoType, _rtpSender.MaxDataPayloadLength(), | 239 RtpPacketizer::Create(videoType, _rtpSender.MaxDataPayloadLength(), |
260 &(rtpHdr->codecHeader), frameType)); | 240 &(rtpHdr->codecHeader), frameType)); |
261 | 241 |
262 StorageType storage = kDontStore; | 242 StorageType storage; |
263 bool fec_enabled = false; | 243 bool fec_enabled; |
264 { | 244 { |
265 CriticalSectionScoped cs(crit_.get()); | 245 CriticalSectionScoped cs(crit_.get()); |
266 FecProtectionParams* fec_params = | 246 FecProtectionParams* fec_params = |
267 frameType == kVideoFrameKey ? &key_fec_params_ : &delta_fec_params_; | 247 frameType == kVideoFrameKey ? &key_fec_params_ : &delta_fec_params_; |
268 producer_fec_.SetFecParameters(fec_params, 0); | 248 producer_fec_.SetFecParameters(fec_params, 0); |
269 storage = packetizer->GetStorageType(_retransmissionSettings); | 249 storage = packetizer->GetStorageType(_retransmissionSettings); |
270 fec_enabled = _fecEnabled; | 250 fec_enabled = _fecEnabled; |
271 } | 251 } |
272 | 252 |
273 // Register CVO rtp header extension at the first time when we receive a frame | 253 // Register CVO rtp header extension at the first time when we receive a frame |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 CriticalSectionScoped cs(crit_.get()); | 350 CriticalSectionScoped cs(crit_.get()); |
371 return _retransmissionSettings; | 351 return _retransmissionSettings; |
372 } | 352 } |
373 | 353 |
374 void RTPSenderVideo::SetSelectiveRetransmissions(uint8_t settings) { | 354 void RTPSenderVideo::SetSelectiveRetransmissions(uint8_t settings) { |
375 CriticalSectionScoped cs(crit_.get()); | 355 CriticalSectionScoped cs(crit_.get()); |
376 _retransmissionSettings = settings; | 356 _retransmissionSettings = settings; |
377 } | 357 } |
378 | 358 |
379 } // namespace webrtc | 359 } // namespace webrtc |
OLD | NEW |