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

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

Issue 13991013: Linux: make it possible to compile against libav when use_system_ffmpeg==1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: varz Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 (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/audio_file_reader.h" 5 #include "media/filters/audio_file_reader.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/time.h" 8 #include "base/time.h"
9 #include "media/base/audio_bus.h" 9 #include "media/base/audio_bus.h"
10 #include "media/ffmpeg/ffmpeg_common.h" 10 #include "media/ffmpeg/ffmpeg_common.h"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 if (!frame_decoded) 172 if (!frame_decoded)
173 continue; 173 continue;
174 174
175 // Determine the number of sample-frames we just decoded. Check overflow. 175 // Determine the number of sample-frames we just decoded. Check overflow.
176 int frames_read = av_frame->nb_samples; 176 int frames_read = av_frame->nb_samples;
177 if (frames_read < 0) { 177 if (frames_read < 0) {
178 continue_decoding = false; 178 continue_decoding = false;
179 break; 179 break;
180 } 180 }
181 181
182 #ifdef CHROMIUM_NO_AVFRAME_CHANNELS
183 int channels = av_get_channel_layout_nb_channels(
184 av_frame->channel_layout);
185 #else
186 int channels = av_frame->channels;
187 #endif
182 if (av_frame->sample_rate != sample_rate_ || 188 if (av_frame->sample_rate != sample_rate_ ||
183 av_frame->channels != channels_ || 189 channels != channels_ ||
184 av_frame->format != av_sample_format_) { 190 av_frame->format != av_sample_format_) {
185 DLOG(ERROR) << "Unsupported midstream configuration change!" 191 DLOG(ERROR) << "Unsupported midstream configuration change!"
186 << " Sample Rate: " << av_frame->sample_rate << " vs " 192 << " Sample Rate: " << av_frame->sample_rate << " vs "
187 << sample_rate_ 193 << sample_rate_
188 << ", Channels: " << av_frame->channels << " vs " 194 << ", Channels: " << channels << " vs "
189 << channels_ 195 << channels_
190 << ", Sample Format: " << av_frame->format << " vs " 196 << ", Sample Format: " << av_frame->format << " vs "
191 << av_sample_format_; 197 << av_sample_format_;
192 198
193 // This is an unrecoverable error, so bail out. 199 // This is an unrecoverable error, so bail out.
194 continue_decoding = false; 200 continue_decoding = false;
195 break; 201 break;
196 } 202 }
197 203
198 // Truncate, if necessary, if the destination isn't big enough. 204 // Truncate, if necessary, if the destination isn't big enough.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 // Zero any remaining frames. 236 // Zero any remaining frames.
231 audio_bus->ZeroFramesPartial( 237 audio_bus->ZeroFramesPartial(
232 current_frame, audio_bus->frames() - current_frame); 238 current_frame, audio_bus->frames() - current_frame);
233 239
234 // Returns the actual number of sample-frames decoded. 240 // Returns the actual number of sample-frames decoded.
235 // Ideally this represents the "true" exact length of the file. 241 // Ideally this represents the "true" exact length of the file.
236 return current_frame; 242 return current_frame;
237 } 243 }
238 244
239 } // namespace media 245 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/filters/ffmpeg_audio_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698