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/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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 254 // Any time Reset() is called. | 254 // Any time Reset() is called. |
| 255 | 255 |
| 256 // Make sure we are notified if http://crbug.com/49709 returns. Issue also | 256 // Make sure we are notified if http://crbug.com/49709 returns. Issue also |
| 257 // occurs with some damaged files. | 257 // occurs with some damaged files. |
| 258 if (!buffer->end_of_stream() && buffer->timestamp() == kNoTimestamp()) { | 258 if (!buffer->end_of_stream() && buffer->timestamp() == kNoTimestamp()) { |
| 259 DVLOG(1) << "Received a buffer without timestamps!"; | 259 DVLOG(1) << "Received a buffer without timestamps!"; |
| 260 decode_cb.Run(kDecodeError, NULL); | 260 decode_cb.Run(kDecodeError, NULL); |
| 261 return; | 261 return; |
| 262 } | 262 } |
| 263 | 263 |
| 264 if (!buffer->end_of_stream() && !discard_helper_->initialized() && | |
|
acolwell GONE FROM CHROMIUM
2014/06/10 23:20:38
with your changes to the demuxer, can we DCHECK(bu
DaleCurtis
2014/06/11 16:59:07
Should be okay. I'll have to test though.
DaleCurtis
2014/06/12 00:21:55
I've added the DCHECK to the demuxer. However, it
| |
| 265 codec_context_->codec_id == AV_CODEC_ID_VORBIS && | |
| 266 buffer->timestamp() < base::TimeDelta()) { | |
| 267 // Dropping frames for negative timestamps as outlined in section A.2 | |
| 268 // in the Vorbis spec. http://xiph.org/vorbis/doc/Vorbis_I_spec.html | |
| 269 const int discard_frames = | |
| 270 discard_helper_->TimeDeltaToFrames(-buffer->timestamp()); | |
| 271 discard_helper_->Reset(discard_frames); | |
| 272 } | |
| 273 | |
| 274 // Transition to kFlushCodec on the first end of stream buffer. | 264 // Transition to kFlushCodec on the first end of stream buffer. |
| 275 if (state_ == kNormal && buffer->end_of_stream()) { | 265 if (state_ == kNormal && buffer->end_of_stream()) { |
| 276 state_ = kFlushCodec; | 266 state_ = kFlushCodec; |
| 277 } | 267 } |
| 278 | 268 |
| 279 if (!FFmpegDecode(buffer)) { | 269 if (!FFmpegDecode(buffer)) { |
| 280 state_ = kError; | 270 state_ = kError; |
| 281 decode_cb.Run(kDecodeError, NULL); | 271 decode_cb.Run(kDecodeError, NULL); |
| 282 return; | 272 return; |
| 283 } | 273 } |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 453 | 443 |
| 454 ResetTimestampState(); | 444 ResetTimestampState(); |
| 455 return true; | 445 return true; |
| 456 } | 446 } |
| 457 | 447 |
| 458 void FFmpegAudioDecoder::ResetTimestampState() { | 448 void FFmpegAudioDecoder::ResetTimestampState() { |
| 459 discard_helper_->Reset(config_.codec_delay()); | 449 discard_helper_->Reset(config_.codec_delay()); |
| 460 } | 450 } |
| 461 | 451 |
| 462 } // namespace media | 452 } // namespace media |
| OLD | NEW |