Commit 44db86c9 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

vdpau/chroma: keep history even if output picture allocation fails

parent e6db986f
...@@ -358,6 +358,9 @@ static picture_t *VideoImport(filter_t *filter, picture_t *src) ...@@ -358,6 +358,9 @@ static picture_t *VideoImport(filter_t *filter, picture_t *src)
VdpVideoSurface surface; VdpVideoSurface surface;
VdpStatus err; VdpStatus err;
if (sys->vdp == NULL)
goto drop;
/* Create surface (TODO: reuse?) */ /* Create surface (TODO: reuse?) */
err = vdp_video_surface_create(sys->vdp, sys->device, sys->chroma, err = vdp_video_surface_create(sys->vdp, sys->device, sys->chroma,
filter->fmt_in.video.i_width, filter->fmt_in.video.i_width,
...@@ -366,8 +369,7 @@ static picture_t *VideoImport(filter_t *filter, picture_t *src) ...@@ -366,8 +369,7 @@ static picture_t *VideoImport(filter_t *filter, picture_t *src)
{ {
msg_Err(filter, "video %s %s failure: %s", "surface", "creation", msg_Err(filter, "video %s %s failure: %s", "surface", "creation",
vdp_get_error_string(sys->vdp, err)); vdp_get_error_string(sys->vdp, err));
picture_Release(src); goto drop;
return NULL;
} }
/* Put bits */ /* Put bits */
...@@ -414,6 +416,7 @@ static picture_t *VideoImport(filter_t *filter, picture_t *src) ...@@ -414,6 +416,7 @@ static picture_t *VideoImport(filter_t *filter, picture_t *src)
return dst; return dst;
error: error:
vdp_video_surface_destroy(sys->vdp, surface); vdp_video_surface_destroy(sys->vdp, surface);
drop:
picture_Release(src); picture_Release(src);
return NULL; return NULL;
} }
...@@ -468,12 +471,6 @@ static picture_t *MixerRender(filter_t *filter, picture_t *src) ...@@ -468,12 +471,6 @@ static picture_t *MixerRender(filter_t *filter, picture_t *src)
VdpStatus err; VdpStatus err;
picture_t *dst = OutputAllocate(filter); picture_t *dst = OutputAllocate(filter);
if (dst == NULL)
{
picture_Release(src);
Flush(filter);
return NULL;
}
src = sys->import(filter, src); src = sys->import(filter, src);
/* Update history and take "present" picture field */ /* Update history and take "present" picture field */
...@@ -488,9 +485,17 @@ static picture_t *MixerRender(filter_t *filter, picture_t *src) ...@@ -488,9 +485,17 @@ static picture_t *MixerRender(filter_t *filter, picture_t *src)
else else
sys->history[MAX_PAST + MAX_FUTURE].field = NULL; sys->history[MAX_PAST + MAX_FUTURE].field = NULL;
if (dst == NULL)
goto skip;
vlc_vdp_video_field_t *f = sys->history[MAX_PAST].field; vlc_vdp_video_field_t *f = sys->history[MAX_PAST].field;
if (f == NULL) if (f == NULL)
{
picture_Release(dst);
dst = NULL;
goto skip; goto skip;
}
dst->date = sys->history[MAX_PAST].date; dst->date = sys->history[MAX_PAST].date;
dst->b_force = sys->history[MAX_PAST].force; dst->b_force = sys->history[MAX_PAST].force;
...@@ -571,11 +576,11 @@ static picture_t *MixerRender(filter_t *filter, picture_t *src) ...@@ -571,11 +576,11 @@ static picture_t *MixerRender(filter_t *filter, picture_t *src)
{ {
msg_Err(filter, "video %s %s failure: %s", "mixer", "rendering", msg_Err(filter, "video %s %s failure: %s", "mixer", "rendering",
vdp_get_error_string(sys->vdp, err)); vdp_get_error_string(sys->vdp, err));
skip:
picture_Release(dst); picture_Release(dst);
dst = NULL; dst = NULL;
} }
skip:
f = sys->history[0].field; f = sys->history[0].field;
if (f != NULL) if (f != NULL)
f->destroy(f); /* Release oldest field */ f->destroy(f); /* Release oldest field */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment