Ticket #4925: attempt_resolve_crashes_after_removing_streams.diff

File attempt_resolve_crashes_after_removing_streams.diff, 1.9 KB (added by skamithi, 16 years ago)
  • libmythtv/avformatdecoder.cpp

     
    19941994        AVStream *st = ic->streams[i];
    19951995        if (st->codec->codec_type == CODEC_TYPE_AUDIO)
    19961996        {
     1997            avcodec_flush_buffers(st->codec);
    19971998            av_remove_stream(ic, st->id, 0);
    19981999            i--;
    19992000        }
    20002001        else
    20012002            i++;
    20022003    }
    2003     av_read_frame_flush(ic);
    20042004}
    20052005
    20062006void release_avf_buffer(struct AVCodecContext *c, AVFrame *pic)
  • libavcodec/utils.c

     
    12691269
    12701270void avcodec_flush_buffers(AVCodecContext *avctx)
    12711271{
    1272     if(avctx->codec->flush)
     1272    if(avctx->codec && avctx->codec->flush)
    12731273        avctx->codec->flush(avctx);
    12741274}
    12751275
  • libavformat/utils.c

     
    581581    *pnum = 0;
    582582    *pden = 0;
    583583
    584     if (!st || !st->codec)
     584    if (!st || !st->codec || !pc)
    585585        return;
    586586   
    587587    switch(st->codec->codec_type) {
     
    690690    }
    691691
    692692    /* do we have a video B frame ? */
    693     delay= st->codec->has_b_frames;
     693    delay= (pc) ? st->codec->has_b_frames : 0;
    694694    presentation_delayed = 0;
    695695    /* XXX: need has_b_frame, but cannot get it if the codec is
    696696        not initialized */
     
    765765//    av_log(NULL, AV_LOG_ERROR, "OUTdelayed:%d/%d pts:%"PRId64", dts:%"PRId64" cur_dts:%"PRId64"\n", presentation_delayed, delay, pkt->pts, pkt->dts, st->cur_dts);
    766766
    767767    /* update flags */
    768     if(is_intra_only(st->codec))
     768    if(pc && is_intra_only(st->codec))
    769769        pkt->flags |= PKT_FLAG_KEY;
    770770    else if (pc) {
    771771        pkt->flags = 0;