Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: media/filters/ffmpeg_audio_decoder.cc

Issue 325503003: Fix seeking when the start time is non-zero. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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() &&
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698