[Libav-user] FFMPEG+JNI+ANDROID

Rui Luís rui.luis at gmail.com
Fri Jun 15 17:24:50 CEST 2012


Good Day.
I am using ffmepg (0.11) in android through JNI and i have with sucees been
able to stream a video. However i am having a huge problem. If i go back
and forth in my aplication in order to see several videos after the 4 or 5
video ffmpeg crash and does not output any error. Every time i start the
activity that contains the JNI calls to ffmepg it start a new "running" of
the ffmpeg.
    AVFormatContext *pFormatCtx;

    int video_index = -1;
    int audio_index = -1;
    int i;

    av_log_set_flags(AV_LOG_SKIP_REPEATED);
    // Register all formats and codecs
    avcodec_register_all();
    av_register_all();
    avformat_network_init();
...
and then
it crashes in the decoding cycle..
AVPacket pkt1, *packet = &pkt1;

            if(av_read_frame(global_video_state->pFormatCtx, packet) < 0) {
                decode_thread_fail();
                decodingEnabled = 0;
            }else{
                int failed = 1;
                if(packet->stream_index == global_video_state->videoStream)
{
                    //LOG_INFO("VIDEO");
                    av_free_packet(packet);

//failed=videoDecoderAddPacket(global_video_state,packet);
                } else if(packet->stream_index ==
global_video_state->audioStream) {
                    //LOG_INFO("AUDIO");
                    av_free_packet(packet);
                    //failed=audioDecoderAddPacket(packet);
                } else {
                    av_free_packet(packet);
                }
                if(failed==0){
                    decodingEnabled = 0;
                    decode_thread_fail();
                }
            }

as you can see i am not eveng processing the packets...

As i said.. this only occurs after several successfull....
i really need help..

Thanks..
------
Give a man a fish and you feed him for a day. Teach him how to fish and you
feed him for a lifetime.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20120615/b708e5f1/attachment.html>


More information about the Libav-user mailing list