Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: media/filters/audio_renderer_impl.cc

Issue 100503006: Cleanup OPUS decoder. Remove extraneous transforms and copies. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Trimmings. Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/ffmpeg/ffmpeg_common.cc ('k') | media/filters/ffmpeg_demuxer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 bool AudioRendererImpl::HandleSplicerBuffer( 392 bool AudioRendererImpl::HandleSplicerBuffer(
393 const scoped_refptr<AudioBuffer>& buffer) { 393 const scoped_refptr<AudioBuffer>& buffer) {
394 if (buffer->end_of_stream()) { 394 if (buffer->end_of_stream()) {
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) {
403 return true; 403 if (IsBeforePrerollTime(buffer))
404 return true;
405
406 // Trim off any additional time before the preroll timestamp.
407 const base::TimeDelta trim_time =
408 preroll_timestamp_ - buffer->timestamp();
409 if (trim_time > base::TimeDelta()) {
410 buffer->TrimStart(buffer->frame_count() *
411 (static_cast<double>(trim_time.InMicroseconds()) /
412 buffer->duration().InMicroseconds()));
413 }
414 // If the entire buffer was trimmed, request a new one.
415 if (!buffer->frame_count())
416 return true;
417 }
404 418
405 if (state_ != kUninitialized && state_ != kStopped) 419 if (state_ != kUninitialized && state_ != kStopped)
406 algorithm_->EnqueueBuffer(buffer); 420 algorithm_->EnqueueBuffer(buffer);
407 } 421 }
408 422
409 switch (state_) { 423 switch (state_) {
410 case kUninitialized: 424 case kUninitialized:
411 case kFlushing: 425 case kFlushing:
412 NOTREACHED(); 426 NOTREACHED();
413 return false; 427 return false;
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 } 696 }
683 } 697 }
684 698
685 void AudioRendererImpl::ChangeState_Locked(State new_state) { 699 void AudioRendererImpl::ChangeState_Locked(State new_state) {
686 DVLOG(1) << __FUNCTION__ << " : " << state_ << " -> " << new_state; 700 DVLOG(1) << __FUNCTION__ << " : " << state_ << " -> " << new_state;
687 lock_.AssertAcquired(); 701 lock_.AssertAcquired();
688 state_ = new_state; 702 state_ = new_state;
689 } 703 }
690 704
691 } // namespace media 705 } // namespace media
OLDNEW
« no previous file with comments | « media/ffmpeg/ffmpeg_common.cc ('k') | media/filters/ffmpeg_demuxer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698