From 0c5696d523a43a5161134c354d6bfb21bb29bae6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reinhard=20Ni=C3=9Fl?= Date: Mon, 1 Oct 2007 23:24:58 +0200 Subject: Set PTS even for bad frames to improve syncing of audio and video. When a stream doesn't start with an IDR frame, there will be several seconds of bad frames and not setting PTS on those frames causes an unnecessary delay in syncing audio and video. --- src/libffmpeg/ff_video_decoder.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libffmpeg/ff_video_decoder.c b/src/libffmpeg/ff_video_decoder.c index ccce9c578..077ff2fad 100644 --- a/src/libffmpeg/ff_video_decoder.c +++ b/src/libffmpeg/ff_video_decoder.c @@ -1301,7 +1301,10 @@ static void ff_handle_buffer (ff_video_decoder_t *this, buf_element_t *buf) { this->aspect_ratio, this->output_format, VO_BOTH_FIELDS|this->frame_flags); - img->pts = 0; + /* set PTS to allow early syncing */ + img->pts = this->pts; + this->pts = 0; + img->duration = this->video_step; img->bad_frame = 1; this->skipframes = img->draw(img, this->stream); -- cgit v1.2.3