1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-29 10:32:15 +00:00

vo: fix some nonsense

Commit d38bc531 is incorrect: the 50ms queue-ahead value and the flip
queue offset have different functions. The latter is about calling
flip_page in advance, so the change attempted to show video frames 50ms
in advance on all VOs.

The change was for vo_opengl_cb, but that can be handled differently.
This commit is contained in:
wm4 2014-12-10 17:00:18 +01:00
parent c6dc0c6d99
commit 56eb2b71b8
4 changed files with 8 additions and 11 deletions

View File

@ -230,7 +230,6 @@ static struct vo *vo_create(struct mpv_global *global,
talloc_steal(vo, log);
*vo->in = (struct vo_internal) {
.dispatch = mp_dispatch_create(vo),
.flip_queue_offset = VO_DEFAULT_FLIP_QUEUE_OFFSET,
};
mp_make_wakeup_pipe(vo->in->wakeup_pipe);
mp_dispatch_set_wakeup_fn(vo->in->dispatch, dispatch_wakeup_cb, vo);
@ -484,8 +483,8 @@ bool vo_is_ready_for_frame(struct vo *vo, int64_t next_pts)
if (r) {
// Don't show the frame too early - it would basically freeze the
// display by disallowing OSD redrawing or VO interaction.
// Actually render the frame at earliest 50ms before target time
// (flip_queue_offset is usually VO_DEFAULT_FLIP_QUEUE_OFFSET, 50ms).
// Actually render the frame at earliest 50ms before target time.
next_pts -= (uint64_t)(0.050 * 1e6);
next_pts -= in->flip_queue_offset;
int64_t now = mp_time_us();
if (next_pts > now)

View File

@ -160,8 +160,6 @@ struct voctrl_screenshot_args {
// VO does framedrop itself (vo_vdpau). Untimed/encoding VOs never drop.
#define VO_CAP_FRAMEDROP 2
#define VO_DEFAULT_FLIP_QUEUE_OFFSET ((uint64_t)(0.050 * 1e6))
struct vo;
struct osd_state;
struct mp_image;

View File

@ -53,6 +53,7 @@ struct mpv_opengl_cb_context {
// --- Protected by lock
mpv_opengl_cb_update_fn update_cb;
void *update_cb_ctx;
struct mp_image *waiting_frame;
struct mp_image *next_frame;
struct mp_image_params img_params;
bool reconfigured;
@ -228,7 +229,7 @@ static void draw_image(struct vo *vo, mp_image_t *mpi)
struct vo_priv *p = vo->priv;
if (p->ctx) {
pthread_mutex_lock(&p->ctx->lock);
mp_image_setrefp(&p->ctx->next_frame, mpi);
mp_image_setrefp(&p->ctx->waiting_frame, mpi);
pthread_mutex_unlock(&p->ctx->lock);
}
talloc_free(mpi);
@ -239,6 +240,9 @@ static void flip_page(struct vo *vo)
struct vo_priv *p = vo->priv;
if (p->ctx) {
pthread_mutex_lock(&p->ctx->lock);
mp_image_unrefp(&p->ctx->next_frame);
p->ctx->next_frame = p->ctx->waiting_frame;
p->ctx->waiting_frame = NULL;
if (p->ctx->update_cb)
p->ctx->update_cb(p->ctx->update_cb_ctx);
pthread_mutex_unlock(&p->ctx->lock);
@ -331,6 +335,7 @@ static void uninit(struct vo *vo)
if (p->ctx) {
pthread_mutex_lock(&p->ctx->lock);
mp_image_unrefp(&p->ctx->next_frame);
mp_image_unrefp(&p->ctx->waiting_frame);
p->ctx->img_params = (struct mp_image_params){0};
p->ctx->reconfigured = true;
p->ctx->active = NULL;
@ -342,9 +347,6 @@ static int preinit(struct vo *vo)
{
struct vo_priv *p = vo->priv;
p->vo = vo;
// Currently, there's no video timing in the API, and it's questionable
// how API users would make use of it too.
vo_set_flip_queue_offset(vo, 0);
return 0;
}

View File

@ -261,8 +261,6 @@ static void resize(struct vo *vo)
vc->flip_offset_us = vo->opts->fullscreen ?
1000LL * vc->flip_offset_fs :
1000LL * vc->flip_offset_window;
vc->flip_offset_us += VO_DEFAULT_FLIP_QUEUE_OFFSET;
vo_set_flip_queue_offset(vo, vc->flip_offset_us);
if (vc->output_surface_width < vo->dwidth