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

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

Issue 1571283002: Fixes a bug which incorrectly logs incoming RTCP as outgoing. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 11 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
11 #include "webrtc/modules/rtp_rtcp/source/rtp_sender.h" 11 #include "webrtc/modules/rtp_rtcp/source/rtp_sender.h"
12 12
13 #include <stdlib.h> // srand 13 #include <stdlib.h> // srand
14 #include <algorithm> 14 #include <algorithm>
15 #include <utility> 15 #include <utility>
16 16
17 #include "webrtc/base/checks.h" 17 #include "webrtc/base/checks.h"
18 #include "webrtc/base/logging.h" 18 #include "webrtc/base/logging.h"
19 #include "webrtc/base/trace_event.h" 19 #include "webrtc/base/trace_event.h"
20 #include "webrtc/call.h"
21 #include "webrtc/call/rtc_event_log.h"
20 #include "webrtc/modules/rtp_rtcp/include/rtp_cvo.h" 22 #include "webrtc/modules/rtp_rtcp/include/rtp_cvo.h"
21 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" 23 #include "webrtc/modules/rtp_rtcp/source/byte_io.h"
22 #include "webrtc/modules/rtp_rtcp/source/rtp_sender_audio.h" 24 #include "webrtc/modules/rtp_rtcp/source/rtp_sender_audio.h"
23 #include "webrtc/modules/rtp_rtcp/source/rtp_sender_video.h" 25 #include "webrtc/modules/rtp_rtcp/source/rtp_sender_video.h"
24 #include "webrtc/modules/rtp_rtcp/source/time_util.h" 26 #include "webrtc/modules/rtp_rtcp/source/time_util.h"
25 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" 27 #include "webrtc/system_wrappers/include/critical_section_wrapper.h"
26 #include "webrtc/system_wrappers/include/tick_util.h" 28 #include "webrtc/system_wrappers/include/tick_util.h"
27 29
28 namespace webrtc { 30 namespace webrtc {
29 31
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 RTPSender::RTPSender( 117 RTPSender::RTPSender(
116 bool audio, 118 bool audio,
117 Clock* clock, 119 Clock* clock,
118 Transport* transport, 120 Transport* transport,
119 RtpAudioFeedback* audio_feedback, 121 RtpAudioFeedback* audio_feedback,
120 RtpPacketSender* paced_sender, 122 RtpPacketSender* paced_sender,
121 TransportSequenceNumberAllocator* sequence_number_allocator, 123 TransportSequenceNumberAllocator* sequence_number_allocator,
122 TransportFeedbackObserver* transport_feedback_observer, 124 TransportFeedbackObserver* transport_feedback_observer,
123 BitrateStatisticsObserver* bitrate_callback, 125 BitrateStatisticsObserver* bitrate_callback,
124 FrameCountObserver* frame_count_observer, 126 FrameCountObserver* frame_count_observer,
125 SendSideDelayObserver* send_side_delay_observer) 127 SendSideDelayObserver* send_side_delay_observer,
128 RtcEventLog* event_log)
126 : clock_(clock), 129 : clock_(clock),
127 // TODO(holmer): Remove this conversion when we remove the use of 130 // TODO(holmer): Remove this conversion when we remove the use of
128 // TickTime. 131 // TickTime.
129 clock_delta_ms_(clock_->TimeInMilliseconds() - 132 clock_delta_ms_(clock_->TimeInMilliseconds() -
130 TickTime::MillisecondTimestamp()), 133 TickTime::MillisecondTimestamp()),
131 random_(clock_->TimeInMicroseconds()), 134 random_(clock_->TimeInMicroseconds()),
132 bitrates_(new BitrateAggregator(bitrate_callback)), 135 bitrates_(new BitrateAggregator(bitrate_callback)),
133 total_bitrate_sent_(clock, bitrates_->total_bitrate_observer()), 136 total_bitrate_sent_(clock, bitrates_->total_bitrate_observer()),
134 audio_configured_(audio), 137 audio_configured_(audio),
135 audio_(audio ? new RTPSenderAudio(clock, this, audio_feedback) : nullptr), 138 audio_(audio ? new RTPSenderAudio(clock, this, audio_feedback) : nullptr),
(...skipping 18 matching lines...) Expand all
154 // NACK. 157 // NACK.
155 nack_byte_count_times_(), 158 nack_byte_count_times_(),
156 nack_byte_count_(), 159 nack_byte_count_(),
157 nack_bitrate_(clock, bitrates_->retransmit_bitrate_observer()), 160 nack_bitrate_(clock, bitrates_->retransmit_bitrate_observer()),
158 packet_history_(clock), 161 packet_history_(clock),
159 // Statistics 162 // Statistics
160 statistics_crit_(CriticalSectionWrapper::CreateCriticalSection()), 163 statistics_crit_(CriticalSectionWrapper::CreateCriticalSection()),
161 rtp_stats_callback_(NULL), 164 rtp_stats_callback_(NULL),
162 frame_count_observer_(frame_count_observer), 165 frame_count_observer_(frame_count_observer),
163 send_side_delay_observer_(send_side_delay_observer), 166 send_side_delay_observer_(send_side_delay_observer),
167 event_log_(event_log),
164 // RTP variables 168 // RTP variables
165 start_timestamp_forced_(false), 169 start_timestamp_forced_(false),
166 start_timestamp_(0), 170 start_timestamp_(0),
167 ssrc_db_(*SSRCDatabase::GetSSRCDatabase()), 171 ssrc_db_(*SSRCDatabase::GetSSRCDatabase()),
168 remote_ssrc_(0), 172 remote_ssrc_(0),
169 sequence_number_forced_(false), 173 sequence_number_forced_(false),
170 ssrc_forced_(false), 174 ssrc_forced_(false),
171 timestamp_(0), 175 timestamp_(0),
172 capture_time_ms_(0), 176 capture_time_ms_(0),
173 last_timestamp_time_ms_(0), 177 last_timestamp_time_ms_(0),
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after
1052 return -1; 1056 return -1;
1053 } 1057 }
1054 1058
1055 if (paced_sender_) { 1059 if (paced_sender_) {
1056 // Correct offset between implementations of millisecond time stamps in 1060 // Correct offset between implementations of millisecond time stamps in
1057 // TickTime and Clock. 1061 // TickTime and Clock.
1058 int64_t corrected_time_ms = capture_time_ms + clock_delta_ms_; 1062 int64_t corrected_time_ms = capture_time_ms + clock_delta_ms_;
1059 paced_sender_->InsertPacket(priority, rtp_header.ssrc, 1063 paced_sender_->InsertPacket(priority, rtp_header.ssrc,
1060 rtp_header.sequenceNumber, corrected_time_ms, 1064 rtp_header.sequenceNumber, corrected_time_ms,
1061 payload_length, false); 1065 payload_length, false);
1066 if (event_log_) {
1067 event_log_->LogRtpHeader(true, MediaType::ANY, buffer,
the sun 2016/01/11 12:36:16 Add a test case for this which uses a MockRtcEvent
terelius 2016/01/13 17:08:18 Done.
1068 payload_length + rtp_header_length);
1069 }
1062 if (last_capture_time_ms_sent_ == 0 || 1070 if (last_capture_time_ms_sent_ == 0 ||
1063 corrected_time_ms > last_capture_time_ms_sent_) { 1071 corrected_time_ms > last_capture_time_ms_sent_) {
1064 last_capture_time_ms_sent_ = corrected_time_ms; 1072 last_capture_time_ms_sent_ = corrected_time_ms;
1065 TRACE_EVENT_ASYNC_BEGIN1(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"), 1073 TRACE_EVENT_ASYNC_BEGIN1(TRACE_DISABLED_BY_DEFAULT("webrtc_rtp"),
1066 "PacedSend", corrected_time_ms, 1074 "PacedSend", corrected_time_ms,
1067 "capture_time_ms", corrected_time_ms); 1075 "capture_time_ms", corrected_time_ms);
1068 } 1076 }
1069 return 0; 1077 return 0;
1070 } 1078 }
1071 if (capture_time_ms > 0) { 1079 if (capture_time_ms > 0) {
1072 UpdateDelayStatistics(capture_time_ms, now_ms); 1080 UpdateDelayStatistics(capture_time_ms, now_ms);
1073 } 1081 }
1074 1082
1075 size_t length = payload_length + rtp_header_length; 1083 size_t length = payload_length + rtp_header_length;
1076 bool sent = SendPacketToNetwork(buffer, length, PacketOptions()); 1084 bool sent = SendPacketToNetwork(buffer, length, PacketOptions());
1085 if (event_log_) {
1086 event_log_->LogRtpHeader(true, MediaType::ANY, buffer, length);
1087 }
1077 1088
1078 // Mark the packet as sent in the history even if send failed. Dropping a 1089 // Mark the packet as sent in the history even if send failed. Dropping a
1079 // packet here should be treated as any other packet drop so we should be 1090 // packet here should be treated as any other packet drop so we should be
1080 // ready for a retransmission. 1091 // ready for a retransmission.
1081 packet_history_.SetSent(rtp_header.sequenceNumber); 1092 packet_history_.SetSent(rtp_header.sequenceNumber);
1082 1093
1083 if (!sent) 1094 if (!sent)
1084 return -1; 1095 return -1;
1085 1096
1086 { 1097 {
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after
1906 CriticalSectionScoped lock(send_critsect_.get()); 1917 CriticalSectionScoped lock(send_critsect_.get());
1907 1918
1908 RtpState state; 1919 RtpState state;
1909 state.sequence_number = sequence_number_rtx_; 1920 state.sequence_number = sequence_number_rtx_;
1910 state.start_timestamp = start_timestamp_; 1921 state.start_timestamp = start_timestamp_;
1911 1922
1912 return state; 1923 return state;
1913 } 1924 }
1914 1925
1915 } // namespace webrtc 1926 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698