diff options
author | wm4 <wm4@nowhere> | 2017-02-27 14:19:41 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2017-02-27 14:19:41 +0100 |
commit | 9714e04e94b66822a7309961b2141ce0032a1121 (patch) | |
tree | cbf8a8b5083d07869a1a2be980a5fe84b5841340 /video | |
parent | e9cda168c0fc4fa58175c23a2c04af11c2649f1e (diff) | |
download | mpv-9714e04e94b66822a7309961b2141ce0032a1121.tar.bz2 mpv-9714e04e94b66822a7309961b2141ce0032a1121.tar.xz |
vf_vavpp: always limit forward/backward surfaces to requested number
Don't give the driver more forward/backward refernces than it requested
in num_forward_references/num_backward_references. This shouldn't
matter, I'm just trying to play it safe.
Diffstat (limited to 'video')
-rw-r--r-- | video/filter/vf_vavpp.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/video/filter/vf_vavpp.c b/video/filter/vf_vavpp.c index 92ebf10275..e6dfaa3c6a 100644 --- a/video/filter/vf_vavpp.c +++ b/video/filter/vf_vavpp.c @@ -39,6 +39,7 @@ static bool check_error(struct vf_instance *vf, VAStatus status, const char *msg struct surface_refs { VASurfaceID *surfaces; int num_surfaces; + int max_surfaces; }; struct pipeline { @@ -77,13 +78,14 @@ static const struct vf_priv_s vf_priv_default = { static void add_surfaces(struct vf_priv_s *p, struct surface_refs *refs, int dir) { - for (int n = 0; ; n++) { + for (int n = 0; n < refs->max_surfaces; n++) { struct mp_image *s = mp_refqueue_get(p->queue, (1 + n) * dir); if (!s) break; VASurfaceID id = va_surface_id(s); - if (id != VA_INVALID_ID) - MP_TARRAY_APPEND(p, refs->surfaces, refs->num_surfaces, id); + if (id == VA_INVALID_ID) + break; + MP_TARRAY_APPEND(p, refs->surfaces, refs->num_surfaces, id); } } @@ -132,6 +134,8 @@ static void update_pipeline(struct vf_instance *vf) p->pipe.num_filters = num_filters; p->pipe.num_input_colors = caps.num_input_color_standards; p->pipe.num_output_colors = caps.num_output_color_standards; + p->pipe.forward.max_surfaces = caps.num_forward_references; + p->pipe.backward.max_surfaces = caps.num_backward_references; mp_refqueue_set_refs(p->queue, caps.num_backward_references, caps.num_forward_references); mp_refqueue_set_mode(p->queue, |