[FFmpeg-devel] [PATCH 1/2] avcodec/error_resilience: Use atomic set on writing error_occurred per slice
Michael Niedermayer
michael at niedermayer.cc
Sun Nov 12 00:16:55 EET 2017
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);
}
@@ -892,7 +892,7 @@ void ff_er_add_slice(ERContext *s, int startx, int starty,
prev_status &= ~ VP_START;
if (prev_status != (ER_MV_END | ER_DC_END | ER_AC_END)) {
- s->error_occurred = 1;
+ avpriv_atomic_int_set(&s->error_occurred, 1);
avpriv_atomic_int_set(&s->error_count, INT_MAX);
}
}
diff --git a/libavcodec/error_resilience.h b/libavcodec/error_resilience.h
index 27c2008694..0eb07b1d30 100644
--- a/libavcodec/error_resilience.h
+++ b/libavcodec/error_resilience.h
@@ -61,7 +61,7 @@ typedef struct ERContext {
ptrdiff_t b8_stride;
volatile int error_count;
- int error_occurred;
+ volatile int error_occurred;
uint8_t *error_status_table;
uint8_t *er_temp_buffer;
int16_t *dc_val[3];
--
2.15.0
More information about the ffmpeg-devel
mailing list