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

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

Issue 1838203003: [TO M50] Enable implicit signalling for HE AAC v1 & v2 in ADTS. (Closed) Base URL: https://chromium.googlesource.com/a/chromium/src.git@2661
Patch Set: Created 4 years, 8 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
« no previous file with comments | « media/base/audio_buffer.h ('k') | media/filters/ffmpeg_audio_decoder.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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.h" 5 #include "media/base/audio_buffer.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_bus.h" 10 #include "media/base/audio_bus.h"
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 return sample >> 16; 201 return sample >> 16;
202 } 202 }
203 203
204 template <> 204 template <>
205 inline int16_t ConvertSample<float, int16_t>(float sample) { 205 inline int16_t ConvertSample<float, int16_t>(float sample) {
206 return static_cast<int16_t>( 206 return static_cast<int16_t>(
207 nearbyint(sample < 0 ? (-sample) * std::numeric_limits<int16_t>::min() 207 nearbyint(sample < 0 ? (-sample) * std::numeric_limits<int16_t>::min()
208 : sample * std::numeric_limits<int16_t>::max())); 208 : sample * std::numeric_limits<int16_t>::max()));
209 } 209 }
210 210
211 void AudioBuffer::AdjustSampleRate(int sample_rate) {
212 DCHECK(!end_of_stream_);
213 sample_rate_ = sample_rate;
214 duration_ = CalculateDuration(adjusted_frame_count_, sample_rate_);
215 }
216
211 void AudioBuffer::ReadFrames(int frames_to_copy, 217 void AudioBuffer::ReadFrames(int frames_to_copy,
212 int source_frame_offset, 218 int source_frame_offset,
213 int dest_frame_offset, 219 int dest_frame_offset,
214 AudioBus* dest) { 220 AudioBus* dest) {
215 // Deinterleave each channel (if necessary) and convert to 32bit 221 // Deinterleave each channel (if necessary) and convert to 32bit
216 // floating-point with nominal range -1.0 -> +1.0 (if necessary). 222 // floating-point with nominal range -1.0 -> +1.0 (if necessary).
217 223
218 // |dest| must have the same number of channels, and the number of frames 224 // |dest| must have the same number of channels, and the number of frames
219 // specified must be in range. 225 // specified must be in range.
220 DCHECK(!end_of_stream()); 226 DCHECK(!end_of_stream());
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 } 424 }
419 } else { 425 } else {
420 CHECK_EQ(frames_to_copy, 0); 426 CHECK_EQ(frames_to_copy, 0);
421 } 427 }
422 428
423 // Trim the leftover data off the end of the buffer and update duration. 429 // Trim the leftover data off the end of the buffer and update duration.
424 TrimEnd(frames_to_trim); 430 TrimEnd(frames_to_trim);
425 } 431 }
426 432
427 } // namespace media 433 } // namespace media
OLDNEW
« no previous file with comments | « media/base/audio_buffer.h ('k') | media/filters/ffmpeg_audio_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698