ncvisual_set_data: handle incoming data equivalent to existing data

pull/1626/head
nick black 3 years ago
parent 584f394071
commit 9a5b719627
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -30,7 +30,9 @@ typedef struct ncvisual {
static inline void static inline void
ncvisual_set_data(ncvisual* ncv, void* data, bool owned){ ncvisual_set_data(ncvisual* ncv, void* data, bool owned){
if(ncv->owndata){ if(ncv->owndata){
free(ncv->data); if(data != ncv->data){
free(ncv->data);
}
} }
ncv->data = (uint32_t*)data; ncv->data = (uint32_t*)data;
ncv->owndata = owned; ncv->owndata = owned;

@ -244,9 +244,12 @@ int ffmpeg_resize(ncvisual* n, int rows, int cols){
n->rowstride = sframe->linesize[0]; n->rowstride = sframe->linesize[0];
n->pixy = rows; n->pixy = rows;
n->pixx = cols; n->pixx = cols;
ncvisual_set_data(n, sframe->data[0], false); if((uint32_t*)sframe->data[0] != n->data){
if(n->details->frame){ //fprintf(stderr, "SETTING UP RESIZE %p\n", n->data);
av_freep(&n->details->frame); ncvisual_set_data(n, sframe->data[0], false);
if(n->details->frame){
av_freep(&n->details->frame);
}
} }
n->details->frame = sframe; n->details->frame = sframe;

Loading…
Cancel
Save