Chromium Code Reviews| 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 av_frame->channels != channels_ || | 183 av_frame_get_channels(av_frame.get()) != channels_ || |
|
DaleCurtis
2013/04/15 23:12:53
Why? When use_system_ffmpeg is used the headers us
Paweł Hajdan Jr.
2013/04/15 23:51:49
libav's AVFrame doesn't have channels member.
DaleCurtis
2013/04/16 20:46:56
It doesn't appear to have an av_frame_get_channels
Paweł Hajdan Jr.
2013/04/16 20:59:36
Correct. I'm adding code that probes for presence
DaleCurtis
2013/04/16 21:25:56
Ugh, that's super gross. I didn't realize that's
Paweł Hajdan Jr.
2013/04/16 21:50:35
Note this is just for use_system_ffmpeg=1 case.
DaleCurtis
2013/04/17 21:17:09
I realize it's just for use_system and is a one of
Paweł Hajdan Jr.
2013/04/17 22:07:34
Done.
| |
| 184 av_frame->format != av_sample_format_) { | 184 av_frame->format != av_sample_format_) { |
| 185 DLOG(ERROR) << "Unsupported midstream configuration change!" | 185 DLOG(ERROR) << "Unsupported midstream configuration change!" |
| 186 << " Sample Rate: " << av_frame->sample_rate << " vs " | 186 << " Sample Rate: " << av_frame->sample_rate << " vs " |
| 187 << sample_rate_ | 187 << sample_rate_ |
| 188 << ", Channels: " << av_frame->channels << " vs " | 188 << ", Channels: " << av_frame_get_channels(av_frame.get()) < < " vs " |
| 189 << channels_ | 189 << channels_ |
| 190 << ", Sample Format: " << av_frame->format << " vs " | 190 << ", Sample Format: " << av_frame->format << " vs " |
| 191 << av_sample_format_; | 191 << av_sample_format_; |
| 192 | 192 |
| 193 // This is an unrecoverable error, so bail out. | 193 // This is an unrecoverable error, so bail out. |
| 194 continue_decoding = false; | 194 continue_decoding = false; |
| 195 break; | 195 break; |
| 196 } | 196 } |
| 197 | 197 |
| 198 // Truncate, if necessary, if the destination isn't big enough. | 198 // 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. | 230 // Zero any remaining frames. |
| 231 audio_bus->ZeroFramesPartial( | 231 audio_bus->ZeroFramesPartial( |
| 232 current_frame, audio_bus->frames() - current_frame); | 232 current_frame, audio_bus->frames() - current_frame); |
| 233 | 233 |
| 234 // Returns the actual number of sample-frames decoded. | 234 // Returns the actual number of sample-frames decoded. |
| 235 // Ideally this represents the "true" exact length of the file. | 235 // Ideally this represents the "true" exact length of the file. |
| 236 return current_frame; | 236 return current_frame; |
| 237 } | 237 } |
| 238 | 238 |
| 239 } // namespace media | 239 } // namespace media |
| OLD | NEW |