Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(290)

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtp_sender.cc

Issue 1392513002: Disable pacer disabling. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Remove RTP FIR + test refactoring Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 if (paced_sender_) { 706 if (paced_sender_) {
707 RtpUtility::RtpHeaderParser rtp_parser(data_buffer, length); 707 RtpUtility::RtpHeaderParser rtp_parser(data_buffer, length);
708 RTPHeader header; 708 RTPHeader header;
709 if (!rtp_parser.Parse(header)) { 709 if (!rtp_parser.Parse(header)) {
710 assert(false); 710 assert(false);
711 return -1; 711 return -1;
712 } 712 }
713 // Convert from TickTime to Clock since capture_time_ms is based on 713 // Convert from TickTime to Clock since capture_time_ms is based on
714 // TickTime. 714 // TickTime.
715 int64_t corrected_capture_tims_ms = capture_time_ms + clock_delta_ms_; 715 int64_t corrected_capture_tims_ms = capture_time_ms + clock_delta_ms_;
716 if (!paced_sender_->SendPacket( 716 paced_sender_->InsertPacket(
717 RtpPacketSender::kHighPriority, header.ssrc, header.sequenceNumber, 717 RtpPacketSender::kHighPriority, header.ssrc, header.sequenceNumber,
718 corrected_capture_tims_ms, length - header.headerLength, true)) { 718 corrected_capture_tims_ms, length - header.headerLength, true);
719 // We can't send the packet right now. 719
720 // We will be called when it is time. 720 return length;
721 return length;
722 }
723 } 721 }
724 int rtx = kRtxOff; 722 int rtx = kRtxOff;
725 { 723 {
726 CriticalSectionScoped lock(send_critsect_.get()); 724 CriticalSectionScoped lock(send_critsect_.get());
727 rtx = rtx_; 725 rtx = rtx_;
728 } 726 }
729 if (!PrepareAndSendPacket(data_buffer, length, capture_time_ms, 727 if (!PrepareAndSendPacket(data_buffer, length, capture_time_ms,
730 (rtx & kRtxRetransmitted) > 0, true)) { 728 (rtx & kRtxRetransmitted) > 0, true)) {
731 return -1; 729 return -1;
732 } 730 }
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 1029
1032 UpdateAbsoluteSendTime(buffer, payload_length + rtp_header_length, 1030 UpdateAbsoluteSendTime(buffer, payload_length + rtp_header_length,
1033 rtp_header, now_ms); 1031 rtp_header, now_ms);
1034 1032
1035 // Used for NACK and to spread out the transmission of packets. 1033 // Used for NACK and to spread out the transmission of packets.
1036 if (packet_history_.PutRTPPacket(buffer, rtp_header_length + payload_length, 1034 if (packet_history_.PutRTPPacket(buffer, rtp_header_length + payload_length,
1037 capture_time_ms, storage) != 0) { 1035 capture_time_ms, storage) != 0) {
1038 return -1; 1036 return -1;
1039 } 1037 }
1040 1038
1041 if (paced_sender_ && storage != kDontStore) { 1039 if (paced_sender_) {
1042 // Correct offset between implementations of millisecond time stamps in 1040 // Correct offset between implementations of millisecond time stamps in
1043 // TickTime and Clock. 1041 // TickTime and Clock.
1044 int64_t corrected_time_ms = capture_time_ms + clock_delta_ms_; 1042 int64_t corrected_time_ms = capture_time_ms + clock_delta_ms_;
1045 if (!paced_sender_->SendPacket(priority, rtp_header.ssrc, 1043 paced_sender_->InsertPacket(priority, rtp_header.ssrc,
1046 rtp_header.sequenceNumber, corrected_time_ms, 1044 rtp_header.sequenceNumber, corrected_time_ms,
1047 payload_length, false)) { 1045 payload_length, false);
1048 if (last_capture_time_ms_sent_ == 0 || 1046 if (last_capture_time_ms_sent_ == 0 ||
1049 corrected_time_ms > last_capture_time_ms_sent_) { 1047 corrected_time_ms > last_capture_time_ms_sent_) {
1050 last_capture_time_ms_sent_ = corrected_time_ms; 1048 last_capture_time_ms_sent_ = corrected_time_ms;
1051 TRACE_EVENT_ASYNC_BEGIN1(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), 1049 TRACE_EVENT_ASYNC_BEGIN1(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"),
1052 "PacedSend", corrected_time_ms, 1050 "PacedSend", corrected_time_ms,
1053 "capture_time_ms", corrected_time_ms); 1051 "capture_time_ms", corrected_time_ms);
1054 }
1055 // We can't send the packet right now.
1056 // We will be called when it is time.
1057 return 0;
1058 } 1052 }
1053 return 0;
1059 } 1054 }
1060 if (capture_time_ms > 0) { 1055 if (capture_time_ms > 0) {
1061 UpdateDelayStatistics(capture_time_ms, now_ms); 1056 UpdateDelayStatistics(capture_time_ms, now_ms);
1062 } 1057 }
1063 1058
1064 size_t length = payload_length + rtp_header_length; 1059 size_t length = payload_length + rtp_header_length;
1065 bool sent = SendPacketToNetwork(buffer, length, PacketOptions()); 1060 bool sent = SendPacketToNetwork(buffer, length, PacketOptions());
1066 1061
1067 if (storage != kDontStore) { 1062 // Mark the packet as sent in the history even if send failed. Dropping a
1068 // Mark the packet as sent in the history even if send failed. Dropping a 1063 // packet here should be treated as any other packet drop so we should be
1069 // packet here should be treated as any other packet drop so we should be 1064 // ready for a retransmission.
1070 // ready for a retransmission. 1065 packet_history_.SetSent(rtp_header.sequenceNumber);
1071 packet_history_.SetSent(rtp_header.sequenceNumber); 1066
1072 }
1073 if (!sent) 1067 if (!sent)
1074 return -1; 1068 return -1;
1075 1069
1076 { 1070 {
1077 CriticalSectionScoped lock(send_critsect_.get()); 1071 CriticalSectionScoped lock(send_critsect_.get());
1078 media_has_been_sent_ = true; 1072 media_has_been_sent_ = true;
1079 } 1073 }
1080 UpdateRtpStats(buffer, length, rtp_header, false, false); 1074 UpdateRtpStats(buffer, length, rtp_header, false, false);
1081 return 0; 1075 return 0;
1082 } 1076 }
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
1778 return video_->VideoCodecType(); 1772 return video_->VideoCodecType();
1779 } 1773 }
1780 1774
1781 uint32_t RTPSender::MaxConfiguredBitrateVideo() const { 1775 uint32_t RTPSender::MaxConfiguredBitrateVideo() const {
1782 if (audio_configured_) { 1776 if (audio_configured_) {
1783 return 0; 1777 return 0;
1784 } 1778 }
1785 return video_->MaxConfiguredBitrateVideo(); 1779 return video_->MaxConfiguredBitrateVideo();
1786 } 1780 }
1787 1781
1788 int32_t RTPSender::SendRTPIntraRequest() {
1789 if (audio_configured_) {
1790 return -1;
1791 }
1792 return video_->SendRTPIntraRequest();
1793 }
1794
1795 void RTPSender::SetGenericFECStatus(bool enable, 1782 void RTPSender::SetGenericFECStatus(bool enable,
1796 uint8_t payload_type_red, 1783 uint8_t payload_type_red,
1797 uint8_t payload_type_fec) { 1784 uint8_t payload_type_fec) {
1798 RTC_DCHECK(!audio_configured_); 1785 RTC_DCHECK(!audio_configured_);
1799 video_->SetGenericFECStatus(enable, payload_type_red, payload_type_fec); 1786 video_->SetGenericFECStatus(enable, payload_type_red, payload_type_fec);
1800 } 1787 }
1801 1788
1802 void RTPSender::GenericFECStatus(bool* enable, 1789 void RTPSender::GenericFECStatus(bool* enable,
1803 uint8_t* payload_type_red, 1790 uint8_t* payload_type_red,
1804 uint8_t* payload_type_fec) const { 1791 uint8_t* payload_type_fec) const {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1905 CriticalSectionScoped lock(send_critsect_.get()); 1892 CriticalSectionScoped lock(send_critsect_.get());
1906 1893
1907 RtpState state; 1894 RtpState state;
1908 state.sequence_number = sequence_number_rtx_; 1895 state.sequence_number = sequence_number_rtx_;
1909 state.start_timestamp = start_timestamp_; 1896 state.start_timestamp = start_timestamp_;
1910 1897
1911 return state; 1898 return state;
1912 } 1899 }
1913 1900
1914 } // namespace webrtc 1901 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_sender.h ('k') | webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698