Fix erroneous video position after seek.
authorCarl Hetherington <cth@carlh.net>
Thu, 5 Jun 2014 13:00:14 +0000 (14:00 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 5 Jun 2014 13:00:14 +0000 (14:00 +0100)
src/lib/ffmpeg_decoder.cc
test/play_test.cc

index 5fe34ce14fb3430749f522b93de4aa2971621ff3..04dd7fd2d27fb141c1f4e17f5df9bbc54a10f829 100644 (file)
@@ -386,6 +386,11 @@ FFmpegDecoder::seek (VideoContent::Frame frame, bool accurate)
                
                av_free_packet (&_packet);
        }
+
+       /* _video_position should be the next thing to be emitted, which will the one after the thing
+          we just saw.
+       */
+       _video_position++;
 }
 
 void
index 1ba2e7d88338179e0f698d7aafae2304a34c4e27..92d1a8dce82767d91a16043b8716048fd7b1fb4a 100644 (file)
@@ -120,7 +120,7 @@ BOOST_AUTO_TEST_CASE (play_test)
                }
        }
 
-       player->seek (10 * TIME_HZ / 25, true);
+       wrap.seek (10 * TIME_HZ / 25, true);
        optional<Video> v = wrap.get_video ();
        BOOST_CHECK (v);
        BOOST_CHECK_EQUAL (v.get().time, 10 * TIME_HZ / 25);