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 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <utility> | 10 #include <utility> |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 DCHECK_EQ(buffering_state_, BUFFERING_HAVE_NOTHING); | 303 DCHECK_EQ(buffering_state_, BUFFERING_HAVE_NOTHING); |
304 DCHECK(!pending_read_) << "Pending read must complete before seeking"; | 304 DCHECK(!pending_read_) << "Pending read must complete before seeking"; |
305 | 305 |
306 ChangeState_Locked(kPlaying); | 306 ChangeState_Locked(kPlaying); |
307 AttemptRead_Locked(); | 307 AttemptRead_Locked(); |
308 } | 308 } |
309 | 309 |
310 void AudioRendererImpl::Initialize( | 310 void AudioRendererImpl::Initialize( |
311 DemuxerStream* stream, | 311 DemuxerStream* stream, |
312 const PipelineStatusCB& init_cb, | 312 const PipelineStatusCB& init_cb, |
313 const SetCdmReadyCB& set_cdm_ready_cb, | 313 CdmContext* cdm_context, |
314 const StatisticsCB& statistics_cb, | 314 const StatisticsCB& statistics_cb, |
315 const BufferingStateCB& buffering_state_cb, | 315 const BufferingStateCB& buffering_state_cb, |
316 const base::Closure& ended_cb, | 316 const base::Closure& ended_cb, |
317 const PipelineStatusCB& error_cb, | 317 const PipelineStatusCB& error_cb, |
318 const base::Closure& waiting_for_decryption_key_cb) { | 318 const base::Closure& waiting_for_decryption_key_cb) { |
319 DVLOG(1) << __FUNCTION__; | 319 DVLOG(1) << __FUNCTION__; |
320 DCHECK(task_runner_->BelongsToCurrentThread()); | 320 DCHECK(task_runner_->BelongsToCurrentThread()); |
321 DCHECK(stream); | 321 DCHECK(stream); |
322 DCHECK_EQ(stream->type(), DemuxerStream::AUDIO); | 322 DCHECK_EQ(stream->type(), DemuxerStream::AUDIO); |
323 DCHECK(!init_cb.is_null()); | 323 DCHECK(!init_cb.is_null()); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 AudioHardwareConfig::GetHighLatencyBufferSize(sample_rate, | 379 AudioHardwareConfig::GetHighLatencyBufferSize(sample_rate, |
380 preferred_buffer_size)); | 380 preferred_buffer_size)); |
381 } | 381 } |
382 | 382 |
383 audio_clock_.reset( | 383 audio_clock_.reset( |
384 new AudioClock(base::TimeDelta(), audio_parameters_.sample_rate())); | 384 new AudioClock(base::TimeDelta(), audio_parameters_.sample_rate())); |
385 | 385 |
386 audio_buffer_stream_->Initialize( | 386 audio_buffer_stream_->Initialize( |
387 stream, base::Bind(&AudioRendererImpl::OnAudioBufferStreamInitialized, | 387 stream, base::Bind(&AudioRendererImpl::OnAudioBufferStreamInitialized, |
388 weak_factory_.GetWeakPtr()), | 388 weak_factory_.GetWeakPtr()), |
389 set_cdm_ready_cb, statistics_cb, waiting_for_decryption_key_cb); | 389 cdm_context, statistics_cb, waiting_for_decryption_key_cb); |
390 } | 390 } |
391 | 391 |
392 void AudioRendererImpl::OnAudioBufferStreamInitialized(bool success) { | 392 void AudioRendererImpl::OnAudioBufferStreamInitialized(bool success) { |
393 DVLOG(1) << __FUNCTION__ << ": " << success; | 393 DVLOG(1) << __FUNCTION__ << ": " << success; |
394 DCHECK(task_runner_->BelongsToCurrentThread()); | 394 DCHECK(task_runner_->BelongsToCurrentThread()); |
395 | 395 |
396 base::AutoLock auto_lock(lock_); | 396 base::AutoLock auto_lock(lock_); |
397 | 397 |
398 if (!success) { | 398 if (!success) { |
399 state_ = kUninitialized; | 399 state_ = kUninitialized; |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 << buffering_state; | 831 << buffering_state; |
832 DCHECK_NE(buffering_state_, buffering_state); | 832 DCHECK_NE(buffering_state_, buffering_state); |
833 lock_.AssertAcquired(); | 833 lock_.AssertAcquired(); |
834 buffering_state_ = buffering_state; | 834 buffering_state_ = buffering_state; |
835 | 835 |
836 task_runner_->PostTask(FROM_HERE, | 836 task_runner_->PostTask(FROM_HERE, |
837 base::Bind(buffering_state_cb_, buffering_state_)); | 837 base::Bind(buffering_state_cb_, buffering_state_)); |
838 } | 838 } |
839 | 839 |
840 } // namespace media | 840 } // namespace media |
OLD | NEW |