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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 AttemptRead_Locked(); | 250 AttemptRead_Locked(); |
251 } | 251 } |
252 | 252 |
253 void AudioRendererImpl::Initialize( | 253 void AudioRendererImpl::Initialize( |
254 DemuxerStream* stream, | 254 DemuxerStream* stream, |
255 const PipelineStatusCB& init_cb, | 255 const PipelineStatusCB& init_cb, |
256 const SetDecryptorReadyCB& set_decryptor_ready_cb, | 256 const SetDecryptorReadyCB& set_decryptor_ready_cb, |
257 const StatisticsCB& statistics_cb, | 257 const StatisticsCB& statistics_cb, |
258 const BufferingStateCB& buffering_state_cb, | 258 const BufferingStateCB& buffering_state_cb, |
259 const base::Closure& ended_cb, | 259 const base::Closure& ended_cb, |
260 const PipelineStatusCB& error_cb) { | 260 const PipelineStatusCB& error_cb, |
| 261 const base::Closure& waiting_for_decryption_key_cb) { |
261 DVLOG(1) << __FUNCTION__; | 262 DVLOG(1) << __FUNCTION__; |
262 DCHECK(task_runner_->BelongsToCurrentThread()); | 263 DCHECK(task_runner_->BelongsToCurrentThread()); |
263 DCHECK(stream); | 264 DCHECK(stream); |
264 DCHECK_EQ(stream->type(), DemuxerStream::AUDIO); | 265 DCHECK_EQ(stream->type(), DemuxerStream::AUDIO); |
265 DCHECK(!init_cb.is_null()); | 266 DCHECK(!init_cb.is_null()); |
266 DCHECK(!statistics_cb.is_null()); | 267 DCHECK(!statistics_cb.is_null()); |
267 DCHECK(!buffering_state_cb.is_null()); | 268 DCHECK(!buffering_state_cb.is_null()); |
268 DCHECK(!ended_cb.is_null()); | 269 DCHECK(!ended_cb.is_null()); |
269 DCHECK(!error_cb.is_null()); | 270 DCHECK(!error_cb.is_null()); |
270 DCHECK_EQ(kUninitialized, state_); | 271 DCHECK_EQ(kUninitialized, state_); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 hw_params.bits_per_sample(), | 311 hw_params.bits_per_sample(), |
311 hardware_config_.GetHighLatencyBufferSize()); | 312 hardware_config_.GetHighLatencyBufferSize()); |
312 } | 313 } |
313 | 314 |
314 audio_clock_.reset( | 315 audio_clock_.reset( |
315 new AudioClock(base::TimeDelta(), audio_parameters_.sample_rate())); | 316 new AudioClock(base::TimeDelta(), audio_parameters_.sample_rate())); |
316 | 317 |
317 audio_buffer_stream_->Initialize( | 318 audio_buffer_stream_->Initialize( |
318 stream, base::Bind(&AudioRendererImpl::OnAudioBufferStreamInitialized, | 319 stream, base::Bind(&AudioRendererImpl::OnAudioBufferStreamInitialized, |
319 weak_factory_.GetWeakPtr()), | 320 weak_factory_.GetWeakPtr()), |
320 set_decryptor_ready_cb, statistics_cb); | 321 set_decryptor_ready_cb, statistics_cb, waiting_for_decryption_key_cb); |
321 } | 322 } |
322 | 323 |
323 void AudioRendererImpl::OnAudioBufferStreamInitialized(bool success) { | 324 void AudioRendererImpl::OnAudioBufferStreamInitialized(bool success) { |
324 DVLOG(1) << __FUNCTION__ << ": " << success; | 325 DVLOG(1) << __FUNCTION__ << ": " << success; |
325 DCHECK(task_runner_->BelongsToCurrentThread()); | 326 DCHECK(task_runner_->BelongsToCurrentThread()); |
326 | 327 |
327 base::AutoLock auto_lock(lock_); | 328 base::AutoLock auto_lock(lock_); |
328 | 329 |
329 if (!success) { | 330 if (!success) { |
330 state_ = kUninitialized; | 331 state_ = kUninitialized; |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 << buffering_state; | 739 << buffering_state; |
739 DCHECK_NE(buffering_state_, buffering_state); | 740 DCHECK_NE(buffering_state_, buffering_state); |
740 lock_.AssertAcquired(); | 741 lock_.AssertAcquired(); |
741 buffering_state_ = buffering_state; | 742 buffering_state_ = buffering_state; |
742 | 743 |
743 task_runner_->PostTask(FROM_HERE, | 744 task_runner_->PostTask(FROM_HERE, |
744 base::Bind(buffering_state_cb_, buffering_state_)); | 745 base::Bind(buffering_state_cb_, buffering_state_)); |
745 } | 746 } |
746 | 747 |
747 } // namespace media | 748 } // namespace media |
OLD | NEW |