
Recherche avancée
Autres articles (60)
-
MediaSPIP 0.1 Beta version
25 avril 2011, parMediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
The zip file provided here only contains the sources of MediaSPIP in its standalone version.
To get a working installation, you must manually install all-software dependencies on the server.
If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...) -
Pas question de marché, de cloud etc...
10 avril 2011Le vocabulaire utilisé sur ce site essaie d’éviter toute référence à la mode qui fleurit allègrement
sur le web 2.0 et dans les entreprises qui en vivent.
Vous êtes donc invité à bannir l’utilisation des termes "Brand", "Cloud", "Marché" etc...
Notre motivation est avant tout de créer un outil simple, accessible à pour tout le monde, favorisant
le partage de créations sur Internet et permettant aux auteurs de garder une autonomie optimale.
Aucun "contrat Gold ou Premium" n’est donc prévu, aucun (...) -
Sélection de projets utilisant MediaSPIP
29 avril 2011, parLes exemples cités ci-dessous sont des éléments représentatifs d’usages spécifiques de MediaSPIP pour certains projets.
Vous pensez avoir un site "remarquable" réalisé avec MediaSPIP ? Faites le nous savoir ici.
Ferme MediaSPIP @ Infini
L’Association Infini développe des activités d’accueil, de point d’accès internet, de formation, de conduite de projets innovants dans le domaine des Technologies de l’Information et de la Communication, et l’hébergement de sites. Elle joue en la matière un rôle unique (...)
Sur d’autres sites (5673)
-
avformat/segment : Fix leak of string on error
5 septembre 2020, par Andreas Rheinhardtavformat/segment : Fix leak of string on error
A string containing the segment's filename that the segment muxer
allocates got only freed in its write_trailer function. This implies
that it leaks if write_trailer is never called, e.g. if initializing
the child muxer fails. This commit fixes this by freeing the string
in the deinit function instead.Reviewed-by : Ridley Combs <rcombs@rcombs.me>
Signed-off-by : Andreas Rheinhardt <andreas.rheinhardt@gmail.com> -
lavf/vf_framerate : Fix frame leak when increasing framerate.
11 mars 2017, par Alexis Ballier -
Memory leak using FFmpeg
3 août 2020, par kichmaI found out that my application has a memory leak coming from a C++ function. It seems this function is called for each frame and it leak is proportional to the size of a frame. It's called from a python code but the leak is somewhere in the C++ code.

I don't have much experience with ffmpeg or C++ and I'm not author of this code. Does anyone see what is causing leak here or can provide some advice how to debug this ? I tried to use the code (windows part) from this answer https://stackoverflow.com/a/64166/10046424 to find which part of the code uses memory but I always got 0.

static py::object video_encode_frame(py::object self) 
{

 video_encode_helper *vec = py::cppobject < video_encode_helper > (self.attr("_encoder_state")).value();

 int image_id = 0;
 RTIConfig rti;
 ViewerBase *bs = base(self);
 Py_BEGIN_ALLOW_THREADS;
 renderToExistingImage(&rti, vec->img_key, image_id, bs, vec->c->width, vec->c->height);
 Py_END_ALLOW_THREADS;

 static int i = 0;
 float dummy;
 int h, w;
 char buf[MVO_BUFFER_SIZE];

 HC_Show_Image(vec->img_key, &dummy, &dummy, &dummy, buf, &w, &h, vec->data);
 struct SwsContext *sws_ctx = sws_getContext(vec->c->width, vec->c->height, PIX_FMT_RGB24,
 vec->c->width, vec->c->height, (PixelFormat) vec->picture->format, 
 SWS_FAST_BILINEAR, NULL, NULL, NULL);

 int src_linesize[] = { vec->c->width * 3, 0, 0, 0 };
 const uint8_t *src_data[] = { (const uint8_t *) vec->data, 0, 0, 0 };
 sws_scale(sws_ctx, (const uint8_t * const *) src_data, src_linesize, 0, vec->c->height, vec->picture->data,
 vec->picture->linesize);
 sws_freeContext(sws_ctx);

 int repeat = vec->FPS / vec->TPS;
 if (repeat == 0)
 repeat = 1;


 int ret = -1;

 AVPacket pkt = { 0 };
 int got_packet;
 av_init_packet(&pkt);

 /* encode the image */
 ret = avcodec_encode_video2(vec->c, &pkt, vec->picture, &got_packet);
 if (ret < 0) 
 return py::bool_(false);

 for (int r = 0; r < repeat; r++) {
 /* If size is zero, it means the image was buffered. */
 if (!ret && got_packet && pkt.size) {
 pkt.stream_index = vec->video_st->index;

 /* Write the compressed frame to the media file. */
 ret = av_interleaved_write_frame(vec->oc, &pkt);

 } else
 ret = 0;

 vec->picture->pts += av_rescale_q(1, vec->video_st->codec->time_base, vec->video_st->time_base);
 vec->frame_count++;
 }
 return py::bool_(true);
}



There is also a cleanup function that is called at the end. Perhaps something should be deallocated there ?


static py::object video_encode_finalize(py::object self)
{
 if (self.attr("_encoder_state") == py::none())
 return py::bool_(false);

 video_encode_helper *vec = py::cppobject < video_encode_helper > (self.attr("_encoder_state")).value();

 /* Write the trailer, if any. The trailer must be written before you
 * close the CodecContexts open when you wrote the header; otherwise
 * av_write_trailer() may try to use memory that was freed on
 * av_codec_close(). */
 av_write_trailer(vec->oc);
 /* Close each codec. */

 avcodec_close(vec->video_st->codec);
 av_freep(&(vec->picture->data[0]));
 av_free(vec->picture);

 if (!(vec->fmt->flags & AVFMT_NOFILE))
 /* Close the output file. */
 avio_close(vec->oc->pb);

 /* free the stream */
 avformat_free_context(vec->oc);

 vec->initialized = false;
 vec->frame_count = 0;

 return py::bool_(true);
}