
Recherche avancée
Médias (1)
-
SPIP - plugins - embed code - Exemple
2 septembre 2013, par
Mis à jour : Septembre 2013
Langue : français
Type : Image
Autres articles (85)
-
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 ;
-
Ecrire une actualité
21 juin 2013, parPrésentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
Vous pouvez personnaliser le formulaire de création d’une actualité.
Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...) -
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 (13689)
-
avfilter/vf_xpsnr : Fix leaks
9 janvier, par Andreas Rheinhardtavfilter/vf_xpsnr : Fix leaks
This filter uses the AVBuffer API to allocate buffers that are never
shared at all and frees them via av_freep() (actually, it passes
pointers to AVBufferRefs to av_freep, so that only the AVBuffer
structures are freed at all (because AVBufferRef has a AVBuffer* as its
first member), not the AVBufferRef and not the underlying buffers ;
and due to a wrong check the AVBuffers corresponding
to buf_org[c] with c>0 were never freed at all). This is a violation
of the AVBuffer API and causes a memleak. Fix this by avoiding the
AVBuffer API altogether.
(The FATE tests don't catch this, because they use piping to awk,
so that the error code from ffmpeg is ignored.)Signed-off-by : Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-
avcodec/librsvgdec : fix memory leaks and deprecated functions
8 octobre 2023, par Leo Izenavcodec/librsvgdec : fix memory leaks and deprecated functions
At various points through the function librsvg_decode_frame, errors are
returned from immediately without deallocating any allocated structs.
This patch both fixes those leaks, and also fixes the use of functions
that are deprecated since librsvg version 2.52.0. The older calls are
still used, guarded by #ifdefs while the newer replacements are used if
librsvg >= 2.52.0. One of the deprecated functions is used as a check
for the configure shell script, so it was replaced with a different
function.Signed-off-by : Leo Izen <leo.izen@gmail.com>
-
Android Java Jni c++ Memory leaks
6 avril 2023, par Edson MagombeI'm facing problems with my code. It has a pretty high memory consumption and with time can hit 1GB RAM.
I'm using c++ and ffmpeg lib to read audio samples and generate waveforms but I really can't find where the leak is.


Here is my code :


extern "C"
JNIEXPORT jint JNICALL
Java_modules_Waveform_decode_1to_1pcm(JNIEnv *env, jobject thiz, jstring input, jstring output) {
 const char * filename = (*env).GetStringUTFChars(input, 0);
 const char * outfilename = (*env).GetStringUTFChars(output, 0);
 if((*env).PushLocalFrame(1) != JNI_OK) {
 __android_log_print(ANDROID_LOG_ERROR, "exception: ", "%s", "Failed to open capacity");
 return -1;
 }
 /* Open File */
 AVFormatContext * format_ctx{nullptr};
 int result_open = avformat_open_input(&format_ctx, filename, nullptr, nullptr);

 result_open = avformat_find_stream_info(format_ctx, nullptr);

 int index = av_find_best_stream(format_ctx, AVMEDIA_TYPE_AUDIO, -1, -1, nullptr, 0);

 /* Finding decoder */
 AVStream *streams = format_ctx->streams[index];
 const AVCodec *decoder = avcodec_find_decoder(streams->codecpar->codec_id);

 AVCodecContext *codec_ctx{avcodec_alloc_context3(decoder)};

 avcodec_parameters_to_context(codec_ctx, streams->codecpar);

 /* Opening decoder */
 result_open = avcodec_open2(codec_ctx, decoder, nullptr);

 /* Decoding the audio */
 AVPacket *packet = av_packet_alloc();
 AVFrame *frame = av_frame_alloc();

 SwrContext *resampler{swr_alloc_set_opts(
 nullptr,
 streams->codecpar->channel_layout,
 AV_SAMPLE_FMT_FLT,
 streams->codecpar->sample_rate,
 streams->codecpar->channel_layout,
 (AVSampleFormat) streams->codecpar->format,
 streams->codecpar->format,
 streams->codecpar->sample_rate,
 0
 )};

 std::ofstream out(outfilename, std::ios::binary);
 while (av_read_frame(format_ctx, packet) == 0) {
 if(packet->stream_index != streams->index) {
 continue;
 }

 result_open = avcodec_send_packet(codec_ctx, packet);
 if(result_open < 0) {
 // AVERROR(EAGAIN) --> Send the packet again getting frames out!
 if(result_open != AVERROR(EAGAIN)) {
 __android_log_print(ANDROID_LOG_ERROR, "exception: ", "%s", "Error decoding...");
 }
 }
 while (avcodec_receive_frame(codec_ctx, frame) == 0) {
 /* Resample the frame */
 AVFrame *resampler_frame = av_frame_alloc();
 resampler_frame->sample_rate = 100;
 resampler_frame->channel_layout = frame->channel_layout;
 resampler_frame->channels = frame->channels;
 resampler_frame->format = AV_SAMPLE_FMT_S16;

 result_open = swr_convert_frame(resampler, resampler_frame, frame);
 if(result_open >= 0) {
 int16_t *samples = (int16_t *) frame->data[0];
 for(int c = 0; c < resampler_frame->channels; c ++) {
 float sum = 0;
 for(int i = 0; i < resampler_frame->nb_samples; i ++) {
 if(samples[i * resampler_frame->channels + c] < 0) {
 sum += (float) samples[i * resampler_frame->channels + c] * (-1);
 } else {
 sum += (float) samples[i * resampler_frame->channels + c];
 }
 int average_point = (int) ((sum * 2) / (float) resampler_frame->nb_samples);
 if(average_point > 0) {
 out << average_point << "\n";
 }
 }
 }
 }
 av_frame_unref(frame);
 av_frame_free(&resampler_frame);
 }
 }
 av_frame_free(&frame);
 av_packet_unref(packet);
 av_packet_free(&packet);
 out.close();
 (*env).PopLocalFrame(nullptr);
 (*env).ReleaseStringUTFChars(input, filename);
 (*env).ReleaseStringUTFChars(output, outfilename);
 return 1;
}



I tried ticks like (*env).ReleaseStringUTFChars and (*env).PopLocalFrame(nullptr) but it's not working. The memory consumption is still very high