OLD | NEW |
---|---|
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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 if (av_frame->sample_rate != sample_rate_ || | 182 if (av_frame->sample_rate != sample_rate_ || |
183 #ifdef CHROMIUM_NO_AVFRAME_CHANNELS | |
DaleCurtis
2013/04/17 22:14:23
Instead of doing this, just do one #ifdef above th
Paweł Hajdan Jr.
2013/04/18 17:27:10
Done.
| |
184 av_get_channel_layout_nb_channels( | |
185 av_frame->channel_layout) != channels_ || | |
186 #else | |
183 av_frame->channels != channels_ || | 187 av_frame->channels != channels_ || |
188 #endif | |
184 av_frame->format != av_sample_format_) { | 189 av_frame->format != av_sample_format_) { |
185 DLOG(ERROR) << "Unsupported midstream configuration change!" | 190 DLOG(ERROR) << "Unsupported midstream configuration change!" |
186 << " Sample Rate: " << av_frame->sample_rate << " vs " | 191 << " Sample Rate: " << av_frame->sample_rate << " vs " |
187 << sample_rate_ | 192 << sample_rate_ |
193 #ifdef CHROMIUM_NO_AVFRAME_CHANNELS | |
194 << ", Channels: " << av_get_channel_layout_nb_channels( | |
195 av_frame->channel_layout) << " vs " | |
196 #else | |
188 << ", Channels: " << av_frame->channels << " vs " | 197 << ", Channels: " << av_frame->channels << " vs " |
198 #endif | |
189 << channels_ | 199 << channels_ |
190 << ", Sample Format: " << av_frame->format << " vs " | 200 << ", Sample Format: " << av_frame->format << " vs " |
191 << av_sample_format_; | 201 << av_sample_format_; |
192 | 202 |
193 // This is an unrecoverable error, so bail out. | 203 // This is an unrecoverable error, so bail out. |
194 continue_decoding = false; | 204 continue_decoding = false; |
195 break; | 205 break; |
196 } | 206 } |
197 | 207 |
198 // Truncate, if necessary, if the destination isn't big enough. | 208 // Truncate, if necessary, if the destination isn't big enough. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
230 // Zero any remaining frames. | 240 // Zero any remaining frames. |
231 audio_bus->ZeroFramesPartial( | 241 audio_bus->ZeroFramesPartial( |
232 current_frame, audio_bus->frames() - current_frame); | 242 current_frame, audio_bus->frames() - current_frame); |
233 | 243 |
234 // Returns the actual number of sample-frames decoded. | 244 // Returns the actual number of sample-frames decoded. |
235 // Ideally this represents the "true" exact length of the file. | 245 // Ideally this represents the "true" exact length of the file. |
236 return current_frame; | 246 return current_frame; |
237 } | 247 } |
238 | 248 |
239 } // namespace media | 249 } // namespace media |
OLD | NEW |