Commit f6d3ace1 authored by Hongchan Choi's avatar Hongchan Choi Committed by Commit Bot

Add more traces to WebAudio: selected AudioNodes

This CL adds trace event in the following AudioNodes based on the
popularity:
- GaindNode
- AudioBufferSourceNode
- PannerNode
- BiquadFilterNode

It also adds trace event below to get the detailed tracing data from
some problem areas.
- AudioWorkletNode
- MediaStreamAudioSourceNode
- MediaStreamAudioDestinationNode

Bug: 1065982
Change-Id: I0758786aa418ec3dc992333012f0da0f8867f636
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2127731Reviewed-by: default avatarRaymond Toy <rtoy@chromium.org>
Reviewed-by: default avatarSami Kyöstilä <skyostil@chromium.org>
Commit-Queue: Hongchan Choi <hongchan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#754913}
parent c724ac13
......@@ -232,6 +232,7 @@
X(TRACE_DISABLED_BY_DEFAULT("viz.surface_id_flow")) \
X(TRACE_DISABLED_BY_DEFAULT("viz.surface_lifetime")) \
X(TRACE_DISABLED_BY_DEFAULT("viz.triangles")) \
X(TRACE_DISABLED_BY_DEFAULT("webaudio.audionode")) \
X(TRACE_DISABLED_BY_DEFAULT("worker.scheduler"))
#define INTERNAL_TRACE_INIT_CATEGORY_NAME(name) name,
......
......@@ -34,6 +34,7 @@
#include "third_party/blink/renderer/platform/bindings/exception_messages.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/instrumentation/use_counter.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h"
#include "third_party/blink/renderer/platform/wtf/math_extras.h"
namespace blink {
......@@ -86,6 +87,9 @@ AudioBufferSourceHandler::~AudioBufferSourceHandler() {
}
void AudioBufferSourceHandler::Process(uint32_t frames_to_process) {
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("webaudio.audionode"),
"AudioBufferSourceHandler::Process");
AudioBus* output_bus = Output(0).Bus();
if (!IsInitialized()) {
......
......@@ -21,6 +21,7 @@
#include "third_party/blink/renderer/platform/audio/audio_utilities.h"
#include "third_party/blink/renderer/platform/bindings/exception_messages.h"
#include "third_party/blink/renderer/platform/heap/persistent.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h"
#include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h"
......@@ -85,6 +86,9 @@ scoped_refptr<AudioWorkletHandler> AudioWorkletHandler::Create(
void AudioWorkletHandler::Process(uint32_t frames_to_process) {
DCHECK(Context()->IsAudioThread());
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("webaudio.audionode"),
"AudioWorkletHandler::Process");
// Render and update the node state when the processor is ready with no error.
// We also need to check if the global scope is valid before we request
// the rendering in the AudioWorkletGlobalScope.
......
......@@ -34,6 +34,7 @@
#include "third_party/blink/renderer/modules/webaudio/audio_node_output.h"
#include "third_party/blink/renderer/platform/bindings/exception_messages.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h"
#include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h"
......@@ -76,6 +77,9 @@ scoped_refptr<BiquadFilterHandler> BiquadFilterHandler::Create(
}
void BiquadFilterHandler::Process(uint32_t frames_to_process) {
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("webaudio.audionode"),
"BiquadFilterHandler::Process");
AudioBasicProcessorHandler::Process(frames_to_process);
if (!did_warn_bad_filter_state_) {
......
......@@ -29,6 +29,7 @@
#include "third_party/blink/renderer/modules/webaudio/audio_node_output.h"
#include "third_party/blink/renderer/platform/audio/audio_bus.h"
#include "third_party/blink/renderer/platform/audio/audio_utilities.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h"
namespace blink {
......@@ -55,6 +56,9 @@ scoped_refptr<GainHandler> GainHandler::Create(AudioNode& node,
}
void GainHandler::Process(uint32_t frames_to_process) {
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("webaudio.audionode"),
"GainHandler::Process");
// FIXME: for some cases there is a nice optimization to avoid processing
// here, and let the gain change happen in the summing junction input of the
// AudioNode we're connected to. Then we can avoid all of the following:
......
......@@ -33,6 +33,7 @@
#include "third_party/blink/renderer/platform/bindings/exception_messages.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/heap/heap.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h"
#include "third_party/blink/renderer/platform/peerconnection/rtc_peer_connection_handler_platform.h"
#include "third_party/blink/renderer/platform/wtf/uuid.h"
......@@ -80,6 +81,9 @@ MediaStreamAudioDestinationHandler::~MediaStreamAudioDestinationHandler() {
}
void MediaStreamAudioDestinationHandler::Process(uint32_t number_of_frames) {
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("webaudio.audionode"),
"MediaStreamAudioDestinationHandler::Process");
// Conform the input bus into the internal mix bus, which represents
// MediaStreamDestination's channel count.
......
......@@ -30,6 +30,7 @@
#include "third_party/blink/renderer/modules/webaudio/audio_context.h"
#include "third_party/blink/renderer/modules/webaudio/audio_node_output.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h"
namespace blink {
......@@ -91,6 +92,9 @@ void MediaStreamAudioSourceHandler::SetFormat(uint32_t number_of_channels,
}
void MediaStreamAudioSourceHandler::Process(uint32_t number_of_frames) {
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("webaudio.audionode"),
"MediaStreamAudioSourceHandler::Process");
AudioBus* output_bus = Output(0).Bus();
if (!GetAudioSourceProvider()) {
......
......@@ -35,6 +35,7 @@
#include "third_party/blink/renderer/platform/audio/hrtf_panner.h"
#include "third_party/blink/renderer/platform/bindings/exception_messages.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h"
#include "third_party/blink/renderer/platform/wtf/math_extras.h"
namespace blink {
......@@ -163,6 +164,9 @@ void PannerHandler::ProcessIfNecessary(uint32_t frames_to_process) {
}
void PannerHandler::Process(uint32_t frames_to_process) {
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("webaudio.audionode"),
"PannerHandler::Process");
AudioBus* destination = Output(0).Bus();
if (!IsInitialized() || !panner_.get()) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment