ffmpeg_resize: check for owndata before frame_unref #1718

pull/1727/head
nick black 3 years ago committed by Nick Black
parent 250c5c9262
commit a7f41dcefa

@ -30,6 +30,7 @@ typedef struct ncvisual {
static inline void
ncvisual_set_data(ncvisual* ncv, void* data, bool owned){
//fprintf(stderr, "replacing %p with %p (%u -> %u)\n", ncv->data, data, ncv->owndata, owned);
if(ncv->owndata){
if(data != ncv->data){
free(ncv->data);

@ -526,8 +526,9 @@ int ffmpeg_resize(ncvisual* n, int rows, int cols){
n->rowstride = sframe->linesize[0];
n->pixy = rows;
n->pixx = cols;
//fprintf(stderr, "SETTING UP RESIZE %p\n", n->data);
av_frame_unref(n->details->frame);
if(n->owndata){
av_frame_unref(n->details->frame);
}
ncvisual_set_data(n, sframe->data[0], true);
n->details->frame = sframe;
//fprintf(stderr, "SIZE SCALED: %d %d (%u)\n", n->details->frame->height, n->details->frame->width, n->details->frame->linesize[0]);

Loading…
Cancel
Save