| 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 "content/renderer/media/audio_renderer_mixer_manager.h" | 5 #include "content/renderer/media/audio_renderer_mixer_manager.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "content/renderer/media/audio_device_factory.h" | 9 #include "content/renderer/media/audio_device_factory.h" |
| 10 #include "media/audio/audio_output_device.h" | 10 #include "media/audio/audio_output_device.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 int sample_rate = params.sample_rate(); | 60 int sample_rate = params.sample_rate(); |
| 61 #else | 61 #else |
| 62 int sample_rate = hardware_config_->GetOutputSampleRate(); | 62 int sample_rate = hardware_config_->GetOutputSampleRate(); |
| 63 #endif | 63 #endif |
| 64 | 64 |
| 65 // Create output parameters based on the audio hardware configuration for | 65 // Create output parameters based on the audio hardware configuration for |
| 66 // passing on to the output sink. Force to 16-bit output for now since we | 66 // passing on to the output sink. Force to 16-bit output for now since we |
| 67 // know that works well for WebAudio and WebRTC. | 67 // know that works well for WebAudio and WebRTC. |
| 68 media::AudioParameters output_params( | 68 media::AudioParameters output_params( |
| 69 media::AudioParameters::AUDIO_PCM_LOW_LATENCY, params.channel_layout(), | 69 media::AudioParameters::AUDIO_PCM_LOW_LATENCY, params.channel_layout(), |
| 70 sample_rate, 16, hardware_config_->GetOutputBufferSize()); | 70 sample_rate, 16, hardware_config_->GetHighLatencyBufferSize()); |
| 71 | 71 |
| 72 // If we've created invalid output parameters, simply pass on the input params | 72 // If we've created invalid output parameters, simply pass on the input params |
| 73 // and let the browser side handle automatic fallback. | 73 // and let the browser side handle automatic fallback. |
| 74 if (!output_params.IsValid()) | 74 if (!output_params.IsValid()) |
| 75 output_params = params; | 75 output_params = params; |
| 76 | 76 |
| 77 media::AudioRendererMixer* mixer; | 77 media::AudioRendererMixer* mixer; |
| 78 if (sink_for_testing_) { | 78 if (sink_for_testing_) { |
| 79 mixer = new media::AudioRendererMixer( | 79 mixer = new media::AudioRendererMixer( |
| 80 params, output_params, sink_for_testing_); | 80 params, output_params, sink_for_testing_); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 100 | 100 |
| 101 // Only remove the mixer if AudioRendererMixerManager is the last owner. | 101 // Only remove the mixer if AudioRendererMixerManager is the last owner. |
| 102 it->second.ref_count--; | 102 it->second.ref_count--; |
| 103 if (it->second.ref_count == 0) { | 103 if (it->second.ref_count == 0) { |
| 104 delete it->second.mixer; | 104 delete it->second.mixer; |
| 105 mixers_.erase(it); | 105 mixers_.erase(it); |
| 106 } | 106 } |
| 107 } | 107 } |
| 108 | 108 |
| 109 } // namespace content | 109 } // namespace content |
| OLD | NEW |