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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 if (!pending_read_) | 96 if (!pending_read_) |
97 base::ResetAndReturn(&pause_cb_).Run(); | 97 base::ResetAndReturn(&pause_cb_).Run(); |
98 } | 98 } |
99 | 99 |
100 DoPause(); | 100 DoPause(); |
101 } | 101 } |
102 | 102 |
103 void AudioRendererImpl::DoPause() { | 103 void AudioRendererImpl::DoPause() { |
104 DCHECK(message_loop_->BelongsToCurrentThread()); | 104 DCHECK(message_loop_->BelongsToCurrentThread()); |
105 DCHECK(sink_); | 105 DCHECK(sink_); |
106 sink_->Pause(false); | 106 sink_->Pause(); |
107 } | 107 } |
108 | 108 |
109 void AudioRendererImpl::Flush(const base::Closure& callback) { | 109 void AudioRendererImpl::Flush(const base::Closure& callback) { |
110 DCHECK(message_loop_->BelongsToCurrentThread()); | 110 DCHECK(message_loop_->BelongsToCurrentThread()); |
111 | 111 |
112 if (decrypting_demuxer_stream_) { | 112 if (decrypting_demuxer_stream_) { |
113 decrypting_demuxer_stream_->Reset(base::Bind( | 113 decrypting_demuxer_stream_->Reset(base::Bind( |
114 &AudioRendererImpl::ResetDecoder, weak_this_, callback)); | 114 &AudioRendererImpl::ResetDecoder, weak_this_, callback)); |
115 return; | 115 return; |
116 } | 116 } |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 rendered_end_of_stream_ = false; | 169 rendered_end_of_stream_ = false; |
170 preroll_aborted_ = false; | 170 preroll_aborted_ = false; |
171 | 171 |
172 splicer_->Reset(); | 172 splicer_->Reset(); |
173 algorithm_->FlushBuffers(); | 173 algorithm_->FlushBuffers(); |
174 earliest_end_time_ = now_cb_.Run(); | 174 earliest_end_time_ = now_cb_.Run(); |
175 | 175 |
176 AttemptRead_Locked(); | 176 AttemptRead_Locked(); |
177 } | 177 } |
178 | 178 |
179 // Pause and flush the stream when we preroll to a new location. | 179 sink_->Pause(); |
180 sink_->Pause(true); | |
181 } | 180 } |
182 | 181 |
183 void AudioRendererImpl::Initialize(const scoped_refptr<DemuxerStream>& stream, | 182 void AudioRendererImpl::Initialize(const scoped_refptr<DemuxerStream>& stream, |
184 const PipelineStatusCB& init_cb, | 183 const PipelineStatusCB& init_cb, |
185 const StatisticsCB& statistics_cb, | 184 const StatisticsCB& statistics_cb, |
186 const base::Closure& underflow_cb, | 185 const base::Closure& underflow_cb, |
187 const TimeCB& time_cb, | 186 const TimeCB& time_cb, |
188 const base::Closure& ended_cb, | 187 const base::Closure& ended_cb, |
189 const base::Closure& disabled_cb, | 188 const base::Closure& disabled_cb, |
190 const PipelineStatusCB& error_cb) { | 189 const PipelineStatusCB& error_cb) { |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 case kUnderflow: | 657 case kUnderflow: |
659 case kRebuffering: | 658 case kRebuffering: |
660 case kStopped: | 659 case kStopped: |
661 if (status != PIPELINE_OK) | 660 if (status != PIPELINE_OK) |
662 error_cb_.Run(status); | 661 error_cb_.Run(status); |
663 return; | 662 return; |
664 } | 663 } |
665 } | 664 } |
666 | 665 |
667 } // namespace media | 666 } // namespace media |
OLD | NEW |