| 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 |
| 322 // Specify the latency info to be passed to the browser side. |
| 323 sink_params.set_latency_tag(AudioDeviceFactory::GetSourceLatencyType( |
| 324 AudioDeviceFactory::kSourceNonRtcAudioTrack)); |
| 325 |
| 321 sink_->Initialize(sink_params, this); | 326 sink_->Initialize(sink_params, this); |
| 322 sink_->Start(); | 327 sink_->Start(); |
| 323 sink_->SetVolume(volume_); | 328 sink_->SetVolume(volume_); |
| 324 sink_->Play(); // Not all the sinks play on start. | 329 sink_->Play(); // Not all the sinks play on start. |
| 325 sink_started_ = true; | 330 sink_started_ = true; |
| 326 if (IsLocalRenderer()) { | 331 if (IsLocalRenderer()) { |
| 327 UMA_HISTOGRAM_ENUMERATION("Media.LocalRendererSinkStates", kSinkStarted, | 332 UMA_HISTOGRAM_ENUMERATION("Media.LocalRendererSinkStates", kSinkStarted, |
| 328 kSinkStatesMax); | 333 kSinkStatesMax); |
| 329 } | 334 } |
| 330 } | 335 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 if (source_params_.IsValid()) { | 386 if (source_params_.IsValid()) { |
| 382 prior_elapsed_render_time_ = | 387 prior_elapsed_render_time_ = |
| 383 ComputeTotalElapsedRenderTime(prior_elapsed_render_time_, | 388 ComputeTotalElapsedRenderTime(prior_elapsed_render_time_, |
| 384 num_samples_rendered_, | 389 num_samples_rendered_, |
| 385 source_params_.sample_rate()); | 390 source_params_.sample_rate()); |
| 386 num_samples_rendered_ = 0; | 391 num_samples_rendered_ = 0; |
| 387 } | 392 } |
| 388 } | 393 } |
| 389 | 394 |
| 390 } // namespace content | 395 } // namespace content |
| OLD | NEW |