summaryrefslogtreecommitdiffstats
path: root/video/filter/vf_lavfi.c
diff options
context:
space:
mode:
Diffstat (limited to 'video/filter/vf_lavfi.c')
-rw-r--r--video/filter/vf_lavfi.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/video/filter/vf_lavfi.c b/video/filter/vf_lavfi.c
index 066afa28dd..c6f0783460 100644
--- a/video/filter/vf_lavfi.c
+++ b/video/filter/vf_lavfi.c
@@ -273,6 +273,8 @@ static AVFrame *mp_to_av(struct vf_instance *vf, struct mp_image *img)
uint64_t pts = img->pts == MP_NOPTS_VALUE ?
AV_NOPTS_VALUE : img->pts * av_q2d(av_inv_q(p->timebase_in));
AVFrame *frame = mp_image_to_av_frame_and_unref(img);
+ if (!frame)
+ return NULL; // OOM is (coincidentally) handled as EOF
frame->pts = pts;
frame->sample_aspect_ratio = p->par_in;
return frame;
@@ -282,6 +284,8 @@ static struct mp_image *av_to_mp(struct vf_instance *vf, AVFrame *av_frame)
{
struct vf_priv_s *p = vf->priv;
struct mp_image *img = mp_image_from_av_frame(av_frame);
+ if (!img)
+ return NULL; // OOM
img->pts = av_frame->pts == AV_NOPTS_VALUE ?
MP_NOPTS_VALUE : av_frame->pts * av_q2d(p->timebase_out);
av_frame_free(&av_frame);