# HG changeset patch # User cehoyos # Date 1277196508 0 # Node ID 4d1d3e0ba6d760b2c3f2fb31d45d1474aee39ecd # Parent f403b7c0e51b889303f7b4f1d7ab93e7268f35ce Fix failure in av_read_frame on timestamp rollover. Patch by Stephen Dredge, sdredge A tpg com au diff -r f403b7c0e51b -r 4d1d3e0ba6d7 utils.c --- a/utils.c Mon Jun 21 19:41:02 2010 +0000 +++ b/utils.c Tue Jun 22 08:48:28 2010 +0000 @@ -1189,11 +1189,11 @@ AVPacket *next_pkt= &pktl->pkt; if(genpts && next_pkt->dts != AV_NOPTS_VALUE){ + int wrap_bits = s->streams[next_pkt->stream_index]->pts_wrap_bits; while(pktl && next_pkt->pts == AV_NOPTS_VALUE){ if( pktl->pkt.stream_index == next_pkt->stream_index - && next_pkt->dts < pktl->pkt.dts - && pktl->pkt.pts != pktl->pkt.dts //not b frame - /*&& pktl->pkt.dts != AV_NOPTS_VALUE*/){ + && (0 > av_compare_mod(next_pkt->dts, pktl->pkt.dts, 2LL << (wrap_bits - 1))) + && av_compare_mod(pktl->pkt.pts, pktl->pkt.dts, 2LL << (wrap_bits - 1))) { //not b frame next_pkt->pts= pktl->pkt.dts; } pktl= pktl->next;