From: Steve Lhomme Date: Thu, 18 Jul 2024 07:27:00 +0000 (+0200) Subject: opencv: check the image conversion worked X-Git-Tag: archive/raspbian/3.0.21-6+rpi1^2~106 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=aa6b44db4e1983a4c3a88839518251cfb870a648;p=vlc.git opencv: check the image conversion worked Otherwise we release the output picture that would have been used and returned. (cherry picked from commit 19813291fcfb31ddd91a2e4d0f1d37ad3239d300) (rebased) rebased: - p_filter->p_sys is p_sys on 4.0 Signed-off-by: Steve Lhomme Gbp-Pq: Name 0019-opencv-check-the-image-conversion-worked.patch --- diff --git a/modules/video_filter/opencv_wrapper.c b/modules/video_filter/opencv_wrapper.c index 5da26a17..2d5966ba 100644 --- a/modules/video_filter/opencv_wrapper.c +++ b/modules/video_filter/opencv_wrapper.c @@ -444,9 +444,16 @@ static picture_t* Filter( filter_t* p_filter, picture_t* p_pic ) p_filter->p_sys->p_proc_image, &(p_filter->p_sys->p_proc_image->format), &fmt_out ); - - picture_CopyPixels( p_outpic, p_outpic_tmp ); - CopyInfoAndRelease( p_outpic, p_outpic_tmp ); + if (unlikely(!p_outpic_tmp)) + { + picture_Release(p_outpic); + p_outpic = NULL; + } + else + { + picture_CopyPixels( p_outpic, p_outpic_tmp ); + CopyInfoAndRelease( p_outpic, p_outpic_tmp ); + } } else if( p_filter->p_sys->i_internal_chroma == CINPUT ) { picture_CopyPixels( p_outpic, p_filter->p_sys->p_proc_image ); picture_CopyProperties( p_outpic, p_filter->p_sys->p_proc_image );