Re: [FFmpeg-devel] [PATCH] avcodec: uninit hwaccel in case of software decoder

2024-12-10 Thread Thomas Guillem via ffmpeg-devel
Hi, On Tue, Dec 10, 2024, at 19:29, Anton Khirnov wrote: > Hi, > Quoting Thomas Guillem via ffmpeg-devel (2024-11-29 11:44:21) >> avcodec_get_hw_frames_parameters(), called by the user from get_format, >> is allocating ctx->internal->hwaccel_priv_data. But the hardware &g

Re: [FFmpeg-devel] [PATCH] avcodec: uninit hwaccel in case of software decoder

2024-12-06 Thread Thomas Guillem via ffmpeg-devel
Ping. On Fri, Nov 29, 2024, at 11:44, Thomas Guillem via ffmpeg-devel wrote: > avcodec_get_hw_frames_parameters(), called by the user from get_format, > is allocating ctx->internal->hwaccel_priv_data. But the hardware > decoding setup may fail on the user side and it may fallb

Re: [FFmpeg-devel] [PATCH] avcodec/pthread_frame: rework assert

2024-11-29 Thread Thomas Guillem via ffmpeg-devel
Sorry for the spam. "avcodec: uninit hwaccel in case of software decoder" is a better version. On Fri, Nov 29, 2024, at 09:37, Thomas Guillem via ffmpeg-devel wrote: > This patch is an alternative to the patch "avcodec: add > avcodec_reset_hw_frames_parameters(): > >

[FFmpeg-devel] [PATCH] avcodec: uninit hwaccel in case of software decoder

2024-11-29 Thread Thomas Guillem via ffmpeg-devel
avcodec_get_hw_frames_parameters(), called by the user from get_format, is allocating ctx->internal->hwaccel_priv_data. But the hardware decoding setup may fail on the user side and it may fallback to software decoding. In that case, ctx->internal->hwaccel_priv_data is still allocated but not used

Re: [FFmpeg-devel] [PATCH] avcodec: add avcodec_reset_hw_frames_parameters()

2024-11-29 Thread Thomas Guillem via ffmpeg-devel
Or you can check the alternative patch: "avcodec/pthread_frame: rework assert" On Thu, Nov 28, 2024, at 16:57, Thomas Guillem via ffmpeg-devel wrote: > usage example: > > AVBufferRef *hwframes_ref; > int ret = avcodec_get_hw_frames_parameters

Re: [FFmpeg-devel] [PATCH] avcodec/pthread_frame: rework assert

2024-11-29 Thread Thomas Guillem via ffmpeg-devel
This patch is an alternative to the patch "avcodec: add avcodec_reset_hw_frames_parameters(): On Fri, Nov 29, 2024, at 09:34, Thomas Guillem via ffmpeg-devel wrote: > avcodec_get_hw_frames_parameters(), called by the user from get_format, > is allocating ctx->internal->hwaccel_p

[FFmpeg-devel] [PATCH] avcodec/pthread_frame: rework assert

2024-11-29 Thread Thomas Guillem via ffmpeg-devel
avcodec_get_hw_frames_parameters(), called by the user from get_format, is allocating ctx->internal->hwaccel_priv_data. But the hardware decoding setup may fail on the user side and it may fallback to software decoding. In that case, ctx->internal->hwaccel_priv_data is still allocated but not used

[FFmpeg-devel] [PATCH] avcodec: add avcodec_reset_hw_frames_parameters()

2024-11-28 Thread Thomas Guillem via ffmpeg-devel
usage example: AVBufferRef *hwframes_ref; int ret = avcodec_get_hw_frames_parameters(ctx, hwdev_ref, hwfmt, &hwframes_ref); ... ret = av_hwframe_ctx_init(hwframes_ref); if (ret < 0) { av_buffer_unref(&hwframes_ref);

Re: [FFmpeg-devel] [PATCH] avcodec/decode: clean-up if get_hw_frames_parameters fails

2024-10-30 Thread Thomas Guillem via ffmpeg-devel
Happy monthly anniversary to my not very interesting patch. FYI, OpenSuse applied it for their ffmpeg build... On Mon, Oct 14, 2024, at 10:54, Thomas Guillem via ffmpeg-devel wrote: > Ping. > > On Mon, Oct 7, 2024, at 17:43, Thomas Guillem via ffmpeg-devel wrote: >> Fixes the f

Re: [FFmpeg-devel] [PATCH] avcodec/decode: clean-up if get_hw_frames_parameters fails

2024-10-30 Thread Thomas Guillem via ffmpeg-devel
Thanks ! On Wed, Oct 30, 2024, at 14:34, Zhao Zhili wrote: >> On Oct 30, 2024, at 21:19, Thomas Guillem via ffmpeg-devel >> wrote: >> >> Happy monthly anniversary to my not very interesting patch. >> >> FYI, OpenSuse applied it for their ffmpeg b

Re: [FFmpeg-devel] [PATCH] avcodec/decode: clean-up if get_hw_frames_parameters fails

2024-10-14 Thread Thomas Guillem via ffmpeg-devel
Ping. On Mon, Oct 7, 2024, at 17:43, Thomas Guillem via ffmpeg-devel wrote: > Fixes the following assert: > > [7f1df83d17e0] vaapi generic error: > avcodec_get_hw_frames_parameters failed: -22 > Assertion p_dst->hwaccel_threadsafe || (!dst->hwaccel && > !

[FFmpeg-devel] [PATCH] avcodec/decode: clean-up if get_hw_frames_parameters fails

2024-10-07 Thread Thomas Guillem via ffmpeg-devel
Fixes the following assert: [7f1df83d17e0] vaapi generic error: avcodec_get_hw_frames_parameters failed: -22 Assertion p_dst->hwaccel_threadsafe || (!dst->hwaccel && !dst->internal->hwaccel_priv_data) failed at libavcodec/pthread_frame.c:349 Reproduced from VLC with VAAPI, when fallbacking

Re: [FFmpeg-devel] [PATCH] avcodec/decode: clean-up if get_hw_frames_parameters fails

2024-10-07 Thread Thomas Guillem via ffmpeg-devel
On Mon, Oct 7, 2024, at 17:12, Rémi Denis-Courmont wrote: > Le 30 septembre 2024 17:27:46 GMT+09:00, Thomas Guillem via > ffmpeg-devel a écrit : >>Fixes the following assert: >> >>[7f1df83d17e0] vaapi generic error: avcodec_get_hw_frames_parameters >>

Re: [FFmpeg-devel] [PATCH] avcodec/decode: clean-up if get_hw_frames_parameters fails

2024-10-06 Thread Thomas Guillem via ffmpeg-devel
Ping. On Mon, Sep 30, 2024, at 13:44, Thomas Guillem via ffmpeg-devel wrote: > cf. https://trac.ffmpeg.org/ticket/11013 > > > On Mon, Sep 30, 2024, at 10:27, Thomas Guillem via ffmpeg-devel wrote: >> Fixes the following assert: >> >> [7f1

Re: [FFmpeg-devel] [PATCH] avcodec/decode: clean-up if get_hw_frames_parameters fails

2024-09-30 Thread Thomas Guillem via ffmpeg-devel
cf. https://trac.ffmpeg.org/ticket/11013 On Mon, Sep 30, 2024, at 10:27, Thomas Guillem via ffmpeg-devel wrote: > Fixes the following assert: > > [7f1df83d17e0] vaapi generic error: > avcodec_get_hw_frames_parameters failed: -22 > Assertion p_dst->hwaccel_threadsafe

[FFmpeg-devel] [PATCH] avcodec/decode: clean-up if get_hw_frames_parameters fails

2024-09-30 Thread Thomas Guillem via ffmpeg-devel
Fixes the following assert: [7f1df83d17e0] vaapi generic error: avcodec_get_hw_frames_parameters failed: -22 Assertion p_dst->hwaccel_threadsafe || (!dst->hwaccel && !dst->internal->hwaccel_priv_data) failed at libavcodec/pthread_frame.c:349 Reproduced from VLC with VAAPI, when fallbacking

Re: [FFmpeg-devel] [PATCH 3/3] h264: fix data-race with FF_DECODE_ERROR_DECODE_SLICES

2023-09-12 Thread Thomas Guillem via ffmpeg-devel
On Tue, Sep 12, 2023, at 15:11, Andreas Rheinhardt wrote: > Thomas Guillem via ffmpeg-devel: >> Same than the previous commit but with FF_DECODE_ERROR_DECODE_SLICES >> >> Fix the following data-race: >> >> WARNING: ThreadSanitizer: data race (pid=55935) >&

[FFmpeg-devel] [PATCH 2/3] h264: fix data-race with FF_DECODE_ERROR_CONCEALMENT_ACTIVE

2023-09-12 Thread Thomas Guillem via ffmpeg-devel
Set the FF_DECODE_ERROR_CONCEALMENT_ACTIVE flags on the AVFrane before outputing it. Store in in the H264Picture in the meantime, where it won't be read/write by other threads. Fix the following data-race: WARNING: ThreadSanitizer: data race (pid=55134) Write of size 4 at 0x7b507f78 by thre

[FFmpeg-devel] [PATCH 3/3] h264: fix data-race with FF_DECODE_ERROR_DECODE_SLICES

2023-09-12 Thread Thomas Guillem via ffmpeg-devel
Same than the previous commit but with FF_DECODE_ERROR_DECODE_SLICES Fix the following data-race: WARNING: ThreadSanitizer: data race (pid=55935) Write of size 4 at 0x7b509378 by thread T1 (mutexes: write M608): #0 decode_nal_units src/libavcodec/h264dec.c:742 (ffmpeg+0xb19dd6) #1 h

[FFmpeg-devel] [PATCH 1/3] error_resilience: set the decode_error_flags outside

2023-09-12 Thread Thomas Guillem via ffmpeg-devel
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

Re: [FFmpeg-devel] [PATCH] avformat/riff: add more GeoVision FOURCC

2022-02-17 Thread Thomas Guillem
Hello, Sorry, but I'm not allowed to share these cameras' footage. I was able to test them, and it runs fine on last ffmpeg. On Thu, Feb 17, 2022, at 15:32, Michael Niedermayer wrote: > On Thu, Feb 17, 2022 at 11:01:38AM +0100, Thomas Guillem wrote: >> --- >> libavf

[FFmpeg-devel] [PATCH] avformat/riff: add more GeoVision FOURCC

2022-02-17 Thread Thomas Guillem
--- libavformat/riff.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/riff.c b/libavformat/riff.c index 27a9706510..23e6306b66 100644 --- a/libavformat/riff.c +++ b/libavformat/riff.c @@ -32,6 +32,7 @@ * files use it as well. */ const AVCodecTag ff_codec_bmp_tags[] = { +

Re: [FFmpeg-devel] [PATCH] avcodec/pthread_frame: fix hw_device_ctx leak

2021-12-03 Thread Thomas Guillem
On Fri, Dec 3, 2021, at 09:52, Anton Khirnov wrote: > Quoting Thomas Guillem (2021-12-02 20:44:33) >> >> On Thu, Dec 2, 2021, at 15:05, Andreas Rheinhardt wrote: >> > 1. hw_device_ctx is in the public AVCodecContext, not in the private >> > AVCodecInternal. >

Re: [FFmpeg-devel] [PATCH] avcodec/pthread_frame: fix hw_device_ctx leak

2021-12-02 Thread Thomas Guillem
On Thu, Dec 2, 2021, at 15:05, Andreas Rheinhardt wrote: > 1. hw_device_ctx is in the public AVCodecContext, not in the private > AVCodecInternal. > 2. ctx->internal is intended to be allocated for all the internal > AVCodecContexts; the check is only there to ensure that we don't crash > if an a

Re: [FFmpeg-devel] [PATCH] avcodec/pthread_frame: fix hw_device_ctx leak

2021-12-02 Thread Thomas Guillem
On Thu, Dec 2, 2021, at 14:38, Andreas Rheinhardt wrote: > Thomas Guillem: >> Reproduced when using the VAAPI va module on VLC 4.0. No leaks when >> setting thread count to 1. >> --- >> libavcodec/pthread_frame.c | 1 + >> 1 file changed, 1 insertion(

[FFmpeg-devel] [PATCH] avcodec/pthread_frame: fix hw_device_ctx leak

2021-12-02 Thread Thomas Guillem
Reproduced when using the VAAPI va module on VLC 4.0. No leaks when setting thread count to 1. --- libavcodec/pthread_frame.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c index 73b1b7d7d9..4c578aa44a 100644 --- a/libavcodec/pthread_fra

Re: [FFmpeg-devel] [PATCH 1/2] avcodec/videotoolboxenc: fix undefined behavior with rc_max_rate=0

2018-07-20 Thread Thomas Guillem
On Thu, Jul 19, 2018, at 18:27, Aman Gupta wrote: > On Fri, Jul 6, 2018 at 10:55 PM Thomas Guillem wrote: > > > > > > > On Thu, Jul 5, 2018, at 20:49, Aman Gupta wrote: > > > On Wed, Jul 4, 2018 at 3:05 AM Thomas Guillem wrote: > > > > > >

Re: [FFmpeg-devel] [PATCH 1/2] avcodec/videotoolboxenc: fix undefined behavior with rc_max_rate=0

2018-07-06 Thread Thomas Guillem
n? > > Has a radar been filed with Apple about this? This issue doesn't reproduce on the iOS 12 beta (with the same device), so I guess they are aware or it has been fixed. > > On Wed, Jul 4, 2018 at 1:44 PM Thomas Guillem wrote: > > > On Wed, Jul 4, 2018, at 0

Re: [FFmpeg-devel] [PATCH 1/2] avcodec/videotoolboxenc: fix undefined behavior with rc_max_rate=0

2018-07-06 Thread Thomas Guillem
On Thu, Jul 5, 2018, at 20:49, Aman Gupta wrote: > On Wed, Jul 4, 2018 at 3:05 AM Thomas Guillem wrote: > > > On macOS, a zero rc_max_rate cause an error from > > VTSessionSetProperty(kVTCompressionPropertyKey_DataRateLimits). > > > > on iOS (depending on devic

Re: [FFmpeg-devel] [PATCH 1/2] avcodec/videotoolboxenc: fix undefined behavior with rc_max_rate=0

2018-07-04 Thread Thomas Guillem
On Wed, Jul 4, 2018, at 09:05, Thomas Guillem wrote: > On macOS, a zero rc_max_rate cause an error from > VTSessionSetProperty(kVTCompressionPropertyKey_DataRateLimits). > > on iOS (depending on device/version), a zero rc_max_rate cause invalid > arguments from the vtenc_output_cal

Re: [FFmpeg-devel] [PATCH] avcodec/videotoolboxenc: fix undefined behavior with rc_max_rate=0

2018-07-04 Thread Thomas Guillem
On Tue, Jul 3, 2018, at 20:53, Carl Eugen Hoyos wrote: > 2018-07-03 17:05 GMT+02:00, Thomas Guillem : > > On macOS, a zero rc_max_rate cause an error from > > VTSessionSetProperty(kVTCompressionPropertyKey_DataRateLimits). > > > > on iOS (depending on device/version

[FFmpeg-devel] [PATCH 2/2] avcodec/videotoolboxenc: reindent after previous commit

2018-07-04 Thread Thomas Guillem
--- libavcodec/videotoolboxenc.c | 72 ++-- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c index aa9aae7e05..050e5cefee 100644 --- a/libavcodec/videotoolboxenc.c +++ b/libavcodec/videotoolb

[FFmpeg-devel] [PATCH 1/2] avcodec/videotoolboxenc: fix undefined behavior with rc_max_rate=0

2018-07-04 Thread Thomas Guillem
On macOS, a zero rc_max_rate cause an error from VTSessionSetProperty(kVTCompressionPropertyKey_DataRateLimits). on iOS (depending on device/version), a zero rc_max_rate cause invalid arguments from the vtenc_output_callback after few frames and then a crash within the VideoToolbox library. --- l

[FFmpeg-devel] [PATCH] avcodec/videotoolboxenc: fix undefined behavior with rc_max_rate=0

2018-07-03 Thread Thomas Guillem
On macOS, a zero rc_max_rate cause an error from VTSessionSetProperty(kVTCompressionPropertyKey_DataRateLimits). on iOS (depending on device/version), a zero rc_max_rate cause invalid arguments from the vtenc_output_callback after few frames and then a crash within the VideoToolbox library. --- l

Re: [FFmpeg-devel] [PATCH 3/3] avcodec/videotoolboxenc: fix invalid session on iOS

2018-06-18 Thread Thomas Guillem
Ping? On Thu, Jun 14, 2018, at 17:48, Thomas Guillem wrote: > Cf. comment. Restart the VT session when the APP goes from foreground to > background and vice versa. > --- > libavcodec/videotoolboxenc.c | 23 +-- > 1 file changed, 21 insertions(+), 2 deletio

[FFmpeg-devel] [PATCH 3/3] avcodec/videotoolboxenc: fix invalid session on iOS

2018-06-14 Thread Thomas Guillem
Cf. comment. Restart the VT session when the APP goes from foreground to background and vice versa. --- libavcodec/videotoolboxenc.c | 23 +-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c index 106005

[FFmpeg-devel] [PATCH 3/3] avcodec/videotoolboxenc: fix invalid session on iOS

2018-06-11 Thread Thomas Guillem
Cf. comment. Restart the VT session when the APP goes from foreground to background and vice versa. --- libavcodec/videotoolboxenc.c | 25 +++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c index 1060

[FFmpeg-devel] [PATCH 2/3] avcodec/videotoolboxenc: split initialization

2018-06-11 Thread Thomas Guillem
Split vtenc_init() into vtenc_init() (VTEncContext initialization) and vtenc_configure_encoder() (creates the vt session). This commit will allow to restart the vt session while encoding. --- libavcodec/videotoolboxenc.c | 48 +--- 1 file changed, 28 insertions(+),

[FFmpeg-devel] [PATCH 1/3] avcodec/videotoolboxenc: fix mutex/cond leak in error path

2018-06-11 Thread Thomas Guillem
The leak could happen when the vtenc_create_encoder() function failed. --- libavcodec/videotoolboxenc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c index 7796a685c2..9f2a71b15d 100644 --- a/libavcodec/videotoo

Re: [FFmpeg-devel] [PATCH] lavc: Make hardware config method support more explicit for hwaccels

2017-12-08 Thread Thomas Guillem
On Fri, Dec 8, 2017, at 17:15, Mark Thompson wrote: > From: Thomas Guillem > > This fixes the use of old ad-hoc methods which are still supported by > some > hwaccels which also support newer methods (DXVA2, VAAPI, VDPAU, > videotoolbox) - without the method being visible h

[FFmpeg-devel] [PATCH 2/2] lavc: add back AD_HOC method for DXVA2/D3D11/VAAPI/VDPAU

2017-12-07 Thread Thomas Guillem
--- libavcodec/hwaccel.h | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/hwaccel.h b/libavcodec/hwaccel.h index 16ee822920..292a87f6b5 100644 --- a/libavcodec/hwaccel.h +++ b/libavcodec/hwaccel.h @@ -75,15 +75,15 @@ typedef struct AVCodecHWConfigInternal {

[FFmpeg-devel] [PATCH 1/2] lavc: change HW_CONFIG_HWACCEL arguments

2017-12-07 Thread Thomas Guillem
Add a boolean to specify if an API can work with AV_CODEC_HW_CONFIG_METHOD_AD_HOC. --- libavcodec/hwaccel.h | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/libavcodec/hwaccel.h b/libavcodec/hwaccel.h index ae55527c2f..16ee822920 100644 --- a/libavcodec/hwaccel