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

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

Issue 1765443002: Added log messages for important call setup events: first packet sent/received (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 9 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 18 matching lines...) Expand all
29 RtpData* incoming_payload_callback, 29 RtpData* incoming_payload_callback,
30 RtpFeedback* incoming_messages_callback, 30 RtpFeedback* incoming_messages_callback,
31 RTPPayloadRegistry* rtp_payload_registry) { 31 RTPPayloadRegistry* rtp_payload_registry) {
32 if (!incoming_payload_callback) 32 if (!incoming_payload_callback)
33 incoming_payload_callback = NullObjectRtpData(); 33 incoming_payload_callback = NullObjectRtpData();
34 if (!incoming_messages_callback) 34 if (!incoming_messages_callback)
35 incoming_messages_callback = NullObjectRtpFeedback(); 35 incoming_messages_callback = NullObjectRtpFeedback();
36 return new RtpReceiverImpl( 36 return new RtpReceiverImpl(
37 clock, NullObjectRtpAudioFeedback(), incoming_messages_callback, 37 clock, NullObjectRtpAudioFeedback(), incoming_messages_callback,
38 rtp_payload_registry, 38 rtp_payload_registry,
39 RTPReceiverStrategy::CreateVideoStrategy(incoming_payload_callback)); 39 RTPReceiverStrategy::CreateVideoStrategy(incoming_payload_callback),
40 false /*is_audio*/);
40 } 41 }
41 42
42 RtpReceiver* RtpReceiver::CreateAudioReceiver( 43 RtpReceiver* RtpReceiver::CreateAudioReceiver(
43 Clock* clock, 44 Clock* clock,
44 RtpAudioFeedback* incoming_audio_feedback, 45 RtpAudioFeedback* incoming_audio_feedback,
45 RtpData* incoming_payload_callback, 46 RtpData* incoming_payload_callback,
46 RtpFeedback* incoming_messages_callback, 47 RtpFeedback* incoming_messages_callback,
47 RTPPayloadRegistry* rtp_payload_registry) { 48 RTPPayloadRegistry* rtp_payload_registry) {
48 if (!incoming_audio_feedback) 49 if (!incoming_audio_feedback)
49 incoming_audio_feedback = NullObjectRtpAudioFeedback(); 50 incoming_audio_feedback = NullObjectRtpAudioFeedback();
50 if (!incoming_payload_callback) 51 if (!incoming_payload_callback)
51 incoming_payload_callback = NullObjectRtpData(); 52 incoming_payload_callback = NullObjectRtpData();
52 if (!incoming_messages_callback) 53 if (!incoming_messages_callback)
53 incoming_messages_callback = NullObjectRtpFeedback(); 54 incoming_messages_callback = NullObjectRtpFeedback();
54 return new RtpReceiverImpl( 55 return new RtpReceiverImpl(
55 clock, incoming_audio_feedback, incoming_messages_callback, 56 clock, incoming_audio_feedback, incoming_messages_callback,
56 rtp_payload_registry, 57 rtp_payload_registry,
57 RTPReceiverStrategy::CreateAudioStrategy(incoming_payload_callback, 58 RTPReceiverStrategy::CreateAudioStrategy(incoming_payload_callback,
58 incoming_audio_feedback)); 59 incoming_audio_feedback),
60 true /*is_audio*/);
59 } 61 }
60 62
61 RtpReceiverImpl::RtpReceiverImpl( 63 RtpReceiverImpl::RtpReceiverImpl(
62 Clock* clock, 64 Clock* clock,
63 RtpAudioFeedback* incoming_audio_messages_callback, 65 RtpAudioFeedback* incoming_audio_messages_callback,
64 RtpFeedback* incoming_messages_callback, 66 RtpFeedback* incoming_messages_callback,
65 RTPPayloadRegistry* rtp_payload_registry, 67 RTPPayloadRegistry* rtp_payload_registry,
66 RTPReceiverStrategy* rtp_media_receiver) 68 RTPReceiverStrategy* rtp_media_receiver,
69 bool is_audio)
67 : clock_(clock), 70 : clock_(clock),
68 rtp_payload_registry_(rtp_payload_registry), 71 rtp_payload_registry_(rtp_payload_registry),
69 rtp_media_receiver_(rtp_media_receiver), 72 rtp_media_receiver_(rtp_media_receiver),
73 is_audio_(is_audio),
70 cb_rtp_feedback_(incoming_messages_callback), 74 cb_rtp_feedback_(incoming_messages_callback),
71 critical_section_rtp_receiver_( 75 critical_section_rtp_receiver_(
72 CriticalSectionWrapper::CreateCriticalSection()), 76 CriticalSectionWrapper::CreateCriticalSection()),
73 last_receive_time_(0), 77 last_receive_time_(0),
74 last_received_payload_length_(0), 78 last_received_payload_length_(0),
75 ssrc_(0), 79 ssrc_(0),
76 num_csrcs_(0), 80 num_csrcs_(0),
77 current_remote_csrc_(), 81 current_remote_csrc_(),
78 last_received_timestamp_(0), 82 last_received_timestamp_(0),
79 last_received_frame_time_ms_(-1), 83 last_received_frame_time_ms_(-1),
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 return false; 182 return false;
179 } 183 }
180 184
181 WebRtcRTPHeader webrtc_rtp_header; 185 WebRtcRTPHeader webrtc_rtp_header;
182 memset(&webrtc_rtp_header, 0, sizeof(webrtc_rtp_header)); 186 memset(&webrtc_rtp_header, 0, sizeof(webrtc_rtp_header));
183 webrtc_rtp_header.header = rtp_header; 187 webrtc_rtp_header.header = rtp_header;
184 CheckCSRC(webrtc_rtp_header); 188 CheckCSRC(webrtc_rtp_header);
185 189
186 size_t payload_data_length = payload_length - rtp_header.paddingLength; 190 size_t payload_data_length = payload_length - rtp_header.paddingLength;
187 191
192
188 bool is_first_packet_in_frame = false; 193 bool is_first_packet_in_frame = false;
189 { 194 {
190 CriticalSectionScoped lock(critical_section_rtp_receiver_.get()); 195 CriticalSectionScoped lock(critical_section_rtp_receiver_.get());
191 if (HaveReceivedFrame()) { 196 if (HaveReceivedFrame()) {
192 is_first_packet_in_frame = 197 is_first_packet_in_frame =
193 last_received_sequence_number_ + 1 == rtp_header.sequenceNumber && 198 last_received_sequence_number_ + 1 == rtp_header.sequenceNumber &&
194 last_received_timestamp_ != rtp_header.timestamp; 199 last_received_timestamp_ != rtp_header.timestamp;
195 } else { 200 } else {
196 is_first_packet_in_frame = true; 201 is_first_packet_in_frame = true;
197 } 202 }
198 } 203 }
199 204
200 int32_t ret_val = rtp_media_receiver_->ParseRtpPacket( 205 int32_t ret_val = rtp_media_receiver_->ParseRtpPacket(
201 &webrtc_rtp_header, payload_specific, is_red, payload, payload_length, 206 &webrtc_rtp_header, payload_specific, is_red, payload, payload_length,
202 clock_->TimeInMilliseconds(), is_first_packet_in_frame); 207 clock_->TimeInMilliseconds(), is_first_packet_in_frame);
203 208
204 if (ret_val < 0) { 209 if (ret_val < 0) {
205 return false; 210 return false;
206 } 211 }
207 212
213 bool is_first_packet_in_first_frame = false;
208 { 214 {
209 CriticalSectionScoped lock(critical_section_rtp_receiver_.get()); 215 CriticalSectionScoped lock(critical_section_rtp_receiver_.get());
210 216
217 is_first_packet_in_first_frame = (last_receive_time_ == 0);
211 last_receive_time_ = clock_->TimeInMilliseconds(); 218 last_receive_time_ = clock_->TimeInMilliseconds();
212 last_received_payload_length_ = payload_data_length; 219 last_received_payload_length_ = payload_data_length;
213 220
214 if (in_order) { 221 if (in_order) {
215 if (last_received_timestamp_ != rtp_header.timestamp) { 222 if (last_received_timestamp_ != rtp_header.timestamp) {
216 last_received_timestamp_ = rtp_header.timestamp; 223 last_received_timestamp_ = rtp_header.timestamp;
217 last_received_frame_time_ms_ = clock_->TimeInMilliseconds(); 224 last_received_frame_time_ms_ = clock_->TimeInMilliseconds();
218 } 225 }
219 last_received_sequence_number_ = rtp_header.sequenceNumber; 226 last_received_sequence_number_ = rtp_header.sequenceNumber;
220 } 227 }
221 } 228 }
229
230 if (is_first_packet_in_first_frame) {
231 LOG(LS_INFO) << "First RTP packet of the first " <<
232 (is_audio_ ? "audio" : "video") << " frame received";
pthatcher1 2016/03/05 01:17:05 Nit: I think I'd prefer the text to start with "Re
skvlad 2016/03/07 19:36:53 Done.
233 }
234
222 return true; 235 return true;
223 } 236 }
224 237
225 TelephoneEventHandler* RtpReceiverImpl::GetTelephoneEventHandler() { 238 TelephoneEventHandler* RtpReceiverImpl::GetTelephoneEventHandler() {
226 return rtp_media_receiver_->GetTelephoneEventHandler(); 239 return rtp_media_receiver_->GetTelephoneEventHandler();
227 } 240 }
228 241
229 bool RtpReceiverImpl::Timestamp(uint32_t* timestamp) const { 242 bool RtpReceiverImpl::Timestamp(uint32_t* timestamp) const {
230 CriticalSectionScoped lock(critical_section_rtp_receiver_.get()); 243 CriticalSectionScoped lock(critical_section_rtp_receiver_.get());
231 if (!HaveReceivedFrame()) 244 if (!HaveReceivedFrame())
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 // implementations might have CSRC 0 as a valid value. 491 // implementations might have CSRC 0 as a valid value.
479 if (num_csrcs_diff > 0) { 492 if (num_csrcs_diff > 0) {
480 cb_rtp_feedback_->OnIncomingCSRCChanged(0, true); 493 cb_rtp_feedback_->OnIncomingCSRCChanged(0, true);
481 } else if (num_csrcs_diff < 0) { 494 } else if (num_csrcs_diff < 0) {
482 cb_rtp_feedback_->OnIncomingCSRCChanged(0, false); 495 cb_rtp_feedback_->OnIncomingCSRCChanged(0, false);
483 } 496 }
484 } 497 }
485 } 498 }
486 499
487 } // namespace webrtc 500 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698