From: Michael Niedermayer <michael@niedermayer.cc>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH 1/3] error_resilience: set the decode_error_flags outside
Date: Tue, 12 Sep 2023 21:05:10 +0200
Message-ID: <20230912190510.GK8640@pb2> (raw)
In-Reply-To: <20230912114015.59937-1-thomas@gllm.fr>
[-- Attachment #1.1: Type: text/plain, Size: 2570 bytes --]
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
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
[-- Attachment #2: Type: text/plain, Size: 251 bytes --]
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
prev parent reply other threads:[~2023-09-12 19:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-12 11:40 Thomas Guillem via ffmpeg-devel
2023-09-12 11:40 ` [FFmpeg-devel] [PATCH 2/3] h264: fix data-race with FF_DECODE_ERROR_CONCEALMENT_ACTIVE Thomas Guillem via ffmpeg-devel
2023-09-12 11:40 ` [FFmpeg-devel] [PATCH 3/3] h264: fix data-race with FF_DECODE_ERROR_DECODE_SLICES Thomas Guillem via ffmpeg-devel
2023-09-12 13:11 ` Andreas Rheinhardt
2023-09-13 6:46 ` Thomas Guillem via ffmpeg-devel
2023-09-12 19:05 ` Michael Niedermayer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230912190510.GK8640@pb2 \
--to=michael@niedermayer.cc \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git