[FFmpeg-devel] [PATCH 06/39] avcodec/wavpack: Constify slice threads' ptr to main context

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Wed Jul 27 01:07:41 EEST 2022


Modifying the main context from a slice thread is (usually) a data race,
so it must not happen. So only use a pointer to const to access
the main context.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
 libavcodec/wavpack.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
index 0e8d1286c2..c12e1d6ec6 100644
--- a/libavcodec/wavpack.c
+++ b/libavcodec/wavpack.c
@@ -1616,7 +1616,7 @@ static void wavpack_decode_flush(AVCodecContext *avctx)
 
 static int dsd_channel(AVCodecContext *avctx, void *frmptr, int jobnr, int threadnr)
 {
-    WavpackContext *s  = avctx->priv_data;
+    const WavpackContext *s  = avctx->priv_data;
     AVFrame *frame = frmptr;
 
     ff_dsd2pcm_translate (&s->dsdctx [jobnr], s->samples, 0,
-- 
2.34.1



More information about the ffmpeg-devel mailing list