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/filters/audio_renderer_impl.h" | 5 #include "media/filters/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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
395 received_end_of_stream_ = true; | 395 received_end_of_stream_ = true; |
396 | 396 |
397 // Transition to kPlaying if we are currently handling an underflow since | 397 // Transition to kPlaying if we are currently handling an underflow since |
398 // no more data will be arriving. | 398 // no more data will be arriving. |
399 if (state_ == kUnderflow || state_ == kRebuffering) | 399 if (state_ == kUnderflow || state_ == kRebuffering) |
400 ChangeState_Locked(kPlaying); | 400 ChangeState_Locked(kPlaying); |
401 } else { | 401 } else { |
402 if (state_ == kPrerolling && IsBeforePrerollTime(buffer)) | 402 if (state_ == kPrerolling && IsBeforePrerollTime(buffer)) |
403 return true; | 403 return true; |
404 | 404 |
405 if (state_ != kUninitialized && state_ != kStopped) | 405 if (state_ != kUninitialized && state_ != kStopped) { |
406 if (state_ == kPrerolling) { | |
acolwell GONE FROM CHROMIUM
2013/12/12 23:46:19
nit: move this into the kPrerolling block above?
DaleCurtis
2013/12/13 03:19:11
Done.
| |
407 // Trim off any additional time before the preroll timestamp. | |
408 const base::TimeDelta trim_time = | |
409 preroll_timestamp_ - buffer->timestamp(); | |
410 if (trim_time > base::TimeDelta()) { | |
411 buffer->TrimStart(buffer->frame_count() * | |
412 (static_cast<double>(trim_time.InMicroseconds()) / | |
413 buffer->duration().InMicroseconds())); | |
414 } | |
415 } | |
406 algorithm_->EnqueueBuffer(buffer); | 416 algorithm_->EnqueueBuffer(buffer); |
417 } | |
407 } | 418 } |
408 | 419 |
409 switch (state_) { | 420 switch (state_) { |
410 case kUninitialized: | 421 case kUninitialized: |
411 case kFlushing: | 422 case kFlushing: |
412 NOTREACHED(); | 423 NOTREACHED(); |
413 return false; | 424 return false; |
414 | 425 |
415 case kPaused: | 426 case kPaused: |
416 DCHECK(!pending_read_); | 427 DCHECK(!pending_read_); |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
682 } | 693 } |
683 } | 694 } |
684 | 695 |
685 void AudioRendererImpl::ChangeState_Locked(State new_state) { | 696 void AudioRendererImpl::ChangeState_Locked(State new_state) { |
686 DVLOG(1) << __FUNCTION__ << " : " << state_ << " -> " << new_state; | 697 DVLOG(1) << __FUNCTION__ << " : " << state_ << " -> " << new_state; |
687 lock_.AssertAcquired(); | 698 lock_.AssertAcquired(); |
688 state_ = new_state; | 699 state_ = new_state; |
689 } | 700 } |
690 | 701 |
691 } // namespace media | 702 } // namespace media |
OLD | NEW |