[FFmpeg-devel] [PATCH 05/13] lavc/jpeg2000dec: Thread init_tile()

Tomas Härdin tjoppen at acc.umu.se
Wed Jun 15 16:11:34 EEST 2022


tis 2022-06-14 klockan 23:11 +0200 skrev Michael Niedermayer:
> On Tue, Jun 14, 2022 at 04:41:14PM +0200, Tomas Härdin wrote:
> > 
> 
> >  jpeg2000dec.c |   30 +++++++++++++++---------------
> >  1 file changed, 15 insertions(+), 15 deletions(-)
> > 6fa2fbf99afee36ee73459863df0527a72663f43  0005-lavc-jpeg2000dec-
> > Thread-init_tile.patch
> > From 080ebdc9bad130098bff575f9ce690b8a522c9f7 Mon Sep 17 00:00:00
> > 2001
> > From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= <git at haerdin.se>
> > Date: Mon, 13 Jun 2022 15:09:17 +0200
> > Subject: [PATCH 05/13] lavc/jpeg2000dec: Thread init_tile()
> 
> Causes segfaults
> 
> [jpeg2000 @ 0x2cf53380] End mismatch 149
> [jpeg2000 @ 0x2cf53380] ==1439== Thread 6:
> ==1439== Invalid read of size 4
> ==1439==    at 0x9771F0: jpeg2000_mct_write_frame (in ffmpeg_g)
> ==1439==    by 0x78BA6F: avcodec_default_execute2 (in ffmpeg_g)
> ==1439==    by 0x97C0BB: jpeg2000_decode_frame (in ffmpeg_g)
> ==1439==    by 0xA90F72: frame_worker_thread (in ffmpeg_g)
> ==1439==    by 0x54046DA: start_thread (pthread_create.c:463)
> ==1439==    by 0xF8F261E: clone (clone.S:95)
> 
> i will send you the sample privatly

This is because init_tile() fails. I had assumed errors were handled in
some way like longjmp since the function already called execute2() but
it seems the threading doesn't do any kind of magic for this.

Can we have execute2() return some kind of error code when one or more
jobs fail? Either say FFMIN() of all errors or negative jobnr that
failed? This would save on having to allocate an array for errors when
we don't really care which exact jobs failed..

/Tomas



More information about the ffmpeg-devel mailing list