
Recherche avancée
Médias (1)
-
The pirate bay depuis la Belgique
1er avril 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Image
Autres articles (62)
-
Websites made with MediaSPIP
2 mai 2011, parThis page lists some websites based on MediaSPIP.
-
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
-
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir
Sur d’autres sites (10859)
-
FFmpeg - Memory leak using sws_scale
12 décembre 2018, par AlexVestinI’m trying to read a video-file and extract RGB24 frames from this. The problem is when I use sw_scale, the program leaks 200MB/s, which isn’t ideal.
A shortened version of the code I’m using is :
static int decode_packet(uint8_t** data, int* frame_size){
int ret = 0, dec_ret = 0;
dec_ret = avcodec_send_packet(video_dec_ctx, &pkt);
while(dec_ret >= 0) {
dec_ret = avcodec_receive_frame(video_dec_ctx, frame);
if(dec_ret == AVERROR(EAGAIN) || dec_ret == AVERROR_EOF) {
return decoded;
}
if(!image_inited && frame->format != -1) {
sws_context = init_context();
image_inited = true;
}
const int size = video_dec_ctx->width*video_dec_ctx->height*3;
uint8_t* buffer = malloc(size);
const int out_linesize[1] = { 3 * video_dec_ctx->width };
sws_scale(
sws_context,
frame->data,
frame->linesize,
0,
video_dec_ctx->height,
(const uint8_t * const *)&buffer,
out_linesize
);
*data = buffer;
}
}
void get_next_frame(uint8_t* data) {
int ret = av_read_frame(fmt_ctx, &pkt);
AVPacket orig_pkt = pkt;
ret = decode_packet(&data, &idummy);
av_packet_unref(&orig_pkt);
av_frame_unref(frame);
return ret;
}And called from a main (pseduocode) :
int main(inr argc, char** argv) {
while(frames_left) {
uint8_t* f;
get_next_frame(f);
apply_frame(f);
free(f);
}
}After a bit of debugging I found that this part :
const int out_linesize[1] = { 3 * video_dec_ctx->width };
sws_scale(
sws_context,
frame->data,
frame->linesize,
0,
video_dec_ctx->height,
(const uint8_t * const *)&buffer,
out_linesize
);was the culprit. If I comment this section out the program runs fine (or at least without 200MB memory leak ^^)
I’ve tried freeing the sws_context after each call, freeing the av_frame after each call in get_next_frame but the memory leak is still there.
Does anyone know how to fix the leak ?
-
avformat/aacdec : Fix leak in adts_aac_read_packet()
25 novembre 2017, par Michael Niedermayer -
avfilter/vf_framerate : fix frame leak at uninit
12 septembre 2015, par Paul B Mahol