| 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 "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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 int frame_decoded = 0; | 320 int frame_decoded = 0; |
| 321 const int result = avcodec_decode_audio4( | 321 const int result = avcodec_decode_audio4( |
| 322 codec_context_.get(), av_frame_.get(), &frame_decoded, &packet); | 322 codec_context_.get(), av_frame_.get(), &frame_decoded, &packet); |
| 323 | 323 |
| 324 if (result < 0) { | 324 if (result < 0) { |
| 325 DCHECK(!buffer->end_of_stream()) | 325 DCHECK(!buffer->end_of_stream()) |
| 326 << "End of stream buffer produced an error! " | 326 << "End of stream buffer produced an error! " |
| 327 << "This is quite possibly a bug in the audio decoder not handling " | 327 << "This is quite possibly a bug in the audio decoder not handling " |
| 328 << "end of stream AVPackets correctly."; | 328 << "end of stream AVPackets correctly."; |
| 329 | 329 |
| 330 DLOG(WARNING) | 330 MEDIA_LOG(log_cb_) |
| 331 << "Failed to decode an audio frame with timestamp: " | 331 << "Dropping audio frame which failed decode with timestamp: " |
| 332 << buffer->timestamp().InMicroseconds() << " us, duration: " | 332 << buffer->timestamp().InMicroseconds() << " us, duration: " |
| 333 << buffer->duration().InMicroseconds() << " us, packet size: " | 333 << buffer->duration().InMicroseconds() << " us, packet size: " |
| 334 << buffer->data_size() << " bytes"; | 334 << buffer->data_size() << " bytes"; |
| 335 | 335 |
| 336 break; | 336 break; |
| 337 } | 337 } |
| 338 | 338 |
| 339 // Update packet size and data pointer in case we need to call the decoder | 339 // Update packet size and data pointer in case we need to call the decoder |
| 340 // with the remaining bytes from this packet. | 340 // with the remaining bytes from this packet. |
| 341 packet.size -= result; | 341 packet.size -= result; |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 | 454 |
| 455 ResetTimestampState(); | 455 ResetTimestampState(); |
| 456 return true; | 456 return true; |
| 457 } | 457 } |
| 458 | 458 |
| 459 void FFmpegAudioDecoder::ResetTimestampState() { | 459 void FFmpegAudioDecoder::ResetTimestampState() { |
| 460 discard_helper_->Reset(config_.codec_delay()); | 460 discard_helper_->Reset(config_.codec_delay()); |
| 461 } | 461 } |
| 462 | 462 |
| 463 } // namespace media | 463 } // namespace media |
| OLD | NEW |