Commit ab52b626 authored by hongchan's avatar hongchan Committed by Commit bot

Add TRACE_EVENTX() in WebAudio rendering pipe line

This CL adds multiple trace events (TRACE_EVENTX) in various points in
the rendering to investigate the cause of glitches.

("webaudio", "AudioDestination::Start")
("webaudio", "AudioDestination::Stop")
("webaudio", "AudioDestination::RequestRenderOnWebThread", "frames_to_render", frames_to_render)
("webaudio", "AudioDestination::Render", "callback_buffer_size", number_of_frames)
("webaudio", "AudioDestinationHandler::Render")

BUG=718554

Review-Url: https://codereview.chromium.org/2858223003
Cr-Commit-Position: refs/heads/master@{#469557}
parent c5b02112
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "modules/webaudio/BaseAudioContext.h" #include "modules/webaudio/BaseAudioContext.h"
#include "platform/audio/AudioUtilities.h" #include "platform/audio/AudioUtilities.h"
#include "platform/audio/DenormalDisabler.h" #include "platform/audio/DenormalDisabler.h"
#include "platform/instrumentation/tracing/TraceEvent.h"
#include "platform/wtf/Atomics.h" #include "platform/wtf/Atomics.h"
namespace blink { namespace blink {
...@@ -46,6 +47,8 @@ void AudioDestinationHandler::Render(AudioBus* source_bus, ...@@ -46,6 +47,8 @@ void AudioDestinationHandler::Render(AudioBus* source_bus,
AudioBus* destination_bus, AudioBus* destination_bus,
size_t number_of_frames, size_t number_of_frames,
const AudioIOPosition& output_position) { const AudioIOPosition& output_position) {
TRACE_EVENT0("webaudio", "AudioDestinationHandler::Render");
// We don't want denormals slowing down any of the audio processing // We don't want denormals slowing down any of the audio processing
// since they can very seriously hurt performance. This will take care of all // since they can very seriously hurt performance. This will take care of all
// AudioNodes because they all process within this scope. // AudioNodes because they all process within this scope.
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include "platform/WebTaskRunner.h" #include "platform/WebTaskRunner.h"
#include "platform/audio/AudioUtilities.h" #include "platform/audio/AudioUtilities.h"
#include "platform/audio/PushPullFIFO.h" #include "platform/audio/PushPullFIFO.h"
#include "platform/instrumentation/tracing/TraceEvent.h"
#include "platform/weborigin/SecurityOrigin.h" #include "platform/weborigin/SecurityOrigin.h"
#include "platform/wtf/PtrUtil.h" #include "platform/wtf/PtrUtil.h"
#include "public/platform/Platform.h" #include "public/platform/Platform.h"
...@@ -100,6 +101,9 @@ void AudioDestination::Render(const WebVector<float*>& destination_data, ...@@ -100,6 +101,9 @@ void AudioDestination::Render(const WebVector<float*>& destination_data,
double delay, double delay,
double delay_timestamp, double delay_timestamp,
size_t prior_frames_skipped) { size_t prior_frames_skipped) {
TRACE_EVENT1("webaudio", "AudioDestination::Render",
"callback_buffer_size", number_of_frames);
// This method is called by AudioDeviceThread. // This method is called by AudioDeviceThread.
DCHECK(!IsRenderingThread()); DCHECK(!IsRenderingThread());
...@@ -135,6 +139,9 @@ void AudioDestination::RequestRenderOnWebThread(size_t frames_requested, ...@@ -135,6 +139,9 @@ void AudioDestination::RequestRenderOnWebThread(size_t frames_requested,
double delay, double delay,
double delay_timestamp, double delay_timestamp,
size_t prior_frames_skipped) { size_t prior_frames_skipped) {
TRACE_EVENT1("webaudio", "AudioDestination::RequestRenderOnWebThread",
"frames_to_render", frames_to_render);
// This method is called by WebThread. // This method is called by WebThread.
DCHECK(IsRenderingThread()); DCHECK(IsRenderingThread());
...@@ -176,6 +183,7 @@ void AudioDestination::Start() { ...@@ -176,6 +183,7 @@ void AudioDestination::Start() {
// Start the "audio device" after the rendering thread is ready. // Start the "audio device" after the rendering thread is ready.
if (web_audio_device_ && !is_playing_) { if (web_audio_device_ && !is_playing_) {
TRACE_EVENT0("webaudio", "AudioDestination::Start");
rendering_thread_ = rendering_thread_ =
Platform::Current()->CreateThread("WebAudio Rendering Thread"); Platform::Current()->CreateThread("WebAudio Rendering Thread");
web_audio_device_->Start(); web_audio_device_->Start();
...@@ -189,6 +197,7 @@ void AudioDestination::Stop() { ...@@ -189,6 +197,7 @@ void AudioDestination::Stop() {
// This assumes stopping the "audio device" is synchronous and dumping the // This assumes stopping the "audio device" is synchronous and dumping the
// rendering thread is safe after that. // rendering thread is safe after that.
if (web_audio_device_ && is_playing_) { if (web_audio_device_ && is_playing_) {
TRACE_EVENT0("webaudio", "AudioDestination::Stop");
web_audio_device_->Stop(); web_audio_device_->Stop();
rendering_thread_.reset(); rendering_thread_.reset();
is_playing_ = false; is_playing_ = false;
......
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