Skip to content

Commit

Permalink
Add event traces to interesting places in WebRTC.
Browse files Browse the repository at this point in the history
Bug: webrtc:12840
Change-Id: I2fe749039059c9f3d6da064dce10d9c24a27d02e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/221044
Reviewed-by: Stefan Holmer <[email protected]>
Commit-Queue: Markus Handell <[email protected]>
Cr-Commit-Position: refs/heads/master@{#34199}
  • Loading branch information
Markus Handell authored and WebRTC LUCI CQ committed Jun 2, 2021
1 parent 486b040 commit fccb052
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions call/rtp_video_sender.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "rtc_base/location.h"
#include "rtc_base/logging.h"
#include "rtc_base/task_queue.h"
#include "rtc_base/trace_event.h"

namespace webrtc {

Expand Down Expand Up @@ -461,6 +462,7 @@ RtpVideoSender::~RtpVideoSender() {

void RtpVideoSender::RegisterProcessThread(
ProcessThread* module_process_thread) {
TRACE_EVENT0("webrtc", "RtpVideoSender::RegisterProcessThread");
RTC_DCHECK_RUN_ON(&module_process_thread_checker_);
RTC_DCHECK(!module_process_thread_);
module_process_thread_ = module_process_thread;
Expand Down
1 change: 1 addition & 0 deletions modules/utility/source/process_thread_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ void ProcessThreadImpl::PostDelayedTask(std::unique_ptr<QueuedTask> task,

void ProcessThreadImpl::RegisterModule(Module* module,
const rtc::Location& from) {
TRACE_EVENT0("webrtc", "ProcessThreadImpl::RegisterModule");
RTC_DCHECK(thread_checker_.IsCurrent());
RTC_DCHECK(module) << from.ToString();

Expand Down
2 changes: 2 additions & 0 deletions modules/video_coding/codecs/h264/h264.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "absl/types/optional.h"
#include "api/video_codecs/sdp_video_format.h"
#include "media/base/media_constants.h"
#include "rtc_base/trace_event.h"

#if defined(WEBRTC_USE_H264)
#include "modules/video_coding/codecs/h264/h264_decoder_impl.h"
Expand Down Expand Up @@ -65,6 +66,7 @@ void DisableRtcUseH264() {
}

std::vector<SdpVideoFormat> SupportedH264Codecs() {
TRACE_EVENT0("webrtc", __func__);
if (!IsH264CodecSupported())
return std::vector<SdpVideoFormat>();
// We only support encoding Constrained Baseline Profile (CBP), but the
Expand Down
4 changes: 4 additions & 0 deletions video/adaptation/video_stream_encoder_resource_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "rtc_base/ref_counted_object.h"
#include "rtc_base/strings/string_builder.h"
#include "rtc_base/time_utils.h"
#include "rtc_base/trace_event.h"
#include "system_wrappers/include/field_trial.h"
#include "video/adaptation/quality_scaler_resource.h"

Expand Down Expand Up @@ -257,6 +258,9 @@ VideoStreamEncoderResourceManager::VideoStreamEncoderResourceManager(
quality_rampup_experiment_(
QualityRampUpExperimentHelper::CreateIfEnabled(this, clock_)),
encoder_settings_(absl::nullopt) {
TRACE_EVENT0(
"webrtc",
"VideoStreamEncoderResourceManager::VideoStreamEncoderResourceManager");
RTC_CHECK(degradation_preference_provider_);
RTC_CHECK(encoder_stats_observer_);
}
Expand Down
2 changes: 2 additions & 0 deletions video/video_receive_stream2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,8 @@ void VideoReceiveStream2::Stop() {

void VideoReceiveStream2::CreateAndRegisterExternalDecoder(
const Decoder& decoder) {
TRACE_EVENT0("webrtc",
"VideoReceiveStream2::CreateAndRegisterExternalDecoder");
std::unique_ptr<VideoDecoder> video_decoder =
config_.decoder_factory->CreateVideoDecoder(decoder.video_format);
// If we still have no valid decoder, we have to create a "Null" decoder
Expand Down
6 changes: 6 additions & 0 deletions video/video_stream_encoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,7 @@ VideoStreamEncoder::VideoStreamEncoder(
encoder_queue_(task_queue_factory->CreateTaskQueue(
"EncoderQueue",
TaskQueueFactory::Priority::NORMAL)) {
TRACE_EVENT0("webrtc", "VideoStreamEncoder::VideoStreamEncoder");
RTC_DCHECK(main_queue_);
RTC_DCHECK(encoder_stats_observer);
RTC_DCHECK_GE(number_of_cores, 1);
Expand Down Expand Up @@ -742,11 +743,16 @@ void VideoStreamEncoder::SetFecControllerOverride(
void VideoStreamEncoder::AddAdaptationResource(
rtc::scoped_refptr<Resource> resource) {
RTC_DCHECK_RUN_ON(main_queue_);
TRACE_EVENT0("webrtc", "VideoStreamEncoder::AddAdaptationResource");
// Map any externally added resources as kCpu for the sake of stats reporting.
// TODO(hbos): Make the manager map any unknown resources to kCpu and get rid
// of this MapResourceToReason() call.
TRACE_EVENT_ASYNC_BEGIN0(
"webrtc", "VideoStreamEncoder::AddAdaptationResource(latency)", this);
rtc::Event map_resource_event;
encoder_queue_.PostTask([this, resource, &map_resource_event] {
TRACE_EVENT_ASYNC_END0(
"webrtc", "VideoStreamEncoder::AddAdaptationResource(latency)", this);
RTC_DCHECK_RUN_ON(&encoder_queue_);
additional_resources_.push_back(resource);
stream_resource_manager_.AddResource(resource, VideoAdaptationReason::kCpu);
Expand Down

0 comments on commit fccb052

Please sign in to comment.