---
libavcodec/pthread.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
index b5922e8..89f2ee2 100644
--- a/libavcodec/pthread.c
+++ b/libavcodec/pthread.c
@@ -228,6 +228,13 @@ static int ff_thread_init(AVCodecContext *avctx, int thread_count)
return 0;
}
+/**
+ * Read and decode frames from the main thread until fctx->die is set.
+ * ff_report_frame_setup_done() is called before decoding if the codec
+ * doesn't define update_context(). To simplify codecs and avoid deadlock
+ * bugs, progress is set to INT_MAX on all returned frames, but this
+ * doesn't help codecs with delays.
+ */
static attribute_align_arg void *decode_frame_thread(void *arg)
{
PerThreadContext * volatile p = arg;
@@ -379,6 +386,7 @@ static void update_context_from_user(AVCodecContext *dst, AVCodecContext *src)
COPY(frame_number);
}
+/// Release all frames passed to ff_release_buffer()
static void handle_delayed_releases(PerThreadContext *p)
{
while (p->num_released_buffers > 0) {
@@ -393,6 +401,7 @@ static void handle_delayed_releases(PerThreadContext *p)
}
}
+/// Submit a frame to the next decoding thread
static int submit_frame(PerThreadContext * volatile p, const uint8_t *buf, int buf_size)
{
FrameThreadContext *fctx = p->parent;
@@ -508,6 +517,7 @@ void ff_report_frame_setup_done(AVCodecContext *avctx) {
pthread_mutex_unlock(&p->progress_mutex);
}
+/// Wait for all threads to finish decoding
static void park_frame_decode_threads(FrameThreadContext *fctx, int thread_count)
{
int i;
_______________________________________________
FFmpeg-soc mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-soc