diff mbox series

[FFmpeg-devel,3/3] avcodech/h264_picture: use ff_thread_replace_frame()

Message ID 20210810220001.13494-3-jamrial@gmail.com
State New
Headers show
Series [FFmpeg-devel,1/3] avutil/frame: add av_frame_replace | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

James Almer Aug. 10, 2021, 10 p.m. UTC
Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/h264_picture.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Andreas Rheinhardt Aug. 10, 2021, 10:16 p.m. UTC | #1
James Almer:
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  libavcodec/h264_picture.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/libavcodec/h264_picture.c b/libavcodec/h264_picture.c
> index ff30166b4d..109a8ff31d 100644
> --- a/libavcodec/h264_picture.c
> +++ b/libavcodec/h264_picture.c
> @@ -154,8 +154,7 @@ int ff_h264_replace_picture(H264Context *h, H264Picture *dst, const H264Picture
>      av_assert0(src->tf.f == src->f);
>  
>      dst->tf.f = dst->f;
> -    ff_thread_release_buffer(h->avctx, &dst->tf);
> -    ret = ff_thread_ref_frame(&dst->tf, &src->tf);
> +    ret = ff_thread_replace_frame(h->avctx, &dst->tf, &src->tf);
>      if (ret < 0)
>          goto fail;
>  
> 
Is there a reason that you only intend to use this here? Couldn't one
replace all occurrences of ff_thread_ref_frame() with this (and remove
ff_thread_ref_frame())?

- Andreas
James Almer Aug. 10, 2021, 10:22 p.m. UTC | #2
On 8/10/2021 7:16 PM, Andreas Rheinhardt wrote:
> James Almer:
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>>   libavcodec/h264_picture.c | 3 +--
>>   1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/libavcodec/h264_picture.c b/libavcodec/h264_picture.c
>> index ff30166b4d..109a8ff31d 100644
>> --- a/libavcodec/h264_picture.c
>> +++ b/libavcodec/h264_picture.c
>> @@ -154,8 +154,7 @@ int ff_h264_replace_picture(H264Context *h, H264Picture *dst, const H264Picture
>>       av_assert0(src->tf.f == src->f);
>>   
>>       dst->tf.f = dst->f;
>> -    ff_thread_release_buffer(h->avctx, &dst->tf);
>> -    ret = ff_thread_ref_frame(&dst->tf, &src->tf);
>> +    ret = ff_thread_replace_frame(h->avctx, &dst->tf, &src->tf);
>>       if (ret < 0)
>>           goto fail;
>>   
>>
> Is there a reason that you only intend to use this here? Couldn't one
> replace all occurrences of ff_thread_ref_frame() with this (and remove
> ff_thread_ref_frame())?

I didn't look into it. Also, it would probably only make sense to 
replace the relevant calls in update_thread_context() implementations, 
since every other use of av_frame_ref() and ff_thread_ref_frame() will 
be for non matching frames where it makes no difference.

> 
> - Andreas
> _______________________________________________
> 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".
>
diff mbox series

Patch

diff --git a/libavcodec/h264_picture.c b/libavcodec/h264_picture.c
index ff30166b4d..109a8ff31d 100644
--- a/libavcodec/h264_picture.c
+++ b/libavcodec/h264_picture.c
@@ -154,8 +154,7 @@  int ff_h264_replace_picture(H264Context *h, H264Picture *dst, const H264Picture
     av_assert0(src->tf.f == src->f);
 
     dst->tf.f = dst->f;
-    ff_thread_release_buffer(h->avctx, &dst->tf);
-    ret = ff_thread_ref_frame(&dst->tf, &src->tf);
+    ret = ff_thread_replace_frame(h->avctx, &dst->tf, &src->tf);
     if (ret < 0)
         goto fail;