Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(370)

Side by Side Diff: media/base/audio_renderer_mixer_input.cc

Issue 2146513002: More tracing for audio rendering (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: actual code Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/base/audio_renderer_mixer_input.h" 5 #include "media/base/audio_renderer_mixer_input.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
11 #include "base/trace_event/trace_event.h"
11 #include "media/base/audio_renderer_mixer.h" 12 #include "media/base/audio_renderer_mixer.h"
12 #include "media/base/audio_renderer_mixer_pool.h" 13 #include "media/base/audio_renderer_mixer_pool.h"
13 14
14 namespace media { 15 namespace media {
15 16
16 AudioRendererMixerInput::AudioRendererMixerInput( 17 AudioRendererMixerInput::AudioRendererMixerInput(
17 AudioRendererMixerPool* mixer_pool, 18 AudioRendererMixerPool* mixer_pool,
18 int owner_id, 19 int owner_id,
19 const std::string& device_id, 20 const std::string& device_id,
20 const url::Origin& security_origin, 21 const url::Origin& security_origin,
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 started_ = true; 169 started_ = true;
169 170
170 if (was_playing) 171 if (was_playing)
171 Play(); 172 Play();
172 173
173 callback.Run(OUTPUT_DEVICE_STATUS_OK); 174 callback.Run(OUTPUT_DEVICE_STATUS_OK);
174 } 175 }
175 176
176 double AudioRendererMixerInput::ProvideInput(AudioBus* audio_bus, 177 double AudioRendererMixerInput::ProvideInput(AudioBus* audio_bus,
177 uint32_t frames_delayed) { 178 uint32_t frames_delayed) {
179 TRACE_EVENT0("audio", "AudioRendererMixerInput::ProvideInput");
178 int frames_filled = callback_->Render(audio_bus, frames_delayed, 0); 180 int frames_filled = callback_->Render(audio_bus, frames_delayed, 0);
179 181
180 // AudioConverter expects unfilled frames to be zeroed. 182 // AudioConverter expects unfilled frames to be zeroed.
181 if (frames_filled < audio_bus->frames()) { 183 if (frames_filled < audio_bus->frames()) {
182 audio_bus->ZeroFramesPartial( 184 audio_bus->ZeroFramesPartial(
183 frames_filled, audio_bus->frames() - frames_filled); 185 frames_filled, audio_bus->frames() - frames_filled);
184 } 186 }
185 187
186 // We're reading |volume_| from the audio device thread and must avoid racing 188 // We're reading |volume_| from the audio device thread and must avoid racing
187 // with the main/media thread calls to SetVolume(). See thread safety comment 189 // with the main/media thread calls to SetVolume(). See thread safety comment
188 // in the header file. 190 // in the header file.
189 { 191 {
190 base::AutoLock auto_lock(volume_lock_); 192 base::AutoLock auto_lock(volume_lock_);
191 return frames_filled > 0 ? volume_ : 0; 193 return frames_filled > 0 ? volume_ : 0;
192 } 194 }
193 } 195 }
194 196
195 void AudioRendererMixerInput::OnRenderError() { 197 void AudioRendererMixerInput::OnRenderError() {
196 callback_->OnRenderError(); 198 callback_->OnRenderError();
197 } 199 }
198 200
199 } // namespace media 201 } // namespace media
OLDNEW
« media/audio/audio_output_resampler.cc ('K') | « media/base/audio_renderer_mixer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698