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

Side by Side Diff: media/base/audio_buffer_converter.cc

Issue 261533002: Remove AudioBuffer::set_duration(), instead base on frames. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix content decryptor Created 6 years, 7 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/base/audio_buffer_converter.h" 5 #include "media/base/audio_buffer_converter.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "media/base/audio_buffer.h" 10 #include "media/base/audio_buffer.h"
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 } 220 }
221 221
222 // Do the actual conversion. 222 // Do the actual conversion.
223 audio_converter_->Convert(output_bus.get()); 223 audio_converter_->Convert(output_bus.get());
224 frames_remaining -= frames_this_iteration; 224 frames_remaining -= frames_this_iteration;
225 buffered_input_frames_ -= frames_this_iteration * io_sample_rate_ratio_; 225 buffered_input_frames_ -= frames_this_iteration * io_sample_rate_ratio_;
226 } 226 }
227 227
228 // Compute the timestamp. 228 // Compute the timestamp.
229 output_buffer->set_timestamp(timestamp_helper_.GetTimestamp()); 229 output_buffer->set_timestamp(timestamp_helper_.GetTimestamp());
230 output_buffer->set_duration(
231 timestamp_helper_.GetFrameDuration(request_frames));
232 timestamp_helper_.AddFrames(request_frames); 230 timestamp_helper_.AddFrames(request_frames);
233 231
234 queued_outputs_.push_back(output_buffer); 232 queued_outputs_.push_back(output_buffer);
235 } 233 }
236 234
237 void AudioBufferConverter::Flush() { 235 void AudioBufferConverter::Flush() {
238 if (!audio_converter_) 236 if (!audio_converter_)
239 return; 237 return;
240 is_flushing_ = true; 238 is_flushing_ = true;
241 ConvertIfPossible(); 239 ConvertIfPossible();
242 is_flushing_ = false; 240 is_flushing_ = false;
243 audio_converter_->Reset(); 241 audio_converter_->Reset();
244 DCHECK_EQ(input_frames_, 0); 242 DCHECK_EQ(input_frames_, 0);
245 DCHECK_EQ(last_input_buffer_offset_, 0); 243 DCHECK_EQ(last_input_buffer_offset_, 0);
246 DCHECK_LT(buffered_input_frames_, 1.0); 244 DCHECK_LT(buffered_input_frames_, 1.0);
247 DCHECK(queued_inputs_.empty()); 245 DCHECK(queued_inputs_.empty());
248 buffered_input_frames_ = 0.0; 246 buffered_input_frames_ = 0.0;
249 } 247 }
250 248
251 } // namespace media 249 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698