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

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

Issue 2997973002: Split LogRtpHeader and LogRtcpPacket into separate versions for incoming and outgoing packets.
Patch Set: Split VerifyRtpEvent into one incoming and one outgoing version. Created 3 years, 2 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
« no previous file with comments | « logging/rtc_event_log/rtc_event_log.h ('k') | logging/rtc_event_log/rtc_event_log_unittest.cc » ('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
(...skipping 15 matching lines...) Expand all
26 #include "modules/rtp_rtcp/source/rtcp_packet/app.h" 26 #include "modules/rtp_rtcp/source/rtcp_packet/app.h"
27 #include "modules/rtp_rtcp/source/rtcp_packet/bye.h" 27 #include "modules/rtp_rtcp/source/rtcp_packet/bye.h"
28 #include "modules/rtp_rtcp/source/rtcp_packet/common_header.h" 28 #include "modules/rtp_rtcp/source/rtcp_packet/common_header.h"
29 #include "modules/rtp_rtcp/source/rtcp_packet/extended_jitter_report.h" 29 #include "modules/rtp_rtcp/source/rtcp_packet/extended_jitter_report.h"
30 #include "modules/rtp_rtcp/source/rtcp_packet/extended_reports.h" 30 #include "modules/rtp_rtcp/source/rtcp_packet/extended_reports.h"
31 #include "modules/rtp_rtcp/source/rtcp_packet/psfb.h" 31 #include "modules/rtp_rtcp/source/rtcp_packet/psfb.h"
32 #include "modules/rtp_rtcp/source/rtcp_packet/receiver_report.h" 32 #include "modules/rtp_rtcp/source/rtcp_packet/receiver_report.h"
33 #include "modules/rtp_rtcp/source/rtcp_packet/rtpfb.h" 33 #include "modules/rtp_rtcp/source/rtcp_packet/rtpfb.h"
34 #include "modules/rtp_rtcp/source/rtcp_packet/sdes.h" 34 #include "modules/rtp_rtcp/source/rtcp_packet/sdes.h"
35 #include "modules/rtp_rtcp/source/rtcp_packet/sender_report.h" 35 #include "modules/rtp_rtcp/source/rtcp_packet/sender_report.h"
36 #include "modules/rtp_rtcp/source/rtp_packet_received.h"
37 #include "modules/rtp_rtcp/source/rtp_packet_to_send.h"
36 #include "rtc_base/checks.h" 38 #include "rtc_base/checks.h"
37 #include "rtc_base/constructormagic.h" 39 #include "rtc_base/constructormagic.h"
38 #include "rtc_base/event.h" 40 #include "rtc_base/event.h"
39 #include "rtc_base/ignore_wundef.h" 41 #include "rtc_base/ignore_wundef.h"
40 #include "rtc_base/logging.h" 42 #include "rtc_base/logging.h"
41 #include "rtc_base/protobuf_utils.h" 43 #include "rtc_base/protobuf_utils.h"
42 #include "rtc_base/ptr_util.h" 44 #include "rtc_base/ptr_util.h"
43 #include "rtc_base/sequenced_task_checker.h" 45 #include "rtc_base/sequenced_task_checker.h"
44 #include "rtc_base/task_queue.h" 46 #include "rtc_base/task_queue.h"
45 #include "rtc_base/thread_annotations.h" 47 #include "rtc_base/thread_annotations.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 107
106 bool StartLogging(const std::string& file_name, 108 bool StartLogging(const std::string& file_name,
107 int64_t max_size_bytes) override; 109 int64_t max_size_bytes) override;
108 bool StartLogging(rtc::PlatformFile platform_file, 110 bool StartLogging(rtc::PlatformFile platform_file,
109 int64_t max_size_bytes) override; 111 int64_t max_size_bytes) override;
110 void StopLogging() override; 112 void StopLogging() override;
111 void LogVideoReceiveStreamConfig(const rtclog::StreamConfig& config) override; 113 void LogVideoReceiveStreamConfig(const rtclog::StreamConfig& config) override;
112 void LogVideoSendStreamConfig(const rtclog::StreamConfig& config) override; 114 void LogVideoSendStreamConfig(const rtclog::StreamConfig& config) override;
113 void LogAudioReceiveStreamConfig(const rtclog::StreamConfig& config) override; 115 void LogAudioReceiveStreamConfig(const rtclog::StreamConfig& config) override;
114 void LogAudioSendStreamConfig(const rtclog::StreamConfig& config) override; 116 void LogAudioSendStreamConfig(const rtclog::StreamConfig& config) override;
117 // TODO(terelius): This can be removed as soon as the interface has been
118 // updated.
115 void LogRtpHeader(PacketDirection direction, 119 void LogRtpHeader(PacketDirection direction,
116 const uint8_t* header, 120 const uint8_t* header,
117 size_t packet_length) override; 121 size_t packet_length) override;
122 // TODO(terelius): This can be made private, non-virtual as soon as the
123 // interface has been updated.
118 void LogRtpHeader(PacketDirection direction, 124 void LogRtpHeader(PacketDirection direction,
119 const uint8_t* header, 125 const uint8_t* header,
120 size_t packet_length, 126 size_t packet_length,
121 int probe_cluster_id) override; 127 int probe_cluster_id) override;
128 void LogIncomingRtpHeader(const RtpPacketReceived& packet) override;
129 void LogOutgoingRtpHeader(const RtpPacketToSend& packet,
130 int probe_cluster_id) override;
131 // TODO(terelius): This can be made private, non-virtual as soon as the
132 // interface has been updated.
122 void LogRtcpPacket(PacketDirection direction, 133 void LogRtcpPacket(PacketDirection direction,
123 const uint8_t* packet, 134 const uint8_t* packet,
124 size_t length) override; 135 size_t length) override;
136 void LogIncomingRtcpPacket(rtc::ArrayView<const uint8_t> packet) override;
137 void LogOutgoingRtcpPacket(rtc::ArrayView<const uint8_t> packet) override;
125 void LogAudioPlayout(uint32_t ssrc) override; 138 void LogAudioPlayout(uint32_t ssrc) override;
126 void LogLossBasedBweUpdate(int32_t bitrate_bps, 139 void LogLossBasedBweUpdate(int32_t bitrate_bps,
127 uint8_t fraction_loss, 140 uint8_t fraction_loss,
128 int32_t total_packets) override; 141 int32_t total_packets) override;
129 void LogDelayBasedBweUpdate(int32_t bitrate_bps, 142 void LogDelayBasedBweUpdate(int32_t bitrate_bps,
130 BandwidthUsage detector_state) override; 143 BandwidthUsage detector_state) override;
131 void LogAudioNetworkAdaptation( 144 void LogAudioNetworkAdaptation(
132 const AudioEncoderRuntimeConfig& config) override; 145 const AudioEncoderRuntimeConfig& config) override;
133 void LogProbeClusterCreated(int id, 146 void LogProbeClusterCreated(int id,
134 int bitrate_bps, 147 int bitrate_bps,
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 for (const auto& e : config.rtp_extensions) { 424 for (const auto& e : config.rtp_extensions) {
412 rtclog::RtpHeaderExtension* extension = 425 rtclog::RtpHeaderExtension* extension =
413 sender_config->add_header_extensions(); 426 sender_config->add_header_extensions();
414 extension->set_name(e.uri); 427 extension->set_name(e.uri);
415 extension->set_id(e.id); 428 extension->set_id(e.id);
416 } 429 }
417 430
418 StoreEvent(std::move(event)); 431 StoreEvent(std::move(event));
419 } 432 }
420 433
434 void RtcEventLogImpl::LogIncomingRtpHeader(const RtpPacketReceived& packet) {
435 LogRtpHeader(kIncomingPacket, packet.data(), packet.size(),
436 PacedPacketInfo::kNotAProbe);
437 }
438
439 void RtcEventLogImpl::LogOutgoingRtpHeader(const RtpPacketToSend& packet,
440 int probe_cluster_id) {
441 LogRtpHeader(kOutgoingPacket, packet.data(), packet.size(), probe_cluster_id);
442 }
443
421 void RtcEventLogImpl::LogRtpHeader(PacketDirection direction, 444 void RtcEventLogImpl::LogRtpHeader(PacketDirection direction,
422 const uint8_t* header, 445 const uint8_t* header,
423 size_t packet_length) { 446 size_t packet_length) {
424 LogRtpHeader(direction, header, packet_length, PacedPacketInfo::kNotAProbe); 447 LogRtpHeader(direction, header, packet_length, PacedPacketInfo::kNotAProbe);
425 } 448 }
426 449
427 void RtcEventLogImpl::LogRtpHeader(PacketDirection direction, 450 void RtcEventLogImpl::LogRtpHeader(PacketDirection direction,
428 const uint8_t* header, 451 const uint8_t* header,
429 size_t packet_length, 452 size_t packet_length,
430 int probe_cluster_id) { 453 int probe_cluster_id) {
(...skipping 17 matching lines...) Expand all
448 rtp_event->set_timestamp_us(rtc::TimeMicros()); 471 rtp_event->set_timestamp_us(rtc::TimeMicros());
449 rtp_event->set_type(rtclog::Event::RTP_EVENT); 472 rtp_event->set_type(rtclog::Event::RTP_EVENT);
450 rtp_event->mutable_rtp_packet()->set_incoming(direction == kIncomingPacket); 473 rtp_event->mutable_rtp_packet()->set_incoming(direction == kIncomingPacket);
451 rtp_event->mutable_rtp_packet()->set_packet_length(packet_length); 474 rtp_event->mutable_rtp_packet()->set_packet_length(packet_length);
452 rtp_event->mutable_rtp_packet()->set_header(header, header_length); 475 rtp_event->mutable_rtp_packet()->set_header(header, header_length);
453 if (probe_cluster_id != PacedPacketInfo::kNotAProbe) 476 if (probe_cluster_id != PacedPacketInfo::kNotAProbe)
454 rtp_event->mutable_rtp_packet()->set_probe_cluster_id(probe_cluster_id); 477 rtp_event->mutable_rtp_packet()->set_probe_cluster_id(probe_cluster_id);
455 StoreEvent(std::move(rtp_event)); 478 StoreEvent(std::move(rtp_event));
456 } 479 }
457 480
481 void RtcEventLogImpl::LogIncomingRtcpPacket(
482 rtc::ArrayView<const uint8_t> packet) {
483 LogRtcpPacket(kIncomingPacket, packet.data(), packet.size());
484 }
485
486 void RtcEventLogImpl::LogOutgoingRtcpPacket(
487 rtc::ArrayView<const uint8_t> packet) {
488 LogRtcpPacket(kOutgoingPacket, packet.data(), packet.size());
489 }
490
458 void RtcEventLogImpl::LogRtcpPacket(PacketDirection direction, 491 void RtcEventLogImpl::LogRtcpPacket(PacketDirection direction,
459 const uint8_t* packet, 492 const uint8_t* packet,
460 size_t length) { 493 size_t length) {
461 std::unique_ptr<rtclog::Event> rtcp_event(new rtclog::Event()); 494 std::unique_ptr<rtclog::Event> rtcp_event(new rtclog::Event());
462 rtcp_event->set_timestamp_us(rtc::TimeMicros()); 495 rtcp_event->set_timestamp_us(rtc::TimeMicros());
463 rtcp_event->set_type(rtclog::Event::RTCP_EVENT); 496 rtcp_event->set_type(rtclog::Event::RTCP_EVENT);
464 rtcp_event->mutable_rtcp_packet()->set_incoming(direction == kIncomingPacket); 497 rtcp_event->mutable_rtcp_packet()->set_incoming(direction == kIncomingPacket);
465 498
466 rtcp::CommonHeader header; 499 rtcp::CommonHeader header;
467 const uint8_t* block_begin = packet; 500 const uint8_t* block_begin = packet;
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 #else 847 #else
815 return CreateNull(); 848 return CreateNull();
816 #endif // ENABLE_RTC_EVENT_LOG 849 #endif // ENABLE_RTC_EVENT_LOG
817 } 850 }
818 851
819 std::unique_ptr<RtcEventLog> RtcEventLog::CreateNull() { 852 std::unique_ptr<RtcEventLog> RtcEventLog::CreateNull() {
820 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl()); 853 return std::unique_ptr<RtcEventLog>(new RtcEventLogNullImpl());
821 } 854 }
822 855
823 } // namespace webrtc 856 } // namespace webrtc
OLDNEW
« no previous file with comments | « logging/rtc_event_log/rtc_event_log.h ('k') | logging/rtc_event_log/rtc_event_log_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698