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

Side by Side Diff: media/filters/ffmpeg_audio_decoder.cc

Issue 212103013: Add channel_count parameter back to AudioBuffer creation methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mstr
Patch Set: fix unit test Created 6 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/filters/decrypting_audio_decoder_unittest.cc ('k') | media/filters/opus_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 (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/ffmpeg_audio_decoder.h" 5 #include "media/filters/ffmpeg_audio_decoder.h"
6 6
7 #include "base/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #include "base/single_thread_task_runner.h" 8 #include "base/single_thread_task_runner.h"
9 #include "media/base/audio_buffer.h" 9 #include "media/base/audio_buffer.h"
10 #include "media/base/audio_bus.h" 10 #include "media/base/audio_bus.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 format, 85 format,
86 AudioBuffer::kChannelAlignment); 86 AudioBuffer::kChannelAlignment);
87 // Check for errors from av_samples_get_buffer_size(). 87 // Check for errors from av_samples_get_buffer_size().
88 if (buffer_size_in_bytes < 0) 88 if (buffer_size_in_bytes < 0)
89 return buffer_size_in_bytes; 89 return buffer_size_in_bytes;
90 int frames_required = buffer_size_in_bytes / bytes_per_channel / channels; 90 int frames_required = buffer_size_in_bytes / bytes_per_channel / channels;
91 DCHECK_GE(frames_required, frame->nb_samples); 91 DCHECK_GE(frames_required, frame->nb_samples);
92 scoped_refptr<AudioBuffer> buffer = AudioBuffer::CreateBuffer( 92 scoped_refptr<AudioBuffer> buffer = AudioBuffer::CreateBuffer(
93 sample_format, 93 sample_format,
94 ChannelLayoutToChromeChannelLayout(s->channel_layout, s->channels), 94 ChannelLayoutToChromeChannelLayout(s->channel_layout, s->channels),
95 channels,
95 s->sample_rate, 96 s->sample_rate,
96 frames_required); 97 frames_required);
97 98
98 // Initialize the data[] and extended_data[] fields to point into the memory 99 // Initialize the data[] and extended_data[] fields to point into the memory
99 // allocated for AudioBuffer. |number_of_planes| will be 1 for interleaved 100 // allocated for AudioBuffer. |number_of_planes| will be 1 for interleaved
100 // audio and equal to |channels| for planar audio. 101 // audio and equal to |channels| for planar audio.
101 int number_of_planes = buffer->channel_data().size(); 102 int number_of_planes = buffer->channel_data().size();
102 if (number_of_planes <= AV_NUM_DATA_POINTERS) { 103 if (number_of_planes <= AV_NUM_DATA_POINTERS) {
103 DCHECK_EQ(frame->extended_data, frame->data); 104 DCHECK_EQ(frame->extended_data, frame->data);
104 for (int i = 0; i < number_of_planes; ++i) 105 for (int i = 0; i < number_of_planes; ++i)
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 return true; 500 return true;
500 } 501 }
501 502
502 void FFmpegAudioDecoder::ResetTimestampState() { 503 void FFmpegAudioDecoder::ResetTimestampState() {
503 output_timestamp_helper_->SetBaseTimestamp(kNoTimestamp()); 504 output_timestamp_helper_->SetBaseTimestamp(kNoTimestamp());
504 last_input_timestamp_ = kNoTimestamp(); 505 last_input_timestamp_ = kNoTimestamp();
505 output_frames_to_drop_ = 0; 506 output_frames_to_drop_ = 0;
506 } 507 }
507 508
508 } // namespace media 509 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/decrypting_audio_decoder_unittest.cc ('k') | media/filters/opus_audio_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698