From 7cf44fc4bb54e61f569c7ae969df04b1d4db6f8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reinhard=20Ni=C3=9Fl?= Date: Sun, 15 Apr 2007 22:21:51 +0200 Subject: Avoid immediate frame drops by giving decoder a further chance to supply decoded frames. There can still be scheduling delays which may let the number of frames ready for displaying to drop below frame drop limit just for a short period of time. Therefore the changes remember that the decoder should have been asked to drop some frames but do not actually have the decoder to drop some frames. When the situation has improved at the next time when the check is performed, the remembered frame drop is canceled or otherwise (when the number of frames is still below frame drop limit) executed. (transplanted from b016e80a8206a56ba3996021bacff88b8ba44621) --HG-- extra : transplant_source : %B0%16%E8%0A%82%06%A5k%A3%99%60%21%BA%CF%F8%8B%8B%A4F%21 --- src/xine-engine/video_out.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c index 81d7f3a3b..a8464ac40 100644 --- a/src/xine-engine/video_out.c +++ b/src/xine-engine/video_out.c @@ -130,6 +130,7 @@ typedef struct { int frame_drop_limit_max; int frame_drop_limit; int frame_drop_cpt; + int frame_drop_suggested; int crop_left, crop_right, crop_top, crop_bottom; } vos_t; @@ -497,6 +498,21 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) { frames_to_skip < 0) frames_to_skip = 0; + /* Do not drop frames immediately, but remember this as suggestion and give + * decoder a further chance to supply frames. + * This avoids unnecessary frame drops in situations where there is only + * a very little number of image buffers, e. g. when using xxmc. + */ + if (this->frame_drop_suggested && frames_to_skip == 0) + this->frame_drop_suggested = 0; + + if (frames_to_skip > 0) { + if (!this->frame_drop_suggested) { + this->frame_drop_suggested = 1; + frames_to_skip = 0; + } + } + lprintf ("delivery diff : %" PRId64 ", current vpts is %" PRId64 ", %d frames to skip\n", diff, cur_vpts, frames_to_skip); @@ -1829,6 +1845,7 @@ xine_video_port_t *_x_vo_new_port (xine_t *xine, vo_driver_t *driver, int grabon this->frame_drop_limit = this->frame_drop_limit_max; this->frame_drop_cpt = 0; + this->frame_drop_suggested = 0; this->extra_info_base = calloc (num_frame_buffers, sizeof(extra_info_t)); -- cgit v1.2.3