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

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: Rewrote generation of random RTCP packets using the SenderReport class. 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') | webrtc/call/rtc_event_log_unittest.cc » ('J')
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/interface/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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 const int64_t timestamp = clock_->TimeInMicroseconds(); 259 const int64_t timestamp = clock_->TimeInMicroseconds();
258 event.set_timestamp_us(timestamp); 260 event.set_timestamp_us(timestamp);
259 event.set_type(rtclog::Event::VIDEO_RECEIVER_CONFIG_EVENT); 261 event.set_type(rtclog::Event::VIDEO_RECEIVER_CONFIG_EVENT);
260 262
261 rtclog::VideoReceiveConfig* receiver_config = 263 rtclog::VideoReceiveConfig* receiver_config =
262 event.mutable_video_receiver_config(); 264 event.mutable_video_receiver_config();
263 receiver_config->set_remote_ssrc(config.rtp.remote_ssrc); 265 receiver_config->set_remote_ssrc(config.rtp.remote_ssrc);
264 receiver_config->set_local_ssrc(config.rtp.local_ssrc); 266 receiver_config->set_local_ssrc(config.rtp.local_ssrc);
265 267
266 receiver_config->set_rtcp_mode(ConvertRtcpMode(config.rtp.rtcp_mode)); 268 receiver_config->set_rtcp_mode(ConvertRtcpMode(config.rtp.rtcp_mode));
267
268 receiver_config->set_receiver_reference_time_report(
269 config.rtp.rtcp_xr.receiver_reference_time_report);
270 receiver_config->set_remb(config.rtp.remb); 269 receiver_config->set_remb(config.rtp.remb);
271 270
272 for (const auto& kv : config.rtp.rtx) { 271 for (const auto& kv : config.rtp.rtx) {
273 rtclog::RtxMap* rtx = receiver_config->add_rtx_map(); 272 rtclog::RtxMap* rtx = receiver_config->add_rtx_map();
274 rtx->set_payload_type(kv.first); 273 rtx->set_payload_type(kv.first);
275 rtx->mutable_config()->set_rtx_ssrc(kv.second.ssrc); 274 rtx->mutable_config()->set_rtx_ssrc(kv.second.ssrc);
276 rtx->mutable_config()->set_rtx_payload_type(kv.second.payload_type); 275 rtx->mutable_config()->set_rtx_payload_type(kv.second.payload_type);
277 } 276 }
278 277
279 for (const auto& e : config.rtp.extensions) { 278 for (const auto& e : config.rtp.extensions) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 sender_config->add_header_extensions(); 310 sender_config->add_header_extensions();
312 extension->set_name(e.name); 311 extension->set_name(e.name);
313 extension->set_id(e.id); 312 extension->set_id(e.id);
314 } 313 }
315 314
316 for (const auto& rtx_ssrc : config.rtp.rtx.ssrcs) { 315 for (const auto& rtx_ssrc : config.rtp.rtx.ssrcs) {
317 sender_config->add_rtx_ssrcs(rtx_ssrc); 316 sender_config->add_rtx_ssrcs(rtx_ssrc);
318 } 317 }
319 sender_config->set_rtx_payload_type(config.rtp.rtx.payload_type); 318 sender_config->set_rtx_payload_type(config.rtp.rtx.payload_type);
320 319
321 sender_config->set_c_name(config.rtp.c_name);
322
323 rtclog::EncoderConfig* encoder = sender_config->mutable_encoder(); 320 rtclog::EncoderConfig* encoder = sender_config->mutable_encoder();
324 encoder->set_name(config.encoder_settings.payload_name); 321 encoder->set_name(config.encoder_settings.payload_name);
325 encoder->set_payload_type(config.encoder_settings.payload_type); 322 encoder->set_payload_type(config.encoder_settings.payload_type);
326 HandleEvent(&event); 323 HandleEvent(&event);
327 } 324 }
328 325
329 void RtcEventLogImpl::LogRtpHeader(bool incoming, 326 void RtcEventLogImpl::LogRtpHeader(bool incoming,
330 MediaType media_type, 327 MediaType media_type,
331 const uint8_t* header, 328 const uint8_t* header,
332 size_t packet_length) { 329 size_t packet_length) {
(...skipping 29 matching lines...) Expand all
362 MediaType media_type, 359 MediaType media_type,
363 const uint8_t* packet, 360 const uint8_t* packet,
364 size_t length) { 361 size_t length) {
365 rtc::CritScope lock(&crit_); 362 rtc::CritScope lock(&crit_);
366 rtclog::Event rtcp_event; 363 rtclog::Event rtcp_event;
367 const int64_t timestamp = clock_->TimeInMicroseconds(); 364 const int64_t timestamp = clock_->TimeInMicroseconds();
368 rtcp_event.set_timestamp_us(timestamp); 365 rtcp_event.set_timestamp_us(timestamp);
369 rtcp_event.set_type(rtclog::Event::RTCP_EVENT); 366 rtcp_event.set_type(rtclog::Event::RTCP_EVENT);
370 rtcp_event.mutable_rtcp_packet()->set_incoming(incoming); 367 rtcp_event.mutable_rtcp_packet()->set_incoming(incoming);
371 rtcp_event.mutable_rtcp_packet()->set_type(ConvertMediaType(media_type)); 368 rtcp_event.mutable_rtcp_packet()->set_type(ConvertMediaType(media_type));
372 rtcp_event.mutable_rtcp_packet()->set_packet_data(packet, length); 369
370 RTCPUtility::RtcpCommonHeader header;
371 const uint8_t* block_begin = packet;
372 const uint8_t* packet_end = packet + length;
373 RTC_DCHECK(length <= IP_PACKET_SIZE);
374 uint8_t buffer[IP_PACKET_SIZE];
375 uint32_t buffer_length = 0;
376 while (block_begin < packet_end) {
377 if (!RtcpParseCommonHeader(block_begin, packet_end - block_begin,
378 &header)) {
379 break; // Incorrect message header.
380 }
381 uint32_t block_size = header.BlockSize();
382 if (block_begin + block_size > packet_end) {
åsapersson 2015/11/02 09:31:12 Is this checked within RtcpParseCommonHeader?
terelius 2015/11/05 18:01:18 You're right. It has already been verified in Rtcp
383 break; // Faulty header; block would extend outside packet.
384 }
385 switch (header.packet_type) {
386 case RTCPUtility::PT_SR:
387 FALLTHROUGH();
388 case RTCPUtility::PT_RR:
389 FALLTHROUGH();
390 case RTCPUtility::PT_BYE:
391 FALLTHROUGH();
392 case RTCPUtility::PT_IJ:
393 FALLTHROUGH();
394 case RTCPUtility::PT_RTPFB:
395 FALLTHROUGH();
396 case RTCPUtility::PT_PSFB:
397 FALLTHROUGH();
398 case RTCPUtility::PT_XR:
399 // We log sender reports, receiver reports, bye messages
400 // inter-arrival jitter, third-party loss reports, payload-specific
401 // feedback and extended reports.
402 memcpy(buffer + buffer_length, block_begin, block_size);
403 buffer_length += block_size;
404 break;
405 case RTCPUtility::PT_SDES:
406 FALLTHROUGH();
407 case RTCPUtility::PT_APP:
408 FALLTHROUGH();
409 default:
410 // We don't log sender descriptions, application defined messages
411 // or message blocks of unknown type.
412 break;
413 }
414
415 block_begin += block_size;
416 }
417 rtcp_event.mutable_rtcp_packet()->set_packet_data(buffer, buffer_length);
373 HandleEvent(&rtcp_event); 418 HandleEvent(&rtcp_event);
374 } 419 }
375 420
376 void RtcEventLogImpl::LogAudioPlayout(uint32_t ssrc) { 421 void RtcEventLogImpl::LogAudioPlayout(uint32_t ssrc) {
377 rtc::CritScope lock(&crit_); 422 rtc::CritScope lock(&crit_);
378 rtclog::Event event; 423 rtclog::Event event;
379 const int64_t timestamp = clock_->TimeInMicroseconds(); 424 const int64_t timestamp = clock_->TimeInMicroseconds();
380 event.set_timestamp_us(timestamp); 425 event.set_timestamp_us(timestamp);
381 event.set_type(rtclog::Event::AUDIO_PLAYOUT_EVENT); 426 event.set_type(rtclog::Event::AUDIO_PLAYOUT_EVENT);
382 auto playout_event = event.mutable_audio_playout_event(); 427 auto playout_event = event.mutable_audio_playout_event();
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 } 503 }
459 504
460 #endif // ENABLE_RTC_EVENT_LOG 505 #endif // ENABLE_RTC_EVENT_LOG
461 506
462 // RtcEventLog member functions. 507 // RtcEventLog member functions.
463 rtc::scoped_ptr<RtcEventLog> RtcEventLog::Create() { 508 rtc::scoped_ptr<RtcEventLog> RtcEventLog::Create() {
464 return rtc::scoped_ptr<RtcEventLog>(new RtcEventLogImpl()); 509 return rtc::scoped_ptr<RtcEventLog>(new RtcEventLogImpl());
465 } 510 }
466 511
467 } // namespace webrtc 512 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/call/rtc_event_log.proto » ('j') | webrtc/call/rtc_event_log_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698