| 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/ffmpeg_audio_decoder.h" | 5 #include "media/filters/ffmpeg_audio_decoder.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 state_ = kUninitialized; | 339 state_ = kUninitialized; |
| 340 return false; | 340 return false; |
| 341 } | 341 } |
| 342 | 342 |
| 343 // Success! | 343 // Success! |
| 344 av_frame_.reset(av_frame_alloc()); | 344 av_frame_.reset(av_frame_alloc()); |
| 345 av_sample_format_ = codec_context_->sample_fmt; | 345 av_sample_format_ = codec_context_->sample_fmt; |
| 346 | 346 |
| 347 if (codec_context_->channels != | 347 if (codec_context_->channels != |
| 348 ChannelLayoutToChannelCount(config_.channel_layout())) { | 348 ChannelLayoutToChannelCount(config_.channel_layout())) { |
| 349 DLOG(ERROR) << "Audio configuration specified " | 349 MEDIA_LOG(ERROR, media_log_) |
| 350 << ChannelLayoutToChannelCount(config_.channel_layout()) | 350 << "Audio configuration specified " |
| 351 << " channels, but FFmpeg thinks the file contains " | 351 << ChannelLayoutToChannelCount(config_.channel_layout()) |
| 352 << codec_context_->channels << " channels"; | 352 << " channels, but FFmpeg thinks the file contains " |
| 353 << codec_context_->channels << " channels"; |
| 353 ReleaseFFmpegResources(); | 354 ReleaseFFmpegResources(); |
| 354 state_ = kUninitialized; | 355 state_ = kUninitialized; |
| 355 return false; | 356 return false; |
| 356 } | 357 } |
| 357 | 358 |
| 358 ResetTimestampState(); | 359 ResetTimestampState(); |
| 359 return true; | 360 return true; |
| 360 } | 361 } |
| 361 | 362 |
| 362 void FFmpegAudioDecoder::ResetTimestampState() { | 363 void FFmpegAudioDecoder::ResetTimestampState() { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 // Now create an AVBufferRef for the data just allocated. It will own the | 451 // Now create an AVBufferRef for the data just allocated. It will own the |
| 451 // reference to the AudioBuffer object. | 452 // reference to the AudioBuffer object. |
| 452 AudioBuffer* opaque = buffer.get(); | 453 AudioBuffer* opaque = buffer.get(); |
| 453 opaque->AddRef(); | 454 opaque->AddRef(); |
| 454 frame->buf[0] = av_buffer_create(frame->data[0], buffer_size_in_bytes, | 455 frame->buf[0] = av_buffer_create(frame->data[0], buffer_size_in_bytes, |
| 455 ReleaseAudioBufferImpl, opaque, 0); | 456 ReleaseAudioBufferImpl, opaque, 0); |
| 456 return 0; | 457 return 0; |
| 457 } | 458 } |
| 458 | 459 |
| 459 } // namespace media | 460 } // namespace media |
| OLD | NEW |