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 <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
195 *device_status = device_info.device_status(); | 195 *device_status = device_info.device_status(); |
196 if (device_info.device_status() != media::OUTPUT_DEVICE_STATUS_OK) { | 196 if (device_info.device_status() != media::OUTPUT_DEVICE_STATUS_OK) { |
197 sink_cache_->ReleaseSink(sink.get()); | 197 sink_cache_->ReleaseSink(sink.get()); |
198 sink->Stop(); | 198 sink->Stop(); |
199 return nullptr; | 199 return nullptr; |
200 } | 200 } |
201 | 201 |
202 const media::AudioParameters& mixer_output_params = | 202 const media::AudioParameters& mixer_output_params = |
203 GetMixerOutputParams(input_params, device_info.output_params(), latency); | 203 GetMixerOutputParams(input_params, device_info.output_params(), latency); |
204 media::AudioRendererMixer* mixer = new media::AudioRendererMixer( | 204 media::AudioRendererMixer* mixer = new media::AudioRendererMixer( |
205 mixer_output_params, sink, base::Bind(LogMixerUmaHistogram, latency)); | 205 input_params.IsBitstreamFormat() ? input_params : mixer_output_params, |
chcunningham
2017/06/14 20:03:08
I would put this logic into GetMixerOutputParams.
| |
206 sink, base::Bind(LogMixerUmaHistogram, latency)); | |
206 AudioRendererMixerReference mixer_reference = {mixer, 1, sink.get()}; | 207 AudioRendererMixerReference mixer_reference = {mixer, 1, sink.get()}; |
207 mixers_[key] = mixer_reference; | 208 mixers_[key] = mixer_reference; |
208 DVLOG(1) << __func__ << " mixer: " << mixer << " latency: " << latency | 209 DVLOG(1) << __func__ << " mixer: " << mixer << " latency: " << latency |
209 << "\n input: " << input_params.AsHumanReadableString() | 210 << "\n input: " << input_params.AsHumanReadableString() |
210 << "\noutput: " << mixer_output_params.AsHumanReadableString(); | 211 << "\noutput: " << mixer_output_params.AsHumanReadableString(); |
211 return mixer; | 212 return mixer; |
212 } | 213 } |
213 | 214 |
214 void AudioRendererMixerManager::ReturnMixer(media::AudioRendererMixer* mixer) { | 215 void AudioRendererMixerManager::ReturnMixer(media::AudioRendererMixer* mixer) { |
215 base::AutoLock auto_lock(mixers_lock_); | 216 base::AutoLock auto_lock(mixers_lock_); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
247 const url::Origin& security_origin) | 248 const url::Origin& security_origin) |
248 : source_render_frame_id(source_render_frame_id), | 249 : source_render_frame_id(source_render_frame_id), |
249 params(params), | 250 params(params), |
250 latency(latency), | 251 latency(latency), |
251 device_id(device_id), | 252 device_id(device_id), |
252 security_origin(security_origin) {} | 253 security_origin(security_origin) {} |
253 | 254 |
254 AudioRendererMixerManager::MixerKey::MixerKey(const MixerKey& other) = default; | 255 AudioRendererMixerManager::MixerKey::MixerKey(const MixerKey& other) = default; |
255 | 256 |
256 } // namespace content | 257 } // namespace content |
OLD | NEW |