vo: further reduce redundant wakeups

In display-sync mode, the core doesn't need to woken up every vsync, but
only every time a new actual video frame needs to be queued. So don't
wake up if there are still frames to repeat.

In audio-sync mode, the wakeup is simply redundant, since there's a
separate timer (in->wakeup_pts) to control when to queue a new frame. I
think.

This finally brings the required playloop iterations down to almost the
number of video frames. (As originally intended, really.)

Also a fairly risky change.
This commit is contained in:
wm4 2020-04-10 01:45:45 +02:00
parent 0c9ac5835b
commit 6a13954d67
1 changed files with 7 additions and 1 deletions

View File

@ -938,8 +938,14 @@ static bool render_frame(struct vo *vo)
in->rendering = true; in->rendering = true;
in->hasframe_rendered = true; in->hasframe_rendered = true;
int64_t prev_drop_count = vo->in->drop_count; int64_t prev_drop_count = vo->in->drop_count;
// Can the core queue new video now? Non-display-sync uses a separate
// timer instead.
bool can_queue =
!in->frame_queued && in->current_frame->num_vsyncs < 1 && use_vsync;
pthread_mutex_unlock(&in->lock); pthread_mutex_unlock(&in->lock);
wakeup_core(vo); // core can queue new video now
if (can_queue)
wakeup_core(vo);
stats_time_start(in->stats, "video-draw"); stats_time_start(in->stats, "video-draw");