Recherche avancée

Médias (0)

Mot : - Tags -/latitude

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (80)

  • Diogene : création de masques spécifiques de formulaires d’édition de contenus

    26 octobre 2010, par

    Diogene est un des plugins ? SPIP activé par défaut (extension) lors de l’initialisation de MediaSPIP.
    A quoi sert ce plugin
    Création de masques de formulaires
    Le plugin Diogène permet de créer des masques de formulaires spécifiques par secteur sur les trois objets spécifiques SPIP que sont : les articles ; les rubriques ; les sites
    Il permet ainsi de définir en fonction d’un secteur particulier, un masque de formulaire par objet, ajoutant ou enlevant ainsi des champs afin de rendre le formulaire (...)

  • Gestion des droits de création et d’édition des objets

    8 février 2011, par

    Par défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 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 (...)

Sur d’autres sites (9152)

  • FFmpeg leaks memory after closing activity

    28 juillet 2015, par grunk

    I’m trying to implements a rtsp player based on the roman10 tutorial.
    I can play a stream but each time i leave the activity a lot of memory is leaked.
    After some research it appears that the bitmap which is a global jobject is the cause :

    jobject createBitmap(JNIEnv *pEnv, int pWidth, int pHeight) {
       int i;
       //get Bitmap class and createBitmap method ID
       jclass javaBitmapClass = (jclass)(*pEnv)->FindClass(pEnv, "android/graphics/Bitmap");
       jmethodID mid = (*pEnv)->GetStaticMethodID(pEnv, javaBitmapClass, "createBitmap", "(IILandroid/graphics/Bitmap$Config;)Landroid/graphics/Bitmap;");
       //create Bitmap.Config
       //reference: https://forums.oracle.com/thread/1548728
       const wchar_t* configName = L"ARGB_8888";
       int len = wcslen(configName);
       jstring jConfigName;
       if (sizeof(wchar_t) != sizeof(jchar)) {
           //wchar_t is defined as different length than jchar(2 bytes)
           jchar* str = (jchar*)malloc((len+1)*sizeof(jchar));
           for (i = 0; i < len; ++i) {
               str[i] = (jchar)configName[i];
           }
           str[len] = 0;
           jConfigName = (*pEnv)->NewString(pEnv, (const jchar*)str, len);
       } else {
           //wchar_t is defined same length as jchar(2 bytes)
           jConfigName = (*pEnv)->NewString(pEnv, (const jchar*)configName, len);
       }
       jclass bitmapConfigClass = (*pEnv)->FindClass(pEnv, "android/graphics/Bitmap$Config");
       jobject javaBitmapConfig = (*pEnv)->CallStaticObjectMethod(pEnv, bitmapConfigClass,
               (*pEnv)->GetStaticMethodID(pEnv, bitmapConfigClass, "valueOf", "(Ljava/lang/String;)Landroid/graphics/Bitmap$Config;"), jConfigName);
       //create the bitmap
       return (*pEnv)->CallStaticObjectMethod(pEnv, javaBitmapClass, mid, pWidth, pHeight, javaBitmapConfig);
    }

    The bitmap is created like this :

    bitmap = createBitmap(...);

    When the activity is closed this method is called :

    void finish(JNIEnv *pEnv) {
       //unlock the bitmap
       AndroidBitmap_unlockPixels(pEnv, bitmap);
       av_free(buffer);
       // Free the RGB image
       av_free(frameRGBA);
       // Free the YUV frame
       av_free(decodedFrame);
       // Close the codec
       avcodec_close(codecCtx);
       // Close the video file
       avformat_close_input(&formatCtx);
    }

    The bitmap seems to never be freed, just unlocked.

    What should i do be sure to get back all the memory ?

    Note : i’m using ffmpeg 2.5.2.

  • Android Java Jni c++ Memory leaks

    6 avril 2023, par Edson Magombe

    I'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

    


  • avcodec_decode_video2 returns positive number when got_picture_ptr is 0

    22 août 2017, par dafnahaktana

    According to the documentation : here, avcodec_decode_video2 should return 0 if no frame could be decompressed. The got_picture_ptr should also be set to zero if no frame could be decompressed.

    I ran this function on a h264 video and I got positive return value while the got_picture_ptr was set to 0. Maybe that the documentation is not updated ?