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

Side by Side Diff: content/renderer/media/audio_renderer_impl.cc

Issue 9234066: Detect errors in audio output and report them upstream. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "content/renderer/media/audio_renderer_impl.h" 5 #include "content/renderer/media/audio_renderer_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "content/common/child_process.h" 12 #include "content/common/child_process.h"
13 #include "content/common/media/audio_messages.h" 13 #include "content/common/media/audio_messages.h"
14 #include "content/renderer/render_thread_impl.h" 14 #include "content/renderer/render_thread_impl.h"
15 #include "media/audio/audio_buffers_state.h" 15 #include "media/audio/audio_buffers_state.h"
16 #include "media/audio/audio_util.h" 16 #include "media/audio/audio_util.h"
17 #include "media/base/filter_host.h"
17 18
18 // We define GetBufferSizeForSampleRate() instead of using 19 // We define GetBufferSizeForSampleRate() instead of using
19 // GetAudioHardwareBufferSize() in audio_util because we're using 20 // GetAudioHardwareBufferSize() in audio_util because we're using
20 // the AUDIO_PCM_LINEAR flag, instead of AUDIO_PCM_LOW_LATENCY, 21 // the AUDIO_PCM_LINEAR flag, instead of AUDIO_PCM_LOW_LATENCY,
21 // which the audio_util functions assume. 22 // which the audio_util functions assume.
22 // 23 //
23 // See: http://code.google.com/p/chromium/issues/detail?id=103627 24 // See: http://code.google.com/p/chromium/issues/detail?id=103627
24 // for a more detailed description of the subtleties. 25 // for a more detailed description of the subtleties.
25 static size_t GetBufferSizeForSampleRate(int sample_rate) { 26 static size_t GetBufferSizeForSampleRate(int sample_rate) {
26 // kNominalBufferSize has been tested on Windows, Mac OS X, and Linux 27 // kNominalBufferSize has been tested on Windows, Mac OS X, and Linux
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 // If FillBuffer() didn't give us enough data then zero out the remainder. 241 // If FillBuffer() didn't give us enough data then zero out the remainder.
241 if (filled_frames < number_of_frames) { 242 if (filled_frames < number_of_frames) {
242 int frames_to_zero = number_of_frames - filled_frames; 243 int frames_to_zero = number_of_frames - filled_frames;
243 memset(audio_data[channel_index] + filled_frames, 244 memset(audio_data[channel_index] + filled_frames,
244 0, 245 0,
245 sizeof(float) * frames_to_zero); 246 sizeof(float) * frames_to_zero);
246 } 247 }
247 } 248 }
248 return filled_frames; 249 return filled_frames;
249 } 250 }
251
252 void AudioRendererImpl::OnError() {
253 if (host())
scherkus (not reviewing) 2012/01/26 21:46:13 nit: according to the superclass host() should alw
Ami GONE FROM CHROMIUM 2012/01/26 22:11:01 Done. I wonder why we have these checks sprinkled,
scherkus (not reviewing) 2012/01/26 22:28:09 AFAIK demuxers can execute w/o having a host prese
254 host()->DisableAudioRenderer();
255 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698