Ticket #2618: wait_for_keyframes_to_enable_p-frames_in_png_ee30cda.patch

File wait_for_keyframes_to_enable_p-frames_in_png_ee30cda.patch, 1.2 KB (added by Thilo Borgmann, 13 years ago)

Patch for the old revision where the bug was introduced.

  • libavcodec/pngdec.c

    diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
    index bf719b2..0eac775 100644
    a b typedef struct PNGDecContext {  
    5050    int channels;
    5151    int bits_per_pixel;
    5252    int bpp;
     53    int has_keyframe;
    5354
    5455    uint8_t *image_buf;
    5556    int image_linesize;
    static int decode_frame(AVCodecContext *avctx,  
    589590        }
    590591    }
    591592 exit_loop:
    592      /* handle p-frames only if a predecessor frame is available */
     593     /* handle p-frames only if a predecessor frame is available
     594        and keyframes have been indicated in the past */
     595
     596    if (avpkt->flags & PKT_FLAG_KEY) {
     597        s->has_keyframe = 1;
     598    }
     599
    593600     if(s->last_picture->data[0] != NULL) {
    594          if(!(avpkt->flags & PKT_FLAG_KEY)) {
     601         if(!(avpkt->flags & PKT_FLAG_KEY) && s->has_keyframe) {
    595602            int i, j;
    596603            uint8_t *pd = s->current_picture->data[0];
    597604            uint8_t *pd_last = s->last_picture->data[0];
    static av_cold int png_dec_init(AVCodecContext *avctx){  
    630637    avcodec_get_frame_defaults(&s->picture2);
    631638    dsputil_init(&s->dsp, avctx);
    632639
     640    s->has_keyframe = 0;
     641
    633642    return 0;
    634643}
    635644