From 1a127d19bb2ab3972f0f86dfa7ad88ba6623667a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Cr=C3=AAte?= Date: Mon, 27 Jul 2015 18:49:49 -0400 Subject: avviddec: Get code out of loop Code was executed only on the first iteration, so just pull it out of the loop entirely. This makes it clear it has nothing to do with the loop. --- ext/libav/gstavviddec.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/ext/libav/gstavviddec.c b/ext/libav/gstavviddec.c index 811e51b..16e4ea7 100644 --- a/ext/libav/gstavviddec.c +++ b/ext/libav/gstavviddec.c @@ -769,22 +769,19 @@ fallback: for (c = 0; c < AV_NUM_DATA_POINTERS; c++) { ffmpegdec->stride[c] = picture->linesize[c]; - - /* Wrap our buffer around the default one to be able to have a callback - * when our data can be freed. Just putting our data into the first free - * buffer might not work if there are too many allocated already - */ - if (c == 0) { - if (picture->buf[c]) { - dframe->avbuffer = picture->buf[c]; - picture->buf[c] = - av_buffer_create (picture->buf[c]->data, picture->buf[c]->size, - dummy_free_buffer, dframe, 0); - } else { - picture->buf[c] = - av_buffer_create (NULL, 0, dummy_free_buffer, dframe, 0); - } - } + } + /* Wrap our buffer around the default one to be able to have a callback + * when our data can be freed. Just putting our data into the first free + * buffer might not work if there are too many allocated already + */ + if (picture->buf[0]) { + dframe->avbuffer = picture->buf[0]; + picture->buf[0] = + av_buffer_create (picture->buf[0]->data, picture->buf[0]->size, + dummy_free_buffer, dframe, 0); + } else { + picture->buf[0] = + av_buffer_create (NULL, 0, dummy_free_buffer, dframe, 0); } return ret; -- cgit v1.2.1