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

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

Issue 9395057: Fix muted audio when playback rate != 1.0 or 0.0 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase ToT Created 8 years, 9 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
« no previous file with comments | « no previous file | content/renderer/media/audio_renderer_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/renderer/media/audio_hardware.h" 5 #include "content/renderer/media/audio_hardware.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/common/view_messages.h" 8 #include "content/common/view_messages.h"
9 #include "content/renderer/render_thread_impl.h" 9 #include "content/renderer/render_thread_impl.h"
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 uint32 buffer_size = 0; 42 uint32 buffer_size = 0;
43 RenderThreadImpl::current()->Send( 43 RenderThreadImpl::current()->Send(
44 new ViewHostMsg_GetHardwareBufferSize(&buffer_size)); 44 new ViewHostMsg_GetHardwareBufferSize(&buffer_size));
45 output_buffer_size = buffer_size; 45 output_buffer_size = buffer_size;
46 } 46 }
47 47
48 return output_buffer_size; 48 return output_buffer_size;
49 } 49 }
50 50
51 size_t GetHighLatencyOutputBufferSize(int sample_rate) { 51 size_t GetHighLatencyOutputBufferSize(int sample_rate) {
52 // TODO(vrk/crogers): The buffer sizes that this function computes is probably
53 // overly conservative. However, reducing the buffer size to 2048-8192 bytes
54 // caused crbug.com/108396. This computation should be revisited while making
55 // sure crbug.com/108396 doesn't happen again.
56
52 // The minimum number of samples in a hardware packet. 57 // The minimum number of samples in a hardware packet.
53 // This value is selected so that we can handle down to 5khz sample rate. 58 // This value is selected so that we can handle down to 5khz sample rate.
54 static const size_t kMinSamplesPerHardwarePacket = 1024; 59 static const size_t kMinSamplesPerHardwarePacket = 1024;
55 60
56 // The maximum number of samples in a hardware packet. 61 // The maximum number of samples in a hardware packet.
57 // This value is selected so that we can handle up to 192khz sample rate. 62 // This value is selected so that we can handle up to 192khz sample rate.
58 static const size_t kMaxSamplesPerHardwarePacket = 64 * 1024; 63 static const size_t kMaxSamplesPerHardwarePacket = 64 * 1024;
59 64
60 // This constant governs the hardware audio buffer size, this value should be 65 // This constant governs the hardware audio buffer size, this value should be
61 // chosen carefully. 66 // chosen carefully.
(...skipping 27 matching lines...) Expand all
89 void ResetCache() { 94 void ResetCache() {
90 DCHECK(RenderThreadImpl::current() != NULL); 95 DCHECK(RenderThreadImpl::current() != NULL);
91 96
92 output_sample_rate = 0.0; 97 output_sample_rate = 0.0;
93 input_sample_rate = 0.0; 98 input_sample_rate = 0.0;
94 output_buffer_size = 0; 99 output_buffer_size = 0;
95 input_channel_count = 0; 100 input_channel_count = 0;
96 } 101 }
97 102
98 } // namespace audio_hardware 103 } // namespace audio_hardware
OLDNEW
« no previous file with comments | « no previous file | content/renderer/media/audio_renderer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698