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.
This commit is contained in:
Olivier Crête 2015-07-27 18:49:49 -04:00
parent 431f3e0e6f
commit 1a127d19bb

View file

@ -769,23 +769,20 @@ fallback:
for (c = 0; c < AV_NUM_DATA_POINTERS; c++) { for (c = 0; c < AV_NUM_DATA_POINTERS; c++) {
ffmpegdec->stride[c] = picture->linesize[c]; ffmpegdec->stride[c] = picture->linesize[c];
}
/* Wrap our buffer around the default one to be able to have a callback /* 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 * 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 * buffer might not work if there are too many allocated already
*/ */
if (c == 0) { if (picture->buf[0]) {
if (picture->buf[c]) { dframe->avbuffer = picture->buf[0];
dframe->avbuffer = picture->buf[c]; picture->buf[0] =
picture->buf[c] = av_buffer_create (picture->buf[0]->data, picture->buf[0]->size,
av_buffer_create (picture->buf[c]->data, picture->buf[c]->size,
dummy_free_buffer, dframe, 0); dummy_free_buffer, dframe, 0);
} else { } else {
picture->buf[c] = picture->buf[0] =
av_buffer_create (NULL, 0, dummy_free_buffer, dframe, 0); av_buffer_create (NULL, 0, dummy_free_buffer, dframe, 0);
} }
}
}
return ret; return ret;
} }