On Tue, Sep 12, 2023 at 01:40:13PM +0200, Thomas Guillem via ffmpeg-devel wrote: > This will allow to fix data-races when ff_er_frame_end() is called after > ff_thread_finish_setup() > --- > libavcodec/error_resilience.c | 12 ++++++------ > libavcodec/error_resilience.h | 2 +- > libavcodec/h263dec.c | 6 ++++-- > libavcodec/h264dec.c | 3 ++- > libavcodec/mpeg12dec.c | 3 ++- > libavcodec/mss2.c | 8 +++++--- > libavcodec/rv10.c | 10 ++++++++-- > libavcodec/rv34.c | 12 +++++++++--- > libavcodec/vc1dec.c | 6 ++++-- > 9 files changed, 41 insertions(+), 21 deletions(-) >
[...]
> diff --git a/libavcodec/error_resilience.h b/libavcodec/error_resilience.h
> index 47cc8a4fc6..a8cf73c72e 100644
> --- a/libavcodec/error_resilience.h
> +++ b/libavcodec/error_resilience.h
> @@ -90,7 +90,7 @@ typedef struct ERContext {
> } ERContext;
>
> void ff_er_frame_start(ERContext *s);
> -void ff_er_frame_end(ERContext *s);
> +int ff_er_frame_end(ERContext *s);
The return code needs to be documented
> void ff_er_add_slice(ERContext *s, int startx, int starty, int endx, int
> endy,
> int status);
>
> diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
> index 52e51dd489..3e83d90586 100644
> --- a/libavcodec/h263dec.c
> +++ b/libavcodec/h263dec.c
> @@ -621,8 +621,10 @@ retry:
>
> av_assert1(s->bitstream_buffer_size == 0);
> frame_end:
> - if (!s->studio_profile)
> - ff_er_frame_end(&s->er);
> + if (!s->studio_profile) {
> + if (ff_er_frame_end(&s->er) > 0)
> + s->current_picture.f->decode_error_flags |=
> FF_DECODE_ERROR_CONCEALMENT_ACTIVE;
> + }
[...]
> +static void rv10_er_frame_end(MpegEncContext *s)
> +{
> + if (ff_er_frame_end(&s->er) > 0)
> + s->current_picture_ptr->f->decode_error_flags |=
> FF_DECODE_ERROR_CONCEALMENT_ACTIVE;
> +}
[...]
> +static void rv34_er_frame_end(MpegEncContext *s)
> +{
> + if (ff_er_frame_end(&s->er) > 0)
> + s->current_picture_ptr->f->decode_error_flags |=
> FF_DECODE_ERROR_CONCEALMENT_ACTIVE;
> +}
[...]
> + if (ff_er_frame_end(&s->er) > 0)
> + s->current_picture.f->decode_error_flags |=
> FF_DECODE_ERROR_CONCEALMENT_ACTIVE;
> + }
> }
This looks like duplicated code
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The worst form of inequality is to try to make unequal things equal.
-- Aristotle
signature.asc
Description: PGP signature
_______________________________________________ ffmpeg-devel mailing list [email protected] https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email [email protected] with subject "unsubscribe".
