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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 audio_configured_(audio), | 126 audio_configured_(audio), |
127 audio_(audio ? new RTPSenderAudio(clock, this) : nullptr), | 127 audio_(audio ? new RTPSenderAudio(clock, this) : nullptr), |
128 video_(audio ? nullptr : new RTPSenderVideo(clock, this)), | 128 video_(audio ? nullptr : new RTPSenderVideo(clock, this)), |
129 paced_sender_(paced_sender), | 129 paced_sender_(paced_sender), |
130 transport_sequence_number_allocator_(sequence_number_allocator), | 130 transport_sequence_number_allocator_(sequence_number_allocator), |
131 transport_feedback_observer_(transport_feedback_observer), | 131 transport_feedback_observer_(transport_feedback_observer), |
132 last_capture_time_ms_sent_(0), | 132 last_capture_time_ms_sent_(0), |
133 transport_(transport), | 133 transport_(transport), |
134 sending_media_(true), // Default to sending media. | 134 sending_media_(true), // Default to sending media. |
135 max_payload_length_(IP_PACKET_SIZE - 28), // Default is IP-v4/UDP. | 135 max_payload_length_(IP_PACKET_SIZE - 28), // Default is IP-v4/UDP. |
136 packet_over_head_(28), | |
137 payload_type_(-1), | 136 payload_type_(-1), |
138 payload_type_map_(), | 137 payload_type_map_(), |
139 rtp_header_extension_map_(), | 138 rtp_header_extension_map_(), |
140 transmission_time_offset_(0), | 139 transmission_time_offset_(0), |
141 absolute_send_time_(0), | 140 absolute_send_time_(0), |
142 rotation_(kVideoRotation_0), | 141 rotation_(kVideoRotation_0), |
143 cvo_mode_(kCVONone), | 142 cvo_mode_(kCVONone), |
144 transport_sequence_number_(0), | 143 transport_sequence_number_(0), |
145 // NACK. | 144 // NACK. |
146 nack_byte_count_times_(), | 145 nack_byte_count_times_(), |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 | 367 |
369 int8_t RTPSender::SendPayloadType() const { | 368 int8_t RTPSender::SendPayloadType() const { |
370 rtc::CritScope lock(&send_critsect_); | 369 rtc::CritScope lock(&send_critsect_); |
371 return payload_type_; | 370 return payload_type_; |
372 } | 371 } |
373 | 372 |
374 int RTPSender::SendPayloadFrequency() const { | 373 int RTPSender::SendPayloadFrequency() const { |
375 return audio_ != NULL ? audio_->AudioFrequency() : kVideoPayloadTypeFrequency; | 374 return audio_ != NULL ? audio_->AudioFrequency() : kVideoPayloadTypeFrequency; |
376 } | 375 } |
377 | 376 |
378 int32_t RTPSender::SetMaxPayloadLength(size_t max_payload_length, | 377 void RTPSender::SetMaxPayloadLength(size_t max_payload_length) { |
379 uint16_t packet_over_head) { | |
380 // Sanity check. | 378 // Sanity check. |
381 RTC_DCHECK(max_payload_length >= 100 && max_payload_length <= IP_PACKET_SIZE) | 379 RTC_DCHECK(max_payload_length >= 100 && max_payload_length <= IP_PACKET_SIZE) |
382 << "Invalid max payload length: " << max_payload_length; | 380 << "Invalid max payload length: " << max_payload_length; |
383 rtc::CritScope lock(&send_critsect_); | 381 rtc::CritScope lock(&send_critsect_); |
384 max_payload_length_ = max_payload_length; | 382 max_payload_length_ = max_payload_length; |
385 packet_over_head_ = packet_over_head; | |
386 return 0; | |
387 } | 383 } |
388 | 384 |
389 size_t RTPSender::MaxDataPayloadLength() const { | 385 size_t RTPSender::MaxDataPayloadLength() const { |
390 int rtx; | 386 int rtx; |
391 { | 387 { |
392 rtc::CritScope lock(&send_critsect_); | 388 rtc::CritScope lock(&send_critsect_); |
393 rtx = rtx_; | 389 rtx = rtx_; |
394 } | 390 } |
395 if (audio_configured_) { | 391 if (audio_configured_) { |
396 return max_payload_length_ - RTPHeaderLength(); | 392 return max_payload_length_ - RTPHeaderLength(); |
397 } else { | 393 } else { |
398 return max_payload_length_ - RTPHeaderLength() // RTP overhead. | 394 return max_payload_length_ - RTPHeaderLength() // RTP overhead. |
399 - video_->FECPacketOverhead() // FEC/ULP/RED overhead. | 395 - video_->FECPacketOverhead() // FEC/ULP/RED overhead. |
400 - ((rtx) ? 2 : 0); // RTX overhead. | 396 - ((rtx) ? 2 : 0); // RTX overhead. |
401 } | 397 } |
402 } | 398 } |
403 | 399 |
404 size_t RTPSender::MaxPayloadLength() const { | 400 size_t RTPSender::MaxPayloadLength() const { |
405 return max_payload_length_; | 401 return max_payload_length_; |
406 } | 402 } |
407 | 403 |
408 uint16_t RTPSender::PacketOverHead() const { return packet_over_head_; } | |
409 | |
410 void RTPSender::SetRtxStatus(int mode) { | 404 void RTPSender::SetRtxStatus(int mode) { |
411 rtc::CritScope lock(&send_critsect_); | 405 rtc::CritScope lock(&send_critsect_); |
412 rtx_ = mode; | 406 rtx_ = mode; |
413 } | 407 } |
414 | 408 |
415 int RTPSender::RtxStatus() const { | 409 int RTPSender::RtxStatus() const { |
416 rtc::CritScope lock(&send_critsect_); | 410 rtc::CritScope lock(&send_critsect_); |
417 return rtx_; | 411 return rtx_; |
418 } | 412 } |
419 | 413 |
(...skipping 1490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1910 rtc::CritScope lock(&send_critsect_); | 1904 rtc::CritScope lock(&send_critsect_); |
1911 | 1905 |
1912 RtpState state; | 1906 RtpState state; |
1913 state.sequence_number = sequence_number_rtx_; | 1907 state.sequence_number = sequence_number_rtx_; |
1914 state.start_timestamp = start_timestamp_; | 1908 state.start_timestamp = start_timestamp_; |
1915 | 1909 |
1916 return state; | 1910 return state; |
1917 } | 1911 } |
1918 | 1912 |
1919 } // namespace webrtc | 1913 } // namespace webrtc |
OLD | NEW |