aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorwm4 <nfxjfg@googlemail.com>2017-03-27 14:25:53 +0200
committerwm4 <nfxjfg@googlemail.com>2017-03-29 12:17:40 +0200
commit4cf1f68903cebcf6a6bede970f1b8f1509edf710 (patch)
treeaf29b7dbb110c56bdd6070ba84bb43859f88924a /libavcodec
parent91ccd38c0befb17d788c1621d1d4362dc1c40bd6 (diff)
downloadffmpeg-4cf1f68903cebcf6a6bede970f1b8f1509edf710.tar.gz
pthread_frame: minor simplification to error handling
Get rid of the "ret" variable, and always use err. Report the packet as consumed if err is unset. This should be equivalent to the old code, which obviously required err=0 for p->result>=0 (and otherwise, p->result must have had the value err was last set to). The code block added by commit 32a5b631267 is also not needed anymore, because the new code strictly returns err if it's >=0. Reviewed-by: "Ronald S. Bultje" <rsbultje@gmail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/pthread_frame.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index 295763a76d..5b5f5fb289 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -468,7 +468,7 @@ int ff_thread_decode_frame(AVCodecContext *avctx,
FrameThreadContext *fctx = avctx->internal->thread_ctx;
int finished = fctx->next_finished;
PerThreadContext *p;
- int err, ret = 0;
+ int err;
/* release the async lock, permitting blocked hwaccel threads to
* go forward while we are in this function */
@@ -496,7 +496,7 @@ int ff_thread_decode_frame(AVCodecContext *avctx,
if (fctx->delaying) {
*got_picture_ptr=0;
if (avpkt->size) {
- ret = avpkt->size;
+ err = avpkt->size;
goto finish;
}
}
@@ -542,21 +542,12 @@ int ff_thread_decode_frame(AVCodecContext *avctx,
fctx->next_finished = finished;
- /*
- * When no frame was found while flushing, but an error occurred in
- * any thread, return it instead of 0.
- * Otherwise the error can get lost.
- */
- if (!avpkt->size && !*got_picture_ptr)
- goto finish;
-
/* return the size of the consumed packet if no error occurred */
- ret = (p->result >= 0) ? avpkt->size : p->result;
+ if (err >= 0)
+ err = avpkt->size;
finish:
async_lock(fctx);
- if (err < 0)
- return err;
- return ret;
+ return err;
}
void ff_thread_report_progress(ThreadFrame *f, int n, int field)