Add directive to make TRACE_EVENT macros optional.

Bug: webrtc:11132
Change-Id: I801994ad262e1acff73e4c20afd7a7343b56268c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/160654
Commit-Queue: Doudou Kisabaka <doudouk@google.com>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29949}
This commit is contained in:
Doudou Kisabaka
2019-11-28 14:24:31 +01:00
committed by Commit Bot
parent b8306cc9bb
commit 2dec496f80
7 changed files with 188 additions and 27 deletions

View File

@ -30,6 +30,7 @@ namespace webrtc {
namespace {
#if RTC_TRACE_EVENTS_ENABLED
const char* FrameTypeToString(AudioFrameType frame_type) {
switch (frame_type) {
case AudioFrameType::kEmptyFrame:
@ -40,6 +41,7 @@ const char* FrameTypeToString(AudioFrameType frame_type) {
return "audio_cn";
}
}
#endif
} // namespace
@ -133,8 +135,10 @@ bool RTPSenderAudio::SendAudio(AudioFrameType frame_type,
uint32_t rtp_timestamp,
const uint8_t* payload_data,
size_t payload_size) {
#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

@ -180,6 +180,7 @@ bool IsBaseLayer(const RTPVideoHeader& video_header) {
return true;
}
#if RTC_TRACE_EVENTS_ENABLED
const char* FrameTypeToString(VideoFrameType frame_type) {
switch (frame_type) {
case VideoFrameType::kEmptyFrame:
@ -193,6 +194,7 @@ const char* FrameTypeToString(VideoFrameType frame_type) {
return "";
}
}
#endif
} // namespace
@ -418,8 +420,10 @@ bool RTPSenderVideo::SendVideo(
const RTPFragmentationHeader* fragmentation,
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)