summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUoti Urpala <uau@mplayer2.org>2012-02-03 20:09:48 +0200
committerUoti Urpala <uau@mplayer2.org>2012-02-03 20:15:16 +0200
commitda52c9400defebc3f5840acc1f9eb0ead1a759cb (patch)
treea17088c843b032d917065ce72852dca75a390aa7
parentb317b928196e984d53440da0cda8e3d3d9f9430c (diff)
downloadmpv-da52c9400defebc3f5840acc1f9eb0ead1a759cb.tar.bz2
mpv-da52c9400defebc3f5840acc1f9eb0ead1a759cb.tar.xz
vd_ffmpeg: fix flushing of buffered frames
The vd_ffmpeg decode() function returned without doing anything if the input packet had size 0. This meant that flushing buffered frames at EOF did not work. Remove this test. Have the core code skip such packets coming from the file being played instead (Libav treats 0-sized packets as flush signals anyway, so better assume such packets do not represent real frames with any codec).
-rw-r--r--libmpcodecs/vd_ffmpeg.c3
-rw-r--r--mplayer.c14
2 files changed, 12 insertions, 5 deletions
diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c
index 05bc318267..5a45fef6d8 100644
--- a/libmpcodecs/vd_ffmpeg.c
+++ b/libmpcodecs/vd_ffmpeg.c
@@ -610,9 +610,6 @@ static struct mp_image *decode(struct sh_video *sh, struct demux_packet *packet,
int dr1 = ctx->do_dr1;
AVPacket pkt;
- if (len <= 0)
- return NULL; // skipped frame
-
if (!dr1)
avctx->draw_horiz_band = NULL;
diff --git a/mplayer.c b/mplayer.c
index f20c167706..3452b5df0f 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -2804,7 +2804,9 @@ static double update_video_nocorrect_pts(struct MPContext *mpctx)
frame_time = sh_video->next_frame_time;
if (mpctx->restart_playback)
frame_time = 0;
- int in_size = video_read_frame(sh_video, &sh_video->next_frame_time,
+ int in_size = 0;
+ while (!in_size)
+ in_size = video_read_frame(sh_video, &sh_video->next_frame_time,
&packet, force_fps);
if (in_size < 0) {
#ifdef CONFIG_DVDNAV
@@ -2903,7 +2905,15 @@ static double update_video(struct MPContext *mpctx)
int in_size = 0;
unsigned char *buf = NULL;
pts = MP_NOPTS_VALUE;
- struct demux_packet *pkt = ds_get_packet2(mpctx->d_video, false);
+ struct demux_packet *pkt;
+ while (1) {
+ pkt = ds_get_packet2(mpctx->d_video, false);
+ if (!pkt || pkt->len)
+ break;
+ /* Packets with size 0 are assumed to not correspond to frames,
+ * but to indicate the absence of a frame in formats like AVI
+ * that must have packets at fixed timecode intervals. */
+ }
if (pkt) {
in_size = pkt->len;
buf = pkt->buffer;