| OLD | NEW |
| 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/filters/audio_renderer_impl.h" | 5 #include "media/filters/audio_renderer_impl.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 } | 224 } |
| 225 | 225 |
| 226 int sample_rate = decoder_->samples_per_second(); | 226 int sample_rate = decoder_->samples_per_second(); |
| 227 int buffer_size = GetHighLatencyOutputBufferSize(sample_rate); | 227 int buffer_size = GetHighLatencyOutputBufferSize(sample_rate); |
| 228 AudioParameters::Format format = AudioParameters::AUDIO_PCM_LINEAR; | 228 AudioParameters::Format format = AudioParameters::AUDIO_PCM_LINEAR; |
| 229 | 229 |
| 230 // On Windows and Mac we can use the low latency pipeline because they provide | 230 // On Windows and Mac we can use the low latency pipeline because they provide |
| 231 // accurate and smooth delay information. On other platforms like Linux there | 231 // accurate and smooth delay information. On other platforms like Linux there |
| 232 // are jitter issues. | 232 // are jitter issues. |
| 233 // TODO(dalecurtis): Fix bugs: http://crbug.com/138098 http://crbug.com/32757 | 233 // TODO(dalecurtis): Fix bugs: http://crbug.com/138098 http://crbug.com/32757 |
| 234 #if defined(OS_WIN) || defined(OS_MAC) | 234 #if defined(OS_WIN) || defined(OS_MACOSX) |
| 235 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 235 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
| 236 // Either AudioOutputResampler or renderer side mixing must be enabled to use | 236 // Either AudioOutputResampler or renderer side mixing must be enabled to use |
| 237 // the low latency pipeline. | 237 // the low latency pipeline. |
| 238 if (!cmd_line->HasSwitch(switches::kDisableRendererSideMixing) || | 238 if (!cmd_line->HasSwitch(switches::kDisableRendererSideMixing) || |
| 239 !cmd_line->HasSwitch(switches::kDisableAudioOutputResampler)) { | 239 !cmd_line->HasSwitch(switches::kDisableAudioOutputResampler)) { |
| 240 // There are two cases here: | 240 // There are two cases here: |
| 241 // | 241 // |
| 242 // 1. Renderer side mixing is enabled and the buffer size is actually | 242 // 1. Renderer side mixing is enabled and the buffer size is actually |
| 243 // controlled by the size of the AudioBus provided to Render(). In this | 243 // controlled by the size of the AudioBus provided to Render(). In this |
| 244 // case the buffer size below is ignored. | 244 // case the buffer size below is ignored. |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 case kUnderflow: | 629 case kUnderflow: |
| 630 case kRebuffering: | 630 case kRebuffering: |
| 631 case kStopped: | 631 case kStopped: |
| 632 if (status != PIPELINE_OK) | 632 if (status != PIPELINE_OK) |
| 633 error_cb_.Run(status); | 633 error_cb_.Run(status); |
| 634 return; | 634 return; |
| 635 } | 635 } |
| 636 } | 636 } |
| 637 | 637 |
| 638 } // namespace media | 638 } // namespace media |
| OLD | NEW |