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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 task_runner_->PostTask(FROM_HERE, closure); | 195 task_runner_->PostTask(FROM_HERE, closure); |
196 } | 196 } |
197 | 197 |
198 void FFmpegAudioDecoder::DecodeBuffer( | 198 void FFmpegAudioDecoder::DecodeBuffer( |
199 const scoped_refptr<DecoderBuffer>& buffer, | 199 const scoped_refptr<DecoderBuffer>& buffer, |
200 const DecodeCB& decode_cb) { | 200 const DecodeCB& decode_cb) { |
201 DCHECK(task_runner_->BelongsToCurrentThread()); | 201 DCHECK(task_runner_->BelongsToCurrentThread()); |
202 DCHECK_NE(state_, kUninitialized); | 202 DCHECK_NE(state_, kUninitialized); |
203 DCHECK_NE(state_, kDecodeFinished); | 203 DCHECK_NE(state_, kDecodeFinished); |
204 DCHECK_NE(state_, kError); | 204 DCHECK_NE(state_, kError); |
205 DCHECK(buffer); | 205 DCHECK(buffer.get()); |
206 | 206 |
207 // Make sure we are notified if http://crbug.com/49709 returns. Issue also | 207 // Make sure we are notified if http://crbug.com/49709 returns. Issue also |
208 // occurs with some damaged files. | 208 // occurs with some damaged files. |
209 if (!buffer->end_of_stream() && buffer->timestamp() == kNoTimestamp()) { | 209 if (!buffer->end_of_stream() && buffer->timestamp() == kNoTimestamp()) { |
210 DVLOG(1) << "Received a buffer without timestamps!"; | 210 DVLOG(1) << "Received a buffer without timestamps!"; |
211 decode_cb.Run(kDecodeError); | 211 decode_cb.Run(kDecodeError); |
212 return; | 212 return; |
213 } | 213 } |
214 | 214 |
215 bool has_produced_frame; | 215 bool has_produced_frame; |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 | 384 |
385 ResetTimestampState(); | 385 ResetTimestampState(); |
386 return true; | 386 return true; |
387 } | 387 } |
388 | 388 |
389 void FFmpegAudioDecoder::ResetTimestampState() { | 389 void FFmpegAudioDecoder::ResetTimestampState() { |
390 discard_helper_->Reset(config_.codec_delay()); | 390 discard_helper_->Reset(config_.codec_delay()); |
391 } | 391 } |
392 | 392 |
393 } // namespace media | 393 } // namespace media |
OLD | NEW |