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

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

Issue 9325044: Remove AudioDecoder from the Filter heirarchy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: CR responses. Created 8 years, 10 months 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/filters/audio_renderer_base.h ('k') | media/filters/ffmpeg_audio_decoder.h » ('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_base.h" 5 #include "media/filters/audio_renderer_base.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 // Pause only when we've completed our pending read. 45 // Pause only when we've completed our pending read.
46 if (!pending_read_) { 46 if (!pending_read_) {
47 pause_callback_.Run(); 47 pause_callback_.Run();
48 pause_callback_.Reset(); 48 pause_callback_.Reset();
49 } else { 49 } else {
50 state_ = kPaused; 50 state_ = kPaused;
51 } 51 }
52 } 52 }
53 53
54 void AudioRendererBase::Flush(const base::Closure& callback) {
55 decoder_->Reset(callback);
56 }
57
54 void AudioRendererBase::Stop(const base::Closure& callback) { 58 void AudioRendererBase::Stop(const base::Closure& callback) {
55 OnStop(); 59 OnStop();
56 { 60 {
57 base::AutoLock auto_lock(lock_); 61 base::AutoLock auto_lock(lock_);
58 state_ = kStopped; 62 state_ = kStopped;
59 algorithm_.reset(NULL); 63 algorithm_.reset(NULL);
60 audio_time_cb_.Reset(); 64 audio_time_cb_.Reset();
61 underflow_callback_.Reset(); 65 underflow_callback_.Reset();
62 } 66 }
63 if (!callback.is_null()) { 67 if (!callback.is_null()) {
(...skipping 13 matching lines...) Expand all
77 81
78 // Throw away everything and schedule our reads. 82 // Throw away everything and schedule our reads.
79 last_fill_buffer_time_ = base::TimeDelta(); 83 last_fill_buffer_time_ = base::TimeDelta();
80 recieved_end_of_stream_ = false; 84 recieved_end_of_stream_ = false;
81 rendered_end_of_stream_ = false; 85 rendered_end_of_stream_ = false;
82 86
83 // |algorithm_| will request more reads. 87 // |algorithm_| will request more reads.
84 algorithm_->FlushBuffers(); 88 algorithm_->FlushBuffers();
85 } 89 }
86 90
87 void AudioRendererBase::Initialize(AudioDecoder* decoder, 91 void AudioRendererBase::Initialize(const scoped_refptr<AudioDecoder>& decoder,
88 const PipelineStatusCB& init_callback, 92 const PipelineStatusCB& init_callback,
89 const base::Closure& underflow_callback, 93 const base::Closure& underflow_callback,
90 const AudioTimeCB& audio_time_cb) { 94 const AudioTimeCB& audio_time_cb) {
91 DCHECK(decoder); 95 DCHECK(decoder);
92 DCHECK(!init_callback.is_null()); 96 DCHECK(!init_callback.is_null());
93 DCHECK(!underflow_callback.is_null()); 97 DCHECK(!underflow_callback.is_null());
94 DCHECK(!audio_time_cb.is_null()); 98 DCHECK(!audio_time_cb.is_null());
95 DCHECK_EQ(kUninitialized, state_); 99 DCHECK_EQ(kUninitialized, state_);
96 decoder_ = decoder; 100 decoder_ = decoder;
97 underflow_callback_ = underflow_callback; 101 underflow_callback_ = underflow_callback;
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 base::AutoLock auto_lock(lock_); 296 base::AutoLock auto_lock(lock_);
293 return algorithm_->playback_rate(); 297 return algorithm_->playback_rate();
294 } 298 }
295 299
296 bool AudioRendererBase::IsBeforeSeekTime(const scoped_refptr<Buffer>& buffer) { 300 bool AudioRendererBase::IsBeforeSeekTime(const scoped_refptr<Buffer>& buffer) {
297 return (state_ == kSeeking) && buffer && !buffer->IsEndOfStream() && 301 return (state_ == kSeeking) && buffer && !buffer->IsEndOfStream() &&
298 (buffer->GetTimestamp() + buffer->GetDuration()) < seek_timestamp_; 302 (buffer->GetTimestamp() + buffer->GetDuration()) < seek_timestamp_;
299 } 303 }
300 304
301 } // namespace media 305 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/audio_renderer_base.h ('k') | media/filters/ffmpeg_audio_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698