Revision 9ebb8e11 libavcodec/mpegvideo.c

View differences:

libavcodec/mpegvideo.c
902 902
    s->mpeg_quant= avctx->mpeg_quant;
903 903
    s->rtp_mode= !!avctx->rtp_payload_size;
904 904
    s->intra_dc_precision= avctx->intra_dc_precision;
905
    s->user_specified_pts = AV_NOPTS_VALUE;
905 906

  
906 907
    if (s->gop_size <= 1) {
907 908
        s->intra_only = 1;
......
1962 1963
    copy_picture_attributes(s, pic, pic_arg);
1963 1964
    
1964 1965
    pic->display_picture_number= s->input_picture_number++;
1966
 
1965 1967
    if(pic->pts != AV_NOPTS_VALUE){ 
1966
        s->user_specified_pts= pic->pts;
1968
        if(s->user_specified_pts != AV_NOPTS_VALUE){
1969
            int64_t time= av_rescale(pic->pts, s->avctx->frame_rate, s->avctx->frame_rate_base*(int64_t)AV_TIME_BASE);
1970
            int64_t last= av_rescale(s->user_specified_pts, s->avctx->frame_rate, s->avctx->frame_rate_base*(int64_t)AV_TIME_BASE);
1971
        
1972
            if(time <= last){            
1973
                av_log(s->avctx, AV_LOG_ERROR, "Error, Invalid timestamp=%Ld, last=%Ld\n", pic->pts, s->user_specified_pts);
1974
                return -1;
1975
            }
1976
        }
1967 1977
    }else{
1968
        if(s->user_specified_pts){
1978
        if(s->user_specified_pts != AV_NOPTS_VALUE){
1969 1979
            pic->pts= s->user_specified_pts + AV_TIME_BASE*(int64_t)s->avctx->frame_rate_base / s->avctx->frame_rate;
1970 1980
            av_log(s->avctx, AV_LOG_INFO, "Warning: AVFrame.pts=? trying to guess (%Ld)\n", pic->pts);
1971 1981
        }else{
1972 1982
            pic->pts= av_rescale(pic->display_picture_number*(int64_t)s->avctx->frame_rate_base, AV_TIME_BASE, s->avctx->frame_rate);
1973 1983
        }
1974 1984
    }
1985
    s->user_specified_pts= pic->pts;
1975 1986
  }
1976 1987
  
1977 1988
    /* shift buffer entries */
......
2139 2150

  
2140 2151
    s->picture_in_gop_number++;
2141 2152

  
2142
    load_input_picture(s, pic_arg);
2153
    if(load_input_picture(s, pic_arg) < 0)
2154
        return -1;
2143 2155
    
2144 2156
    select_input_picture(s);
2145 2157
    

Also available in: Unified diff