Revision d52b4abe libavcodec/mpegvideo.c

View differences:

libavcodec/mpegvideo.c
894 894
        }
895 895
      }
896 896
    }
897
alloc:
897

  
898 898
    if(!s->encoding){
899 899
        /* release non reference frames */
900 900
        for(i=0; i<MAX_PICTURE_COUNT; i++){
......
946 946
        s->current_picture_ptr ? s->current_picture_ptr->data[0] : NULL,
947 947
        s->pict_type, s->dropable);*/
948 948

  
949
    if(s->codec_id != CODEC_ID_H264){
950
        if((s->last_picture_ptr==NULL || s->last_picture_ptr->data[0]==NULL) && s->pict_type!=FF_I_TYPE){
951
            av_log(avctx, AV_LOG_ERROR, "warning: first frame is no keyframe\n");
952
            /* Allocate a dummy frame */
953
            i= ff_find_unused_picture(s, 0);
954
            s->last_picture_ptr= &s->picture[i];
955
            if(ff_alloc_picture(s, s->last_picture_ptr, 0) < 0)
956
                return -1;
957
        }
958
        if((s->next_picture_ptr==NULL || s->next_picture_ptr->data[0]==NULL) && s->pict_type==FF_B_TYPE){
959
            /* Allocate a dummy frame */
960
            i= ff_find_unused_picture(s, 0);
961
            s->next_picture_ptr= &s->picture[i];
962
            if(ff_alloc_picture(s, s->next_picture_ptr, 0) < 0)
963
                return -1;
964
        }
965
    }
966

  
949 967
    if(s->last_picture_ptr) ff_copy_picture(&s->last_picture, s->last_picture_ptr);
950 968
    if(s->next_picture_ptr) ff_copy_picture(&s->next_picture, s->next_picture_ptr);
951 969

  
952
    if(s->pict_type != FF_I_TYPE && (s->last_picture_ptr==NULL || s->last_picture_ptr->data[0]==NULL) && !s->dropable && s->codec_id != CODEC_ID_H264){
953
        av_log(avctx, AV_LOG_ERROR, "warning: first frame is no keyframe\n");
954
        assert(s->pict_type != FF_B_TYPE); //these should have been dropped if we don't have a reference
955
        goto alloc;
956
    }
957

  
958 970
    assert(s->pict_type == FF_I_TYPE || (s->last_picture_ptr && s->last_picture_ptr->data[0]));
959 971

  
960 972
    if(s->picture_structure!=PICT_FRAME && s->out_format != FMT_H264){

Also available in: Unified diff