comparison utils.c @ 6158:4d1d3e0ba6d7 libavformat

Fix failure in av_read_frame on timestamp rollover. Patch by Stephen Dredge, sdredge A tpg com au
author cehoyos
date Tue, 22 Jun 2010 08:48:28 +0000
parents 3877522243ec
children 4fc5e0e4e1cd
comparison
equal deleted inserted replaced
6157:f403b7c0e51b 6158:4d1d3e0ba6d7
1187 pktl = s->packet_buffer; 1187 pktl = s->packet_buffer;
1188 if (pktl) { 1188 if (pktl) {
1189 AVPacket *next_pkt= &pktl->pkt; 1189 AVPacket *next_pkt= &pktl->pkt;
1190 1190
1191 if(genpts && next_pkt->dts != AV_NOPTS_VALUE){ 1191 if(genpts && next_pkt->dts != AV_NOPTS_VALUE){
1192 int wrap_bits = s->streams[next_pkt->stream_index]->pts_wrap_bits;
1192 while(pktl && next_pkt->pts == AV_NOPTS_VALUE){ 1193 while(pktl && next_pkt->pts == AV_NOPTS_VALUE){
1193 if( pktl->pkt.stream_index == next_pkt->stream_index 1194 if( pktl->pkt.stream_index == next_pkt->stream_index
1194 && next_pkt->dts < pktl->pkt.dts 1195 && (0 > av_compare_mod(next_pkt->dts, pktl->pkt.dts, 2LL << (wrap_bits - 1)))
1195 && pktl->pkt.pts != pktl->pkt.dts //not b frame 1196 && av_compare_mod(pktl->pkt.pts, pktl->pkt.dts, 2LL << (wrap_bits - 1))) { //not b frame
1196 /*&& pktl->pkt.dts != AV_NOPTS_VALUE*/){
1197 next_pkt->pts= pktl->pkt.dts; 1197 next_pkt->pts= pktl->pkt.dts;
1198 } 1198 }
1199 pktl= pktl->next; 1199 pktl= pktl->next;
1200 } 1200 }
1201 pktl = s->packet_buffer; 1201 pktl = s->packet_buffer;