| 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/track_audio_renderer.h" | 5 #include "content/renderer/media/track_audio_renderer.h" |
| 6 | 6 |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 media::AudioParameters sink_params( | 311 media::AudioParameters sink_params( |
| 312 hardware_params.format(), source_params_.channel_layout(), | 312 hardware_params.format(), source_params_.channel_layout(), |
| 313 source_params_.sample_rate(), source_params_.bits_per_sample(), | 313 source_params_.sample_rate(), source_params_.bits_per_sample(), |
| 314 media::AudioLatency::GetRtcBufferSize( | 314 media::AudioLatency::GetRtcBufferSize( |
| 315 source_params_.sample_rate(), hardware_params.frames_per_buffer())); | 315 source_params_.sample_rate(), hardware_params.frames_per_buffer())); |
| 316 DVLOG(1) << ("TrackAudioRenderer::MaybeStartSink() -- Starting sink. " | 316 DVLOG(1) << ("TrackAudioRenderer::MaybeStartSink() -- Starting sink. " |
| 317 "source_params_={") | 317 "source_params_={") |
| 318 << source_params_.AsHumanReadableString() << "}, hardware_params_={" | 318 << source_params_.AsHumanReadableString() << "}, hardware_params_={" |
| 319 << hardware_params.AsHumanReadableString() << "}, sink parameters={" | 319 << hardware_params.AsHumanReadableString() << "}, sink parameters={" |
| 320 << sink_params.AsHumanReadableString() << '}'; | 320 << sink_params.AsHumanReadableString() << '}'; |
| 321 sink_params.set_latency_tag(AudioDeviceFactory::GetSourceLatencyType( |
| 322 AudioDeviceFactory::kSourceNonRtcAudioTrack)); |
| 321 sink_->Initialize(sink_params, this); | 323 sink_->Initialize(sink_params, this); |
| 322 sink_->Start(); | 324 sink_->Start(); |
| 323 sink_->SetVolume(volume_); | 325 sink_->SetVolume(volume_); |
| 324 sink_->Play(); // Not all the sinks play on start. | 326 sink_->Play(); // Not all the sinks play on start. |
| 325 sink_started_ = true; | 327 sink_started_ = true; |
| 326 if (IsLocalRenderer()) { | 328 if (IsLocalRenderer()) { |
| 327 UMA_HISTOGRAM_ENUMERATION("Media.LocalRendererSinkStates", kSinkStarted, | 329 UMA_HISTOGRAM_ENUMERATION("Media.LocalRendererSinkStates", kSinkStarted, |
| 328 kSinkStatesMax); | 330 kSinkStatesMax); |
| 329 } | 331 } |
| 330 } | 332 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 if (source_params_.IsValid()) { | 383 if (source_params_.IsValid()) { |
| 382 prior_elapsed_render_time_ = | 384 prior_elapsed_render_time_ = |
| 383 ComputeTotalElapsedRenderTime(prior_elapsed_render_time_, | 385 ComputeTotalElapsedRenderTime(prior_elapsed_render_time_, |
| 384 num_samples_rendered_, | 386 num_samples_rendered_, |
| 385 source_params_.sample_rate()); | 387 source_params_.sample_rate()); |
| 386 num_samples_rendered_ = 0; | 388 num_samples_rendered_ = 0; |
| 387 } | 389 } |
| 388 } | 390 } |
| 389 | 391 |
| 390 } // namespace content | 392 } // namespace content |
| OLD | NEW |