| 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/renderers/audio_renderer_impl.h" | 5 #include "media/renderers/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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 DCHECK_EQ(buffering_state_, BUFFERING_HAVE_NOTHING); | 301 DCHECK_EQ(buffering_state_, BUFFERING_HAVE_NOTHING); |
| 302 DCHECK(!pending_read_) << "Pending read must complete before seeking"; | 302 DCHECK(!pending_read_) << "Pending read must complete before seeking"; |
| 303 | 303 |
| 304 ChangeState_Locked(kPlaying); | 304 ChangeState_Locked(kPlaying); |
| 305 AttemptRead_Locked(); | 305 AttemptRead_Locked(); |
| 306 } | 306 } |
| 307 | 307 |
| 308 void AudioRendererImpl::Initialize( | 308 void AudioRendererImpl::Initialize( |
| 309 DemuxerStream* stream, | 309 DemuxerStream* stream, |
| 310 const PipelineStatusCB& init_cb, | 310 const PipelineStatusCB& init_cb, |
| 311 const SetDecryptorReadyCB& set_decryptor_ready_cb, | 311 const SetCdmReadyCB& set_cdm_ready_cb, |
| 312 const StatisticsCB& statistics_cb, | 312 const StatisticsCB& statistics_cb, |
| 313 const BufferingStateCB& buffering_state_cb, | 313 const BufferingStateCB& buffering_state_cb, |
| 314 const base::Closure& ended_cb, | 314 const base::Closure& ended_cb, |
| 315 const PipelineStatusCB& error_cb, | 315 const PipelineStatusCB& error_cb, |
| 316 const base::Closure& waiting_for_decryption_key_cb) { | 316 const base::Closure& waiting_for_decryption_key_cb) { |
| 317 DVLOG(1) << __FUNCTION__; | 317 DVLOG(1) << __FUNCTION__; |
| 318 DCHECK(task_runner_->BelongsToCurrentThread()); | 318 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 319 DCHECK(stream); | 319 DCHECK(stream); |
| 320 DCHECK_EQ(stream->type(), DemuxerStream::AUDIO); | 320 DCHECK_EQ(stream->type(), DemuxerStream::AUDIO); |
| 321 DCHECK(!init_cb.is_null()); | 321 DCHECK(!init_cb.is_null()); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 hw_params.sample_rate(), hw_params.bits_per_sample(), | 360 hw_params.sample_rate(), hw_params.bits_per_sample(), |
| 361 hardware_config_.GetHighLatencyBufferSize()); | 361 hardware_config_.GetHighLatencyBufferSize()); |
| 362 } | 362 } |
| 363 | 363 |
| 364 audio_clock_.reset( | 364 audio_clock_.reset( |
| 365 new AudioClock(base::TimeDelta(), audio_parameters_.sample_rate())); | 365 new AudioClock(base::TimeDelta(), audio_parameters_.sample_rate())); |
| 366 | 366 |
| 367 audio_buffer_stream_->Initialize( | 367 audio_buffer_stream_->Initialize( |
| 368 stream, base::Bind(&AudioRendererImpl::OnAudioBufferStreamInitialized, | 368 stream, base::Bind(&AudioRendererImpl::OnAudioBufferStreamInitialized, |
| 369 weak_factory_.GetWeakPtr()), | 369 weak_factory_.GetWeakPtr()), |
| 370 set_decryptor_ready_cb, statistics_cb, waiting_for_decryption_key_cb); | 370 set_cdm_ready_cb, statistics_cb, waiting_for_decryption_key_cb); |
| 371 } | 371 } |
| 372 | 372 |
| 373 void AudioRendererImpl::OnAudioBufferStreamInitialized(bool success) { | 373 void AudioRendererImpl::OnAudioBufferStreamInitialized(bool success) { |
| 374 DVLOG(1) << __FUNCTION__ << ": " << success; | 374 DVLOG(1) << __FUNCTION__ << ": " << success; |
| 375 DCHECK(task_runner_->BelongsToCurrentThread()); | 375 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 376 | 376 |
| 377 base::AutoLock auto_lock(lock_); | 377 base::AutoLock auto_lock(lock_); |
| 378 | 378 |
| 379 if (!success) { | 379 if (!success) { |
| 380 state_ = kUninitialized; | 380 state_ = kUninitialized; |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 806 << buffering_state; | 806 << buffering_state; |
| 807 DCHECK_NE(buffering_state_, buffering_state); | 807 DCHECK_NE(buffering_state_, buffering_state); |
| 808 lock_.AssertAcquired(); | 808 lock_.AssertAcquired(); |
| 809 buffering_state_ = buffering_state; | 809 buffering_state_ = buffering_state; |
| 810 | 810 |
| 811 task_runner_->PostTask(FROM_HERE, | 811 task_runner_->PostTask(FROM_HERE, |
| 812 base::Bind(buffering_state_cb_, buffering_state_)); | 812 base::Bind(buffering_state_cb_, buffering_state_)); |
| 813 } | 813 } |
| 814 | 814 |
| 815 } // namespace media | 815 } // namespace media |
| OLD | NEW |