| 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) { | |
| 297 // Fall back to Windows Wave implementation on Windows XP or lower | |
| 298 // and assume 48kHz as default sample rate. | |
| 299 return 2048; | |
| 300 } | |
| 301 // This call must be done on a COM thread configured as MTA. | 296 // This call must be done on a COM thread configured as MTA. |
| 302 // TODO(tommi): http://code.google.com/p/chromium/issues/detail?id=103835. | 297 // TODO(tommi): http://code.google.com/p/chromium/issues/detail?id=103835. |
| 303 int mixing_sample_rate = | 298 int mixing_sample_rate = |
| 304 static_cast<int>(WASAPIAudioOutputStream::HardwareSampleRate(eConsole)); | 299 static_cast<int>(WASAPIAudioOutputStream::HardwareSampleRate(eConsole)); |
| 305 if (mixing_sample_rate == 48000) | 300 if (mixing_sample_rate == 48000) |
| 306 return 480; | 301 return 480; |
| 307 else if (mixing_sample_rate == 44100) | 302 else if (mixing_sample_rate == 44100) |
| 308 return 448; | 303 return 448; |
| 309 else | 304 else |
| 310 return 960; | 305 return 960; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 char* ptr = static_cast<char*>(shared_memory->memory()) + shared_memory_size; | 352 char* ptr = static_cast<char*>(shared_memory->memory()) + shared_memory_size; |
| 358 DCHECK_EQ(0u, reinterpret_cast<size_t>(ptr) & 3); | 353 DCHECK_EQ(0u, reinterpret_cast<size_t>(ptr) & 3); |
| 359 | 354 |
| 360 // Actual data size stored at the end of the buffer. | 355 // Actual data size stored at the end of the buffer. |
| 361 uint32 actual_data_size = | 356 uint32 actual_data_size = |
| 362 base::subtle::Acquire_Load(reinterpret_cast<volatile Atomic32*>(ptr)); | 357 base::subtle::Acquire_Load(reinterpret_cast<volatile Atomic32*>(ptr)); |
| 363 return actual_data_size == kUnknownDataSize; | 358 return actual_data_size == kUnknownDataSize; |
| 364 } | 359 } |
| 365 | 360 |
| 366 } // namespace media | 361 } // namespace media |
| OLD | NEW |