Mercurial > libavformat.hg
diff nut.c @ 708:d79164865a7c libavformat
more fine grained discarding of packets
author | michael |
---|---|
date | Thu, 17 Mar 2005 01:25:01 +0000 |
parents | 2f5f4578a076 |
children | ee513d354673 |
line wrap: on
line diff
--- a/nut.c Wed Mar 16 19:11:58 2005 +0000 +++ b/nut.c Thu Mar 17 01:25:01 2005 +0000 @@ -1222,14 +1222,18 @@ static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code, int frame_type, int64_t frame_start){ AVFormatContext *s= nut->avf; ByteIOContext *bc = &s->pb; - int size, stream_id, key_frame; - int64_t pts; + int size, stream_id, key_frame, discard; + int64_t pts, last_IP_pts; size= decode_frame_header(nut, &key_frame, &pts, &stream_id, frame_code, frame_type, frame_start); if(size < 0) return -1; - if(s->streams[ stream_id ]->discard){ + discard= s->streams[ stream_id ]->discard; + last_IP_pts= s->streams[ stream_id ]->last_IP_pts; + if( (discard >= AVDISCARD_NONKEY && !key_frame) + ||(discard >= AVDISCARD_BIDIR && last_IP_pts != AV_NOPTS_VALUE && last_IP_pts > pts) + || discard >= AVDISCARD_ALL){ url_fskip(bc, size); return 1; }