Eliminate unnecessary RTC_TRACE_EVENTS_ENABLED

Bug: webrtc:14073
Change-Id: I6365cc17393be52c11312dfa954783a3e135cb8c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/262263
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Johannes Kron <kron@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36929}
This commit is contained in:
Jianhui Dai
2022-05-13 10:40:25 +08:00
committed by WebRTC LUCI CQ
parent d68a06aedf
commit b1ba85385e
6 changed files with 13 additions and 23 deletions

View File

@ -57,6 +57,7 @@ rtc_library("pacing") {
"../../rtc_base:timeutils",
"../../rtc_base/experiments:field_trial_parser",
"../../rtc_base/synchronization:mutex",
"../../rtc_base/system:unused",
"../../rtc_base/task_utils:to_queued_task",
"../../system_wrappers",
"../../system_wrappers:metrics",

View File

@ -23,6 +23,7 @@
#include "modules/rtp_rtcp/source/rtp_rtcp_interface.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
#include "rtc_base/system/unused.h"
#include "rtc_base/time_utils.h"
#include "rtc_base/trace_event.h"
@ -214,14 +215,13 @@ std::vector<std::unique_ptr<RtpPacketToSend>> PacketRouter::GeneratePadding(
}
}
#if RTC_TRACE_EVENTS_ENABLED
for (auto& packet : padding_packets) {
RTC_UNUSED(packet);
TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("webrtc"),
"PacketRouter::GeneratePadding::Loop", "sequence_number",
packet->SequenceNumber(), "rtp_timestamp",
packet->Timestamp());
}
#endif
return padding_packets;
}

View File

@ -18,6 +18,7 @@
#include "rtc_base/checks.h"
#include "rtc_base/experiments/field_trial_parser.h"
#include "rtc_base/experiments/field_trial_units.h"
#include "rtc_base/system/unused.h"
#include "rtc_base/trace_event.h"
namespace webrtc {
@ -129,16 +130,15 @@ void TaskQueuePacedSender::SetPacingRates(DataRate pacing_rate,
void TaskQueuePacedSender::EnqueuePackets(
std::vector<std::unique_ptr<RtpPacketToSend>> packets) {
#if RTC_TRACE_EVENTS_ENABLED
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("webrtc"),
"TaskQueuePacedSender::EnqueuePackets");
for (auto& packet : packets) {
RTC_UNUSED(packet);
TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("webrtc"),
"TaskQueuePacedSender::EnqueuePackets::Loop",
"sequence_number", packet->SequenceNumber(), "rtp_timestamp",
packet->Timestamp());
}
#endif
task_queue_.PostTask([this, packets_ = std::move(packets)]() mutable {
RTC_DCHECK_RUN_ON(&task_queue_);
@ -224,10 +224,8 @@ void TaskQueuePacedSender::MaybeProcessPackets(
Timestamp scheduled_process_time) {
RTC_DCHECK_RUN_ON(&task_queue_);
#if RTC_TRACE_EVENTS_ENABLED
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("webrtc"),
"TaskQueuePacedSender::MaybeProcessPackets");
#endif
if (is_shutdown_ || !is_started_) {
return;

View File

@ -35,9 +35,7 @@
namespace webrtc {
namespace {
#if RTC_TRACE_EVENTS_ENABLED
const char* FrameTypeToString(AudioFrameType frame_type) {
[[maybe_unused]] const char* FrameTypeToString(AudioFrameType frame_type) {
switch (frame_type) {
case AudioFrameType::kEmptyFrame:
return "empty";
@ -48,7 +46,6 @@ const char* FrameTypeToString(AudioFrameType frame_type) {
}
RTC_CHECK_NOTREACHED();
}
#endif
constexpr char kIncludeCaptureClockOffset[] =
"WebRTC-IncludeCaptureClockOffset";
@ -166,10 +163,8 @@ bool RTPSenderAudio::SendAudio(AudioFrameType frame_type,
const uint8_t* payload_data,
size_t payload_size,
int64_t absolute_capture_timestamp_ms) {
#if RTC_TRACE_EVENTS_ENABLED
TRACE_EVENT_ASYNC_STEP1("webrtc", "Audio", rtp_timestamp, "Send", "type",
FrameTypeToString(frame_type));
#endif
// From RFC 4733:
// A source has wide latitude as to how often it sends event updates. A

View File

@ -97,8 +97,7 @@ bool IsBaseLayer(const RTPVideoHeader& video_header) {
return true;
}
#if RTC_TRACE_EVENTS_ENABLED
const char* FrameTypeToString(VideoFrameType frame_type) {
[[maybe_unused]] const char* FrameTypeToString(VideoFrameType frame_type) {
switch (frame_type) {
case VideoFrameType::kEmptyFrame:
return "empty";
@ -111,7 +110,6 @@ const char* FrameTypeToString(VideoFrameType frame_type) {
return "";
}
}
#endif
bool IsNoopDelay(const VideoPlayoutDelay& delay) {
return delay.min_ms == -1 && delay.max_ms == -1;
@ -477,10 +475,8 @@ bool RTPSenderVideo::SendVideo(
rtc::ArrayView<const uint8_t> payload,
RTPVideoHeader video_header,
absl::optional<int64_t> expected_retransmission_time_ms) {
#if RTC_TRACE_EVENTS_ENABLED
TRACE_EVENT_ASYNC_STEP1("webrtc", "Video", capture_time_ms, "Send", "type",
FrameTypeToString(video_header.frame_type));
#endif
RTC_CHECK_RUNS_SERIALIZED(&send_checker_);
if (video_header.frame_type == VideoFrameType::kEmptyFrame)

View File

@ -1169,7 +1169,7 @@ TEST_F(RTCStatsIntegrationTest, GetStatsFromCaller) {
#if RTC_TRACE_EVENTS_ENABLED
EXPECT_EQ(report->ToJson(), RTCStatsReportTraceListener::last_trace());
#endif
#endif
}
TEST_F(RTCStatsIntegrationTest, GetStatsFromCallee) {
@ -1180,7 +1180,7 @@ TEST_F(RTCStatsIntegrationTest, GetStatsFromCallee) {
#if RTC_TRACE_EVENTS_ENABLED
EXPECT_EQ(report->ToJson(), RTCStatsReportTraceListener::last_trace());
#endif
#endif
}
// These tests exercise the integration of the stats selection algorithm inside
@ -1260,10 +1260,10 @@ TEST_F(RTCStatsIntegrationTest,
// Any pending stats requests should have completed in the act of destroying
// the peer connection.
ASSERT_TRUE(stats_obtainer->report());
#if RTC_TRACE_EVENTS_ENABLED
#if RTC_TRACE_EVENTS_ENABLED
EXPECT_EQ(stats_obtainer->report()->ToJson(),
RTCStatsReportTraceListener::last_trace());
#endif
#endif
}
TEST_F(RTCStatsIntegrationTest, GetsStatsWhileClosingPeerConnection) {
@ -1275,10 +1275,10 @@ TEST_F(RTCStatsIntegrationTest, GetsStatsWhileClosingPeerConnection) {
caller_->pc()->Close();
ASSERT_TRUE(stats_obtainer->report());
#if RTC_TRACE_EVENTS_ENABLED
#if RTC_TRACE_EVENTS_ENABLED
EXPECT_EQ(stats_obtainer->report()->ToJson(),
RTCStatsReportTraceListener::last_trace());
#endif
#endif
}
// GetStatsReferencedIds() is optimized to recognize what is or isn't a