[FFmpeg-devel] [PATCH 1/2] avcodec/error_resilience: Use atomic set on writing error_occurred per slice

James Almer jamrial at gmail.com
Sun Nov 12 01:03:30 EET 2017


On 11/11/2017 7:49 PM, Rostislav Pehlivanov wrote:
> On 11 November 2017 at 22:31, James Almer <jamrial at gmail.com> wrote:
> 
>> On 11/11/2017 7:16 PM, Michael Niedermayer wrote:
>>> This is more correct if multiple slices are handled in parallel
>>>
>>> Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
>>> ---
>>>  libavcodec/error_resilience.c | 4 ++--
>>>  libavcodec/error_resilience.h | 2 +-
>>>  2 files changed, 3 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/libavcodec/error_resilience.c
>> b/libavcodec/error_resilience.c
>>> index 0c7f29d171..4c517335cf 100644
>>> --- a/libavcodec/error_resilience.c
>>> +++ b/libavcodec/error_resilience.c
>>> @@ -864,7 +864,7 @@ void ff_er_add_slice(ERContext *s, int startx, int
>> starty,
>>>      }
>>>
>>>      if (status & ER_MB_ERROR) {
>>> -        s->error_occurred = 1;
>>> +        avpriv_atomic_int_set(&s->error_occurred, 1);
>>>          avpriv_atomic_int_set(&s->error_count, INT_MAX);
>>
>> Could you try to port ER to C11 atomics instead? There are only a few
>> modules left using the libavutil avpriv_ stuff and it would be really
>> great if we could remove its usage before the unstable ABI period ends,
>> since after that the symbols will become part of the new ABI and we'll
>> have to stick with them until the next bump.
>>
> 
> 
> I'd like for that too, there's only avpriv_atomic leftovers in
> libavutil/opencl.c and h264 ER

There's also lavc, lavf and lavfi's utils.c, where
avpriv_atomic_ptr_cas() is used one or two times, and that should be
ported to atomic_compare_exchange_strong or atomic_compare_exchange_weak.


More information about the ffmpeg-devel mailing list