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

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

Issue 1422113002: Enable pcm_s32le audio decoding. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: DEPS roll Created 5 years 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 | « chromecast/public/media/decoder_config.h ('k') | media/base/audio_buffer_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 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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 int trim_start, 310 int trim_start,
311 Dest* dest_data) { 311 Dest* dest_data) {
312 switch (sample_format) { 312 switch (sample_format) {
313 case kSampleFormatU8: 313 case kSampleFormatU8:
314 NOTREACHED(); 314 NOTREACHED();
315 break; 315 break;
316 case kSampleFormatS16: 316 case kSampleFormatS16:
317 InterleaveAndConvert<int16, Dest>( 317 InterleaveAndConvert<int16, Dest>(
318 channel_data, frames_to_copy * channel_count, trim_start, dest_data); 318 channel_data, frames_to_copy * channel_count, trim_start, dest_data);
319 break; 319 break;
320 case kSampleFormatS24:
320 case kSampleFormatS32: 321 case kSampleFormatS32:
321 InterleaveAndConvert<int32, Dest>( 322 InterleaveAndConvert<int32, Dest>(
322 channel_data, frames_to_copy * channel_count, trim_start, dest_data); 323 channel_data, frames_to_copy * channel_count, trim_start, dest_data);
323 break; 324 break;
324 case kSampleFormatF32: 325 case kSampleFormatF32:
325 InterleaveAndConvert<float, Dest>( 326 InterleaveAndConvert<float, Dest>(
326 channel_data, frames_to_copy * channel_count, trim_start, dest_data); 327 channel_data, frames_to_copy * channel_count, trim_start, dest_data);
327 break; 328 break;
328 case kSampleFormatPlanarS16: 329 case kSampleFormatPlanarS16:
329 InterleaveAndConvert<int16, Dest>(channel_data, frames_to_copy, 330 InterleaveAndConvert<int16, Dest>(channel_data, frames_to_copy,
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 case kSampleFormatPlanarS32: 398 case kSampleFormatPlanarS32:
398 // Planar data must be shifted per channel. 399 // Planar data must be shifted per channel.
399 for (int ch = 0; ch < channel_count_; ++ch) { 400 for (int ch = 0; ch < channel_count_; ++ch) {
400 memmove(channel_data_[ch] + (trim_start_ + start) * bytes_per_channel, 401 memmove(channel_data_[ch] + (trim_start_ + start) * bytes_per_channel,
401 channel_data_[ch] + (trim_start_ + end) * bytes_per_channel, 402 channel_data_[ch] + (trim_start_ + end) * bytes_per_channel,
402 bytes_per_channel * frames_to_copy); 403 bytes_per_channel * frames_to_copy);
403 } 404 }
404 break; 405 break;
405 case kSampleFormatU8: 406 case kSampleFormatU8:
406 case kSampleFormatS16: 407 case kSampleFormatS16:
408 case kSampleFormatS24:
407 case kSampleFormatS32: 409 case kSampleFormatS32:
408 case kSampleFormatF32: { 410 case kSampleFormatF32: {
409 // Interleaved data can be shifted all at once. 411 // Interleaved data can be shifted all at once.
410 const int frame_size = channel_count_ * bytes_per_channel; 412 const int frame_size = channel_count_ * bytes_per_channel;
411 memmove(channel_data_[0] + (trim_start_ + start) * frame_size, 413 memmove(channel_data_[0] + (trim_start_ + start) * frame_size,
412 channel_data_[0] + (trim_start_ + end) * frame_size, 414 channel_data_[0] + (trim_start_ + end) * frame_size,
413 frame_size * frames_to_copy); 415 frame_size * frames_to_copy);
414 break; 416 break;
415 } 417 }
416 case kUnknownSampleFormat: 418 case kUnknownSampleFormat:
417 NOTREACHED() << "Invalid sample format!"; 419 NOTREACHED() << "Invalid sample format!";
418 } 420 }
419 } else { 421 } else {
420 CHECK_EQ(frames_to_copy, 0); 422 CHECK_EQ(frames_to_copy, 0);
421 } 423 }
422 424
423 // Trim the leftover data off the end of the buffer and update duration. 425 // Trim the leftover data off the end of the buffer and update duration.
424 TrimEnd(frames_to_trim); 426 TrimEnd(frames_to_trim);
425 } 427 }
426 428
427 } // namespace media 429 } // namespace media
OLDNEW
« no previous file with comments | « chromecast/public/media/decoder_config.h ('k') | media/base/audio_buffer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698