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

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

Issue 2997973002: Split LogRtpHeader and LogRtcpPacket into separate versions for incoming and outgoing packets.
Patch Set: Rebase Created 3 years, 3 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) 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
(...skipping 11 matching lines...) Expand all
22 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/app.h" 22 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/app.h"
23 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.h" 23 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/bye.h"
24 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/common_header.h" 24 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/common_header.h"
25 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_jitter_report.h" 25 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_jitter_report.h"
26 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_reports.h" 26 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/extended_reports.h"
27 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/psfb.h" 27 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/psfb.h"
28 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h" 28 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/receiver_report.h"
29 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rtpfb.h" 29 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/rtpfb.h"
30 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sdes.h" 30 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sdes.h"
31 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.h" 31 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/sender_report.h"
32 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_received.h"
33 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_to_send.h"
32 #include "webrtc/rtc_base/atomicops.h" 34 #include "webrtc/rtc_base/atomicops.h"
33 #include "webrtc/rtc_base/checks.h" 35 #include "webrtc/rtc_base/checks.h"
34 #include "webrtc/rtc_base/constructormagic.h" 36 #include "webrtc/rtc_base/constructormagic.h"
35 #include "webrtc/rtc_base/event.h" 37 #include "webrtc/rtc_base/event.h"
36 #include "webrtc/rtc_base/logging.h" 38 #include "webrtc/rtc_base/logging.h"
37 #include "webrtc/rtc_base/protobuf_utils.h" 39 #include "webrtc/rtc_base/protobuf_utils.h"
38 #include "webrtc/rtc_base/swap_queue.h" 40 #include "webrtc/rtc_base/swap_queue.h"
39 #include "webrtc/rtc_base/thread_checker.h" 41 #include "webrtc/rtc_base/thread_checker.h"
40 #include "webrtc/rtc_base/timeutils.h" 42 #include "webrtc/rtc_base/timeutils.h"
41 #include "webrtc/system_wrappers/include/file_wrapper.h" 43 #include "webrtc/system_wrappers/include/file_wrapper.h"
(...skipping 19 matching lines...) Expand all
61 63
62 bool StartLogging(const std::string& file_name, 64 bool StartLogging(const std::string& file_name,
63 int64_t max_size_bytes) override; 65 int64_t max_size_bytes) override;
64 bool StartLogging(rtc::PlatformFile platform_file, 66 bool StartLogging(rtc::PlatformFile platform_file,
65 int64_t max_size_bytes) override; 67 int64_t max_size_bytes) override;
66 void StopLogging() override; 68 void StopLogging() override;
67 void LogVideoReceiveStreamConfig(const rtclog::StreamConfig& config) override; 69 void LogVideoReceiveStreamConfig(const rtclog::StreamConfig& config) override;
68 void LogVideoSendStreamConfig(const rtclog::StreamConfig& config) override; 70 void LogVideoSendStreamConfig(const rtclog::StreamConfig& config) override;
69 void LogAudioReceiveStreamConfig(const rtclog::StreamConfig& config) override; 71 void LogAudioReceiveStreamConfig(const rtclog::StreamConfig& config) override;
70 void LogAudioSendStreamConfig(const rtclog::StreamConfig& config) override; 72 void LogAudioSendStreamConfig(const rtclog::StreamConfig& config) override;
73 // TODO(terelius): This can be removed as soon as the interface has been
74 // updated.
71 void LogRtpHeader(PacketDirection direction, 75 void LogRtpHeader(PacketDirection direction,
72 const uint8_t* header, 76 const uint8_t* header,
73 size_t packet_length) override; 77 size_t packet_length) override;
78 // TODO(terelius): This can be made private, non-virtual as soon as the
79 // interface has been updated.
74 void LogRtpHeader(PacketDirection direction, 80 void LogRtpHeader(PacketDirection direction,
75 const uint8_t* header, 81 const uint8_t* header,
76 size_t packet_length, 82 size_t packet_length,
77 int probe_cluster_id) override; 83 int probe_cluster_id) override;
84 void LogIncomingRtpHeader(const RtpPacketReceived& packet) override;
85 void LogOutgoingRtpHeader(const RtpPacketToSend& packet,
86 int probe_cluster_id) override;
87 // TODO(terelius): This can be made private, non-virtual as soon as the
88 // interface has been updated.
78 void LogRtcpPacket(PacketDirection direction, 89 void LogRtcpPacket(PacketDirection direction,
79 const uint8_t* packet, 90 const uint8_t* packet,
80 size_t length) override; 91 size_t length) override;
92 void LogIncomingRtcpPacket(rtc::ArrayView<const uint8_t> packet) override;
93 void LogOutgoingRtcpPacket(rtc::ArrayView<const uint8_t> packet) override;
81 void LogAudioPlayout(uint32_t ssrc) override; 94 void LogAudioPlayout(uint32_t ssrc) override;
82 void LogLossBasedBweUpdate(int32_t bitrate_bps, 95 void LogLossBasedBweUpdate(int32_t bitrate_bps,
83 uint8_t fraction_loss, 96 uint8_t fraction_loss,
84 int32_t total_packets) override; 97 int32_t total_packets) override;
85 void LogDelayBasedBweUpdate(int32_t bitrate_bps, 98 void LogDelayBasedBweUpdate(int32_t bitrate_bps,
86 BandwidthUsage detector_state) override; 99 BandwidthUsage detector_state) override;
87 void LogAudioNetworkAdaptation( 100 void LogAudioNetworkAdaptation(
88 const AudioEncoderRuntimeConfig& config) override; 101 const AudioEncoderRuntimeConfig& config) override;
89 void LogProbeClusterCreated(int id, 102 void LogProbeClusterCreated(int id,
90 int bitrate_bps, 103 int bitrate_bps,
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 for (const auto& e : config.rtp_extensions) { 388 for (const auto& e : config.rtp_extensions) {
376 rtclog::RtpHeaderExtension* extension = 389 rtclog::RtpHeaderExtension* extension =
377 sender_config->add_header_extensions(); 390 sender_config->add_header_extensions();
378 extension->set_name(e.uri); 391 extension->set_name(e.uri);
379 extension->set_id(e.id); 392 extension->set_id(e.id);
380 } 393 }
381 394
382 StoreEvent(std::move(event)); 395 StoreEvent(std::move(event));
383 } 396 }
384 397
398 void RtcEventLogImpl::LogIncomingRtpHeader(const RtpPacketReceived& packet) {
399 LogRtpHeader(kIncomingPacket, packet.data(), packet.size(),
400 PacedPacketInfo::kNotAProbe);
401 }
402
403 void RtcEventLogImpl::LogOutgoingRtpHeader(const RtpPacketToSend& packet,
404 int probe_cluster_id) {
405 LogRtpHeader(kOutgoingPacket, packet.data(), packet.size(), probe_cluster_id);
406 }
407
385 void RtcEventLogImpl::LogRtpHeader(PacketDirection direction, 408 void RtcEventLogImpl::LogRtpHeader(PacketDirection direction,
386 const uint8_t* header, 409 const uint8_t* header,
387 size_t packet_length) { 410 size_t packet_length) {
388 LogRtpHeader(direction, header, packet_length, PacedPacketInfo::kNotAProbe); 411 LogRtpHeader(direction, header, packet_length, PacedPacketInfo::kNotAProbe);
389 } 412 }
390 413
391 void RtcEventLogImpl::LogRtpHeader(PacketDirection direction, 414 void RtcEventLogImpl::LogRtpHeader(PacketDirection direction,
392 const uint8_t* header, 415 const uint8_t* header,
393 size_t packet_length, 416 size_t packet_length,
394 int probe_cluster_id) { 417 int probe_cluster_id) {
(...skipping 17 matching lines...) Expand all
412 rtp_event->set_timestamp_us(rtc::TimeMicros()); 435 rtp_event->set_timestamp_us(rtc::TimeMicros());
413 rtp_event->set_type(rtclog::Event::RTP_EVENT); 436 rtp_event->set_type(rtclog::Event::RTP_EVENT);
414 rtp_event->mutable_rtp_packet()->set_incoming(direction == kIncomingPacket); 437 rtp_event->mutable_rtp_packet()->set_incoming(direction == kIncomingPacket);
415 rtp_event->mutable_rtp_packet()->set_packet_length(packet_length); 438 rtp_event->mutable_rtp_packet()->set_packet_length(packet_length);
416 rtp_event->mutable_rtp_packet()->set_header(header, header_length); 439 rtp_event->mutable_rtp_packet()->set_header(header, header_length);
417 if (probe_cluster_id != PacedPacketInfo::kNotAProbe) 440 if (probe_cluster_id != PacedPacketInfo::kNotAProbe)
418 rtp_event->mutable_rtp_packet()->set_probe_cluster_id(probe_cluster_id); 441 rtp_event->mutable_rtp_packet()->set_probe_cluster_id(probe_cluster_id);
419 StoreEvent(std::move(rtp_event)); 442 StoreEvent(std::move(rtp_event));
420 } 443 }
421 444
445 void RtcEventLogImpl::LogIncomingRtcpPacket(
446 rtc::ArrayView<const uint8_t> packet) {
447 LogRtcpPacket(kIncomingPacket, packet.data(), packet.size());
eladalon 2017/09/05 11:57:01 nit: Would it be possible to change PacketDirectio
terelius 2017/09/07 12:53:55 The PacketDirection will be removed in a future CL
448 }
449
450 void RtcEventLogImpl::LogOutgoingRtcpPacket(
451 rtc::ArrayView<const uint8_t> packet) {
452 LogRtcpPacket(kOutgoingPacket, packet.data(), packet.size());
453 }
454
422 void RtcEventLogImpl::LogRtcpPacket(PacketDirection direction, 455 void RtcEventLogImpl::LogRtcpPacket(PacketDirection direction,
423 const uint8_t* packet, 456 const uint8_t* packet,
424 size_t length) { 457 size_t length) {
425 std::unique_ptr<rtclog::Event> rtcp_event(new rtclog::Event()); 458 std::unique_ptr<rtclog::Event> rtcp_event(new rtclog::Event());
426 rtcp_event->set_timestamp_us(rtc::TimeMicros()); 459 rtcp_event->set_timestamp_us(rtc::TimeMicros());
427 rtcp_event->set_type(rtclog::Event::RTCP_EVENT); 460 rtcp_event->set_type(rtclog::Event::RTCP_EVENT);
428 rtcp_event->mutable_rtcp_packet()->set_incoming(direction == kIncomingPacket); 461 rtcp_event->mutable_rtcp_packet()->set_incoming(direction == kIncomingPacket);
429 462
430 rtcp::CommonHeader header; 463 rtcp::CommonHeader header;
431 const uint8_t* block_begin = packet; 464 const uint8_t* block_begin = packet;
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 #else 639 #else
607 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); 640 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl());
608 #endif // ENABLE_RTC_EVENT_LOG 641 #endif // ENABLE_RTC_EVENT_LOG
609 } 642 }
610 643
611 std::unique_ptr<RtcEventLog> RtcEventLog::CreateNull() { 644 std::unique_ptr<RtcEventLog> RtcEventLog::CreateNull() {
612 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); 645 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl());
613 } 646 }
614 647
615 } // namespace webrtc 648 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698