Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/190.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
android ffmpeg错误致命信号11_Android_Ffmpeg_Rtsp_Fatal Error - Fatal编程技术网

android ffmpeg错误致命信号11

android ffmpeg错误致命信号11,android,ffmpeg,rtsp,fatal-error,Android,Ffmpeg,Rtsp,Fatal Error,我在Android上使用ffmpeg。并使用RTSP网络摄像头 我指的是 我有很好的视频 但我在结束视频时收到错误 螺纹2537(螺纹-13225)0x8a7c0d04(代码=1)处的致命信号11(SIGSEGV) 因此,我使用日志发现了错误。但我不知道为什么会发生错误 下面的代码是错误的位置 void closeMovie(){ av_read_pause(gFormatCtx); if (gVideoBuffer != NULL) { free(gVideoBuffer);

我在Android上使用ffmpeg。并使用RTSP网络摄像头

我指的是

我有很好的视频

但我在结束视频时收到错误

螺纹2537(螺纹-13225)0x8a7c0d04(代码=1)处的致命信号11(SIGSEGV)

因此,我使用日志发现了错误。但我不知道为什么会发生错误

下面的代码是错误的位置

void closeMovie(){
  av_read_pause(gFormatCtx);
  if (gVideoBuffer != NULL) {
    free(gVideoBuffer);
    gVideoBuffer = NULL;
  }
  if (gFrame != NULL)
      av_free(gFrame);
  if (gFrameRGB != NULL)
      av_free(gFrameRGB);
  if (gVideoCodecCtx != NULL) {
      avcodec_close(gVideoCodecCtx);
      av_free(gVideoCodecCtx);
      gVideoCodecCtx = NULL;
  }
  if (gFormatCtx != NULL) {
      **av_close_input_file(gFormatCtx);** //here
      gFormatCtx = NULL;
  }
}

如果
//s->iformat->read\u close(s)不崩溃

但是我不能再打开视频了。再次打开视频,我必须退出应用程序

对不起,我英语说得不好。 谢谢你的阅读

ps1。LogCat

12-10 10:08:02.991: D/TAG(21770): TAG - closeMovie1 - in
12-10 10:08:02.991: D/TAG(21770): TAG - avcodec_close - in
12-10 10:08:02.991: D/TAG(21770): av_opt_free - on
12-10 10:08:02.991: D/TAG(21770): av_opt_free - out
12-10 10:08:02.991: D/TAG(21770): TAG - avcodec_close - out
12-10 10:08:02.991: D/TAG(21770): TAG - av_close_input_file - in
12-10 10:08:02.991: D/TAG(21770): TAG - avformat_close_input - in
12-10 10:08:02.991: D/TAG(21770): TAG - flush_packet_queue - 
12-10 10:08:02.991: D/TAG(21770): flush_packet_queue - on
12-10 10:08:02.991: D/TAG(21770): flush_packet_queue - out
12-10 10:08:02.991: D/TAG(21770): TAG - s->iformat->read_close : 0
12-10 10:08:02.991: D/TAG(21770): TAG - avformat_free_context 
12-10 10:08:02.991: D/TAG(21770): TAG - avformat_free_context - in
12-10 10:08:02.991: D/TAG(21770): av_opt_free - on
12-10 10:08:02.991: D/TAG(21770): av_opt_free - out
12-10 10:08:02.991: D/TAG(21770): av_opt_free - on
12-10 10:08:02.991: D/TAG(21770): av_opt_free - out
12-10 10:08:02.991: D/TAG(21770): TAG - avformat_for_length s->nb_streams - 3
12-10 10:08:02.991: D/TAG(21770): TAG - avformat_for_nb_streams - in
12-10 10:08:02.991: D/TAG(21770): TAG - avformat_for_ nb_streams - out
12-10 10:08:02.991: D/TAG(21770): TAG - avformat_for_nb_streams - in
12-10 10:08:02.991: D/TAG(21770): TAG - avformat_for_ nb_streams - out
12-10 10:08:02.991: D/TAG(21770): TAG - avformat_for_nb_streams - in
12-10 10:08:02.991: D/TAG(21770): TAG - avformat_for_ nb_streams - out
12-10 10:08:02.991: D/TAG(21770): TAG - avformat_for_length s->nb_programs-1 - -1
12-10 10:08:02.991: D/TAG(21770): TAG - freep 1
12-10 10:08:02.991: D/TAG(21770): TAG - freep 2
12-10 10:08:02.991: D/TAG(21770): TAG - while
12-10 10:08:02.991: D/TAG(21770): TAG - freep 3
12-10 10:08:02.991: D/TAG(21770): TAG - dict_free 1
12-10 10:08:02.991: D/TAG(21770): TAG - freep 4
12-10 10:08:02.991: D/TAG(21770): TAG - freep 3
12-10 10:08:02.991: D/TAG(21770): TAG - avformat_free_context - out
12-10 10:08:02.991: D/TAG(21770): TAG - avio_close - in
12-10 10:08:02.991: D/TAG(21770): TAG - avio_close - 1
12-10 10:08:02.991: D/TAG(21770): TAG - avio_close - 2
12-10 10:08:02.991: D/TAG(21770): TAG - avio_close - out
12-10 10:08:02.991: D/TAG(21770): TAG - avio_close(pb) : 0
12-10 10:08:02.991: D/TAG(21770): TAG - avio_close - in
12-10 10:08:02.991: D/TAG(21770): TAG - avio_close - 1
12-10 10:08:02.991: D/TAG(21770): TAG - avio_close - 2
12-10 10:08:02.991: D/TAG(21770): TAG - avio_close - out
12-10 10:08:02.991: D/TAG(21770): TAG - avformat_close_input - out
12-10 10:08:02.991: D/TAG(21770): TAG - av_close_input_file - out
12-10 10:08:02.991: D/TAG(21770): TAG - closeMovie1 - out
12-10 10:08:03.151: D/AbsListView(21770): onVisibilityChanged() is called, visibility : 0
12-10 10:08:03.151: D/AbsListView(21770): unregisterIRListener() is called 
12-10 10:08:03.201: D/AbsListView(21770): unregisterIRListener() is called 
12-10 10:08:03.221: D/AbsListView(21770): unregisterIRListener() is called 
12-10 10:08:03.241: A/libc(21770): Fatal signal 11 (SIGSEGV) at 0x8bb85698 (code=1), thread 21938 (Thread-23561)
ps2.日志的顺序

(BasicPlayer.c) closeMovie in->
(utils.c) avcodec_close ->
(utils.c) av_close_input_file ->
(utils.c) avformat_close_input ->
(utils.c) flush_packet_queue ->
(utils.c) **s->iformat->read_close(s)** ->
(utils.c) avformat_free_context ->
(utils.c) avio_close(pb) ->
(BasicPlayer.c) closeMovie out
谢谢你的阅读

我必须解决这个问题

添加代码utils.c

typedef struct {
    int audio_size;    /**< audio packet size (bytes) */
    int video_size;    /**< video packet size (bytes) */
    int palette_size;  /**< palette size (bytes) */
    int video_type;    /**< per-frame video compression type */
} JVFrame;
typedef struct {
     JVFrame *frames;
     enum {
         JV_AUDIO = 0,
         JV_VIDEO,
         JV_PADDING
     } state;
     int64_t pts;
} JVDemuxContext;
以及修改代码

void av_close_input_stream(AVFormatContext *s)
{
    flush_packet_queue(s);
    if (s->iformat->read_close)
       //**s->iformat->read_close(s);** //here fixed --> 
       read_close(s);
    avformat_free_context(s);
}
我不知道。为什么会产生错误

但通过修改代码解决了这个问题

void av_close_input_stream(AVFormatContext *s)
{
    flush_packet_queue(s);
    if (s->iformat->read_close)
       //**s->iformat->read_close(s);** //here fixed --> 
       read_close(s);
    avformat_free_context(s);
}
如果您有任何问题,我希望这会有所帮助

对不起,我英语说得不好。谢谢你的阅读

static int read_close(AVFormatContext *s)
{

    JVDemuxContext *jv = s->priv_data;
    av_free(jv->frames);
    return 0;
}
void av_close_input_stream(AVFormatContext *s)
{
    flush_packet_queue(s);
    if (s->iformat->read_close)
       //**s->iformat->read_close(s);** //here fixed --> 
       read_close(s);
    avformat_free_context(s);
}