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

Side by Side Diff: webrtc/call/rtc_event_log.cc

Issue 1419523004: Skip logging RTCP messages of type SDES and APP. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Major rebase Created 5 years, 1 month 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
« no previous file with comments | « no previous file | webrtc/call/rtc_event_log.proto » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 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/call/rtc_event_log.h" 11 #include "webrtc/call/rtc_event_log.h"
12 12
13 #include <deque> 13 #include <deque>
14 #include <vector> 14 #include <vector>
15 15
16 #include "webrtc/base/checks.h" 16 #include "webrtc/base/checks.h"
17 #include "webrtc/base/criticalsection.h" 17 #include "webrtc/base/criticalsection.h"
18 #include "webrtc/base/thread_annotations.h" 18 #include "webrtc/base/thread_annotations.h"
19 #include "webrtc/call.h" 19 #include "webrtc/call.h"
20 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
20 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" 21 #include "webrtc/modules/rtp_rtcp/source/byte_io.h"
22 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h"
21 #include "webrtc/system_wrappers/include/clock.h" 23 #include "webrtc/system_wrappers/include/clock.h"
22 #include "webrtc/system_wrappers/include/file_wrapper.h" 24 #include "webrtc/system_wrappers/include/file_wrapper.h"
23 25
24 #ifdef ENABLE_RTC_EVENT_LOG 26 #ifdef ENABLE_RTC_EVENT_LOG
25 // Files generated at build-time by the protobuf compiler. 27 // Files generated at build-time by the protobuf compiler.
26 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD 28 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD
27 #include "external/webrtc/webrtc/call/rtc_event_log.pb.h" 29 #include "external/webrtc/webrtc/call/rtc_event_log.pb.h"
28 #else 30 #else
29 #include "webrtc/call/rtc_event_log.pb.h" 31 #include "webrtc/call/rtc_event_log.pb.h"
30 #endif 32 #endif
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 rtclog::Event event; 264 rtclog::Event event;
263 event.set_timestamp_us(clock_->TimeInMicroseconds()); 265 event.set_timestamp_us(clock_->TimeInMicroseconds());
264 event.set_type(rtclog::Event::VIDEO_RECEIVER_CONFIG_EVENT); 266 event.set_type(rtclog::Event::VIDEO_RECEIVER_CONFIG_EVENT);
265 267
266 rtclog::VideoReceiveConfig* receiver_config = 268 rtclog::VideoReceiveConfig* receiver_config =
267 event.mutable_video_receiver_config(); 269 event.mutable_video_receiver_config();
268 receiver_config->set_remote_ssrc(config.rtp.remote_ssrc); 270 receiver_config->set_remote_ssrc(config.rtp.remote_ssrc);
269 receiver_config->set_local_ssrc(config.rtp.local_ssrc); 271 receiver_config->set_local_ssrc(config.rtp.local_ssrc);
270 272
271 receiver_config->set_rtcp_mode(ConvertRtcpMode(config.rtp.rtcp_mode)); 273 receiver_config->set_rtcp_mode(ConvertRtcpMode(config.rtp.rtcp_mode));
272
273 receiver_config->set_receiver_reference_time_report(
274 config.rtp.rtcp_xr.receiver_reference_time_report);
275 receiver_config->set_remb(config.rtp.remb); 274 receiver_config->set_remb(config.rtp.remb);
276 275
277 for (const auto& kv : config.rtp.rtx) { 276 for (const auto& kv : config.rtp.rtx) {
278 rtclog::RtxMap* rtx = receiver_config->add_rtx_map(); 277 rtclog::RtxMap* rtx = receiver_config->add_rtx_map();
279 rtx->set_payload_type(kv.first); 278 rtx->set_payload_type(kv.first);
280 rtx->mutable_config()->set_rtx_ssrc(kv.second.ssrc); 279 rtx->mutable_config()->set_rtx_ssrc(kv.second.ssrc);
281 rtx->mutable_config()->set_rtx_payload_type(kv.second.payload_type); 280 rtx->mutable_config()->set_rtx_payload_type(kv.second.payload_type);
282 } 281 }
283 282
284 for (const auto& e : config.rtp.extensions) { 283 for (const auto& e : config.rtp.extensions) {
(...skipping 30 matching lines...) Expand all
315 sender_config->add_header_extensions(); 314 sender_config->add_header_extensions();
316 extension->set_name(e.name); 315 extension->set_name(e.name);
317 extension->set_id(e.id); 316 extension->set_id(e.id);
318 } 317 }
319 318
320 for (const auto& rtx_ssrc : config.rtp.rtx.ssrcs) { 319 for (const auto& rtx_ssrc : config.rtp.rtx.ssrcs) {
321 sender_config->add_rtx_ssrcs(rtx_ssrc); 320 sender_config->add_rtx_ssrcs(rtx_ssrc);
322 } 321 }
323 sender_config->set_rtx_payload_type(config.rtp.rtx.payload_type); 322 sender_config->set_rtx_payload_type(config.rtp.rtx.payload_type);
324 323
325 sender_config->set_c_name(config.rtp.c_name);
326
327 rtclog::EncoderConfig* encoder = sender_config->mutable_encoder(); 324 rtclog::EncoderConfig* encoder = sender_config->mutable_encoder();
328 encoder->set_name(config.encoder_settings.payload_name); 325 encoder->set_name(config.encoder_settings.payload_name);
329 encoder->set_payload_type(config.encoder_settings.payload_type); 326 encoder->set_payload_type(config.encoder_settings.payload_type);
330 HandleEvent(&event); 327 HandleEvent(&event);
331 } 328 }
332 329
333 void RtcEventLogImpl::LogRtpHeader(bool incoming, 330 void RtcEventLogImpl::LogRtpHeader(bool incoming,
334 MediaType media_type, 331 MediaType media_type,
335 const uint8_t* header, 332 const uint8_t* header,
336 size_t packet_length) { 333 size_t packet_length) {
(...skipping 27 matching lines...) Expand all
364 void RtcEventLogImpl::LogRtcpPacket(bool incoming, 361 void RtcEventLogImpl::LogRtcpPacket(bool incoming,
365 MediaType media_type, 362 MediaType media_type,
366 const uint8_t* packet, 363 const uint8_t* packet,
367 size_t length) { 364 size_t length) {
368 rtc::CritScope lock(&crit_); 365 rtc::CritScope lock(&crit_);
369 rtclog::Event rtcp_event; 366 rtclog::Event rtcp_event;
370 rtcp_event.set_timestamp_us(clock_->TimeInMicroseconds()); 367 rtcp_event.set_timestamp_us(clock_->TimeInMicroseconds());
371 rtcp_event.set_type(rtclog::Event::RTCP_EVENT); 368 rtcp_event.set_type(rtclog::Event::RTCP_EVENT);
372 rtcp_event.mutable_rtcp_packet()->set_incoming(incoming); 369 rtcp_event.mutable_rtcp_packet()->set_incoming(incoming);
373 rtcp_event.mutable_rtcp_packet()->set_type(ConvertMediaType(media_type)); 370 rtcp_event.mutable_rtcp_packet()->set_type(ConvertMediaType(media_type));
374 rtcp_event.mutable_rtcp_packet()->set_packet_data(packet, length); 371
372 RTCPUtility::RtcpCommonHeader header;
373 const uint8_t* block_begin = packet;
374 const uint8_t* packet_end = packet + length;
375 RTC_DCHECK(length <= IP_PACKET_SIZE);
376 uint8_t buffer[IP_PACKET_SIZE];
377 uint32_t buffer_length = 0;
378 while (block_begin < packet_end) {
379 if (!RtcpParseCommonHeader(block_begin, packet_end - block_begin,
380 &header)) {
381 break; // Incorrect message header.
382 }
383 uint32_t block_size = header.BlockSize();
384 switch (header.packet_type) {
385 case RTCPUtility::PT_SR:
386 FALLTHROUGH();
387 case RTCPUtility::PT_RR:
388 FALLTHROUGH();
389 case RTCPUtility::PT_BYE:
390 FALLTHROUGH();
391 case RTCPUtility::PT_IJ:
392 FALLTHROUGH();
393 case RTCPUtility::PT_RTPFB:
394 FALLTHROUGH();
395 case RTCPUtility::PT_PSFB:
396 FALLTHROUGH();
397 case RTCPUtility::PT_XR:
398 // We log sender reports, receiver reports, bye messages
399 // inter-arrival jitter, third-party loss reports, payload-specific
400 // feedback and extended reports.
401 memcpy(buffer + buffer_length, block_begin, block_size);
402 buffer_length += block_size;
403 break;
404 case RTCPUtility::PT_SDES:
405 FALLTHROUGH();
406 case RTCPUtility::PT_APP:
407 FALLTHROUGH();
408 default:
409 // We don't log sender descriptions, application defined messages
410 // or message blocks of unknown type.
411 break;
412 }
413
414 block_begin += block_size;
415 }
416 rtcp_event.mutable_rtcp_packet()->set_packet_data(buffer, buffer_length);
375 HandleEvent(&rtcp_event); 417 HandleEvent(&rtcp_event);
376 } 418 }
377 419
378 void RtcEventLogImpl::LogAudioPlayout(uint32_t ssrc) { 420 void RtcEventLogImpl::LogAudioPlayout(uint32_t ssrc) {
379 rtc::CritScope lock(&crit_); 421 rtc::CritScope lock(&crit_);
380 rtclog::Event event; 422 rtclog::Event event;
381 event.set_timestamp_us(clock_->TimeInMicroseconds()); 423 event.set_timestamp_us(clock_->TimeInMicroseconds());
382 event.set_type(rtclog::Event::AUDIO_PLAYOUT_EVENT); 424 event.set_type(rtclog::Event::AUDIO_PLAYOUT_EVENT);
383 auto playout_event = event.mutable_audio_playout_event(); 425 auto playout_event = event.mutable_audio_playout_event();
384 playout_event->set_local_ssrc(ssrc); 426 playout_event->set_local_ssrc(ssrc);
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 } 514 }
473 515
474 #endif // ENABLE_RTC_EVENT_LOG 516 #endif // ENABLE_RTC_EVENT_LOG
475 517
476 // RtcEventLog member functions. 518 // RtcEventLog member functions.
477 rtc::scoped_ptr<RtcEventLog> RtcEventLog::Create() { 519 rtc::scoped_ptr<RtcEventLog> RtcEventLog::Create() {
478 return rtc::scoped_ptr<RtcEventLog>(new RtcEventLogImpl()); 520 return rtc::scoped_ptr<RtcEventLog>(new RtcEventLogImpl());
479 } 521 }
480 522
481 } // namespace webrtc 523 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/call/rtc_event_log.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698