From 1dffdea0f4cd917a32c2a57109cd53bd916aa7d2 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 14 Jul 2013 21:54:51 +0100 Subject: [PATCH] Fix piece video_position, player _video_position and FFmpegDecoder _video_position on seek. --- src/lib/ffmpeg_decoder.cc | 3 ++- src/lib/player.cc | 11 +++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index 637e2b187..18834c90e 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -313,7 +313,8 @@ FFmpegDecoder::seek (VideoContent::Frame frame, bool accurate) } _just_sought = true; - + _video_position = frame; + if (frame == 0 || !accurate) { /* We're already there, or we're as close as we need to be */ return; diff --git a/src/lib/player.cc b/src/lib/player.cc index 8532b5417..c8c206424 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -45,7 +45,7 @@ using boost::shared_ptr; using boost::weak_ptr; using boost::dynamic_pointer_cast; -//#define DEBUG_PLAYER 1 +#define DEBUG_PLAYER 1 class Piece { @@ -168,7 +168,7 @@ Player::pass () case VIDEO: if (earliest_t > _video_position) { #ifdef DEBUG_PLAYER - cout << "no video here; emitting black frame.\n"; + cout << "no video here; emitting black frame (earliest=" << earliest_t << ", video_position=" << _video_position << ").\n"; #endif emit_black (); } else { @@ -308,10 +308,6 @@ Player::process_audio (weak_ptr weak_piece, shared_ptr _audio_buffers.frames()) { - cout << "N=" << N << ", ab=" << _audio_buffers.frames() << "\n"; - } assert (N <= _audio_buffers.frames()); shared_ptr emit (new AudioBuffers (_audio_buffers.channels(), N)); emit->copy_from (&_audio_buffers, N, 0, 0); @@ -375,11 +371,14 @@ Player::seek (Time t, bool accurate) s = max (static_cast