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

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

Issue 265943002: Revert of Remove AudioBuffer::set_duration(), instead base on frames. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
« no previous file with comments | « media/base/audio_buffer.cc ('k') | media/base/audio_buffer_converter_unittest.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 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));
230 timestamp_helper_.AddFrames(request_frames); 232 timestamp_helper_.AddFrames(request_frames);
231 233
232 queued_outputs_.push_back(output_buffer); 234 queued_outputs_.push_back(output_buffer);
233 } 235 }
234 236
235 void AudioBufferConverter::Flush() { 237 void AudioBufferConverter::Flush() {
236 if (!audio_converter_) 238 if (!audio_converter_)
237 return; 239 return;
238 is_flushing_ = true; 240 is_flushing_ = true;
239 ConvertIfPossible(); 241 ConvertIfPossible();
240 is_flushing_ = false; 242 is_flushing_ = false;
241 audio_converter_->Reset(); 243 audio_converter_->Reset();
242 DCHECK_EQ(input_frames_, 0); 244 DCHECK_EQ(input_frames_, 0);
243 DCHECK_EQ(last_input_buffer_offset_, 0); 245 DCHECK_EQ(last_input_buffer_offset_, 0);
244 DCHECK_LT(buffered_input_frames_, 1.0); 246 DCHECK_LT(buffered_input_frames_, 1.0);
245 DCHECK(queued_inputs_.empty()); 247 DCHECK(queued_inputs_.empty());
246 buffered_input_frames_ = 0.0; 248 buffered_input_frames_ = 0.0;
247 } 249 }
248 250
249 } // namespace media 251 } // namespace media
OLDNEW
« no previous file with comments | « media/base/audio_buffer.cc ('k') | media/base/audio_buffer_converter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698