Skip to content

Burst of vlc_player_NextVideoFrame could hang

Failing test:

static void
go_eof(struct ctx *ctx, struct timer_state *timer,
         size_t *prev_status_idx, size_t *next_status_idx,
         struct vlc_player_timer_smpte_timecode *tc)
{
    (void) prev_status_idx;
    vlc_player_t *player = ctx->player;
    struct report_timer *r = NULL;
    unsigned fps = get_fps(ctx);

    increase_tc(tc, fps);
    vlc_tick_t current_pos = VLC_TICK_FROM_SEC(tc->seconds)
                           + tc->frames * vlc_tick_rate_duration(fps);
    vlc_tick_t end_pos = ctx->params.length;
    vlc_tick_t next_length = end_pos - current_pos;
    assert(next_length > 0);
    unsigned frame_next_count_total = next_length / vlc_tick_rate_duration(fps);
    unsigned burst = 100;

    /* Send prev-frame requests in burst until we reach start of file */
    while (frame_next_count_total > 0)
    {
        size_t frame_next_count = frame_next_count_total > burst ? burst
                          : frame_next_count_total;

        frame_next_count_total -= frame_next_count;

        /* Send burst */
        for (size_t i = 0; i < frame_next_count; ++i)
            vlc_player_NextVideoFrame(player);

        /* Wait for all prev-frame status */
        wait_next_frame_status(ctx, next_status_idx, frame_next_count, 0);

        /* Check that all video timecodes are increasing */
        player_lock_timer(player, timer);
        for (size_t i = 0; i < frame_next_count; ++i)
        {
            r = timer_state_wait_next_report(timer);
            assert(r->type == REPORT_TIMER_TC);
            assert(r->tc.seconds == tc->seconds);
            assert(r->tc.frames == tc->frames);

            increase_tc(tc, fps);
        }
        player_unlock_timer(player, timer);
    }

    vlc_player_NextVideoFrame(player);
    wait_next_frame_status(ctx, next_status_idx, burst, -EAGAIN);
}

Looks like #28145 (closed) is not 100% fixed. I was not able to reproduce the new issue via the GUI.

Edited by Thomas Guillem
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information