| 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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 const scoped_refptr<DecoderBuffer>& buffer, | 218 const scoped_refptr<DecoderBuffer>& buffer, |
| 219 const DecodeCB& decode_cb) { | 219 const DecodeCB& decode_cb) { |
| 220 DCHECK(task_runner_->BelongsToCurrentThread()); | 220 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 221 DCHECK_NE(state_, kUninitialized); | 221 DCHECK_NE(state_, kUninitialized); |
| 222 DCHECK_NE(state_, kDecodeFinished); | 222 DCHECK_NE(state_, kDecodeFinished); |
| 223 DCHECK_NE(state_, kError); | 223 DCHECK_NE(state_, kError); |
| 224 DCHECK(buffer.get()); | 224 DCHECK(buffer.get()); |
| 225 | 225 |
| 226 // Make sure we are notified if http://crbug.com/49709 returns. Issue also | 226 // Make sure we are notified if http://crbug.com/49709 returns. Issue also |
| 227 // occurs with some damaged files. | 227 // occurs with some damaged files. |
| 228 if (!buffer->end_of_stream() && buffer->timestamp() == kNoTimestamp()) { | 228 if (!buffer->end_of_stream() && buffer->timestamp() == kNoTimestamp) { |
| 229 DVLOG(1) << "Received a buffer without timestamps!"; | 229 DVLOG(1) << "Received a buffer without timestamps!"; |
| 230 decode_cb.Run(DecodeStatus::DECODE_ERROR); | 230 decode_cb.Run(DecodeStatus::DECODE_ERROR); |
| 231 return; | 231 return; |
| 232 } | 232 } |
| 233 | 233 |
| 234 bool has_produced_frame; | 234 bool has_produced_frame; |
| 235 do { | 235 do { |
| 236 has_produced_frame = false; | 236 has_produced_frame = false; |
| 237 if (!FFmpegDecode(buffer, &has_produced_frame)) { | 237 if (!FFmpegDecode(buffer, &has_produced_frame)) { |
| 238 state_ = kError; | 238 state_ = kError; |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 return true; | 431 return true; |
| 432 } | 432 } |
| 433 | 433 |
| 434 void FFmpegAudioDecoder::ResetTimestampState() { | 434 void FFmpegAudioDecoder::ResetTimestampState() { |
| 435 discard_helper_.reset(new AudioDiscardHelper(config_.samples_per_second(), | 435 discard_helper_.reset(new AudioDiscardHelper(config_.samples_per_second(), |
| 436 config_.codec_delay())); | 436 config_.codec_delay())); |
| 437 discard_helper_->Reset(config_.codec_delay()); | 437 discard_helper_->Reset(config_.codec_delay()); |
| 438 } | 438 } |
| 439 | 439 |
| 440 } // namespace media | 440 } // namespace media |
| OLD | NEW |