OLD | NEW |
---|---|
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 // Software adjust volume of samples, allows each audio stream its own | 5 // Software adjust volume of samples, allows each audio stream its own |
6 // volume without impacting master volume for chrome and other applications. | 6 // volume without impacting master volume for chrome and other applications. |
7 | 7 |
8 // Implemented as templates to allow 8, 16 and 32 bit implementations. | 8 // Implemented as templates to allow 8, 16 and 32 bit implementations. |
9 // 8 bit is unsigned and biased by 128. | 9 // 8 bit is unsigned and biased by 128. |
10 | 10 |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
286 // The sizes here were determined by experimentation and are roughly | 286 // The sizes here were determined by experimentation and are roughly |
287 // the lowest value (for low latency) that still allowed glitch-free | 287 // the lowest value (for low latency) that still allowed glitch-free |
288 // audio under high loads. | 288 // audio under high loads. |
289 // | 289 // |
290 // For Mac OS X and Windows the chromium audio backend uses a low-latency | 290 // For Mac OS X and Windows the chromium audio backend uses a low-latency |
291 // Core Audio API, so a low buffer size is possible. For Linux, further | 291 // Core Audio API, so a low buffer size is possible. For Linux, further |
292 // tuning may be needed. | 292 // tuning may be needed. |
293 #if defined(OS_MACOSX) | 293 #if defined(OS_MACOSX) |
294 return 128; | 294 return 128; |
295 #elif defined(OS_WIN) | 295 #elif defined(OS_WIN) |
296 if (base::win::GetVersion() <= base::win::VERSION_XP) { | |
henrika (OOO until Aug 14)
2011/11/29 12:20:42
This will most likely not work!
It is correct tha
Raymond Toy (Google)
2011/11/29 18:13:57
This will mostly likely need to be set to 2048 aga
| |
297 // Fall back to Windows Wave implementation on Windows XP or lower | |
298 // and assume 48kHz as default sample rate. | |
299 return 480; | |
Raymond Toy (Google)
2011/11/29 18:45:29
I tested this on my Windows 7 machine by adjusting
enal
2011/11/29 18:57:44
2048 does not help with either new or old implemen
Raymond Toy (Google)
2011/11/29 20:01:29
This seems not right. How did you test this? 204
enal
2011/11/29 21:02:45
I figured out what my problem was when testing on
| |
300 } | |
296 // This call must be done on a COM thread configured as MTA. | 301 // This call must be done on a COM thread configured as MTA. |
297 // TODO(tommi): http://code.google.com/p/chromium/issues/detail?id=103835. | 302 // TODO(tommi): http://code.google.com/p/chromium/issues/detail?id=103835. |
298 int mixing_sample_rate = | 303 int mixing_sample_rate = |
299 static_cast<int>(WASAPIAudioOutputStream::HardwareSampleRate(eConsole)); | 304 static_cast<int>(WASAPIAudioOutputStream::HardwareSampleRate(eConsole)); |
300 if (mixing_sample_rate == 48000) | 305 if (mixing_sample_rate == 48000) |
301 return 480; | 306 return 480; |
302 else if (mixing_sample_rate == 44100) | 307 else if (mixing_sample_rate == 44100) |
303 return 448; | 308 return 448; |
304 else | 309 else |
305 return 960; | 310 return 960; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
352 char* ptr = static_cast<char*>(shared_memory->memory()) + shared_memory_size; | 357 char* ptr = static_cast<char*>(shared_memory->memory()) + shared_memory_size; |
353 DCHECK_EQ(0u, reinterpret_cast<size_t>(ptr) & 3); | 358 DCHECK_EQ(0u, reinterpret_cast<size_t>(ptr) & 3); |
354 | 359 |
355 // Actual data size stored at the end of the buffer. | 360 // Actual data size stored at the end of the buffer. |
356 uint32 actual_data_size = | 361 uint32 actual_data_size = |
357 base::subtle::Acquire_Load(reinterpret_cast<volatile Atomic32*>(ptr)); | 362 base::subtle::Acquire_Load(reinterpret_cast<volatile Atomic32*>(ptr)); |
358 return actual_data_size == kUnknownDataSize; | 363 return actual_data_size == kUnknownDataSize; |
359 } | 364 } |
360 | 365 |
361 } // namespace media | 366 } // namespace media |
OLD | NEW |