[vlc-devel] [PATCH] video_output: adapt the late threshold to the frame rate if there's one
Steve Lhomme
robux4 at gmail.com
Wed Sep 13 17:44:12 CEST 2017
On Mon, Sep 11, 2017 at 6:22 PM, Steve Lhomme <robux4 at videolabs.io> wrote:
> ---
> src/video_output/video_output.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
> index c432c70aa0..dbc70f6bbe 100644
> --- a/src/video_output/video_output.c
> +++ b/src/video_output/video_output.c
> @@ -852,9 +852,14 @@ static int ThreadDisplayPreparePicture(vout_thread_t *vout, bool reuse, bool fra
> decoded = picture_fifo_Pop(vout->p->decoder_fifo);
> if (decoded) {
> if (is_late_dropped && !decoded->b_force) {
> + mtime_t late_threshold;
> + if (decoded->format.i_frame_rate && decoded->format.i_frame_rate_base)
> + late_threshold = (CLOCK_FREQ * decoded->format.i_frame_rate_base) / decoded->format.i_frame_rate;
Actually, the hardcoded value corresponds to 20ms, so a half frame
duration. So we should do the same with the frame rate (and it does
work better).
> + else
> + late_threshold = VOUT_DISPLAY_LATE_THRESHOLD;
> const mtime_t predicted = mdate() + 0; /* TODO improve */
> const mtime_t late = predicted - decoded->date;
> - if (late > VOUT_DISPLAY_LATE_THRESHOLD) {
> + if (late > late_threshold) {
> msg_Warn(vout, "picture is too late to be displayed (missing %"PRId64" ms)", late/1000);
> picture_Release(decoded);
> vout_statistic_AddLost(&vout->p->statistic, 1);
> --
> 2.12.1
>
More information about the vlc-devel
mailing list