[mythtv] [PATCH] generic libavformat seek support (4)

John P Poet jppoet at gmail.com
Thu May 12 02:29:28 UTC 2005


On 5/9/05, Mark Spieth <mark at dclabs.com.au> wrote:
>  
> here's version 4 
> found a bug in avidec.c that calculates duration incorrectly. ffmpeg people
> should probably be notified. 
> durations should now be correct. 
> may be other bugs but need to sleep now so perhaps some feedback will help
> me continue tomorrow. 
> also fixed in this patch is the timestamp wraparound problem which has
> alwasy haunted us. 
> basically it subtracts the starttime from the pts/dts values before
> normalization. seems to work with my problem file. 
> note dvb wraps every 26hrs approx. 2^33/90000 
> still issues with keyframes after seek I think, but Ill attack them
> tomorrow. 
> no mpeg2 tested as yet. sorry john. 
> cheers 
> mark 
> _______________________________________________

Hi Mark,

I tried version 4.  For my imported AVI files it works pretty well.

Unfortunately, mythfrontend segfaults if I try to play one of my HD
mpeg2 files recorded using my HD-3000 card.  Without this patch
applied, those files play just fine.

The segfault happens at line 1571 in libs/libavformat/utils.c:

  1555	    for(;;) {
  1556	        if (read_size >= DURATION_MAX_READ_SIZE)
  1557	            break;
  1558	        /* if all info is available, we can stop */
  1559	        for(i = 0;i < ic->nb_streams; i++) {
  1560	            st = ic->streams[i];
  1561	            if (st->start_time == AV_NOPTS_VALUE)
  1562	                break;
  1563	        }
  1564	        if (i == ic->nb_streams)
  1565	            break;
  1566	
  1567	        ret = av_read_packet(ic, pkt);
  1568	        if (ret != 0)
  1569	            break;
  1570	        read_size += pkt->size;
  1571	        st = ic->streams[pkt->stream_index];
  1572	        if (pkt->pts != AV_NOPTS_VALUE) {
  1573	            if (st->start_time == AV_NOPTS_VALUE)
  1574	                st->start_time = av_rescale(pkt->pts,
st->time_base.num * (int64_t)AV_TIME_BASE, st->time_base.den);
  1575	        }
  1576	        av_free_packet(pkt);
  1577	    }
  1578	
  1579	    /* we compute the minimum start_time and use it as default */
  1580	    start_time = MAXINT64;
  1581	    for(i = 0; i < ic->nb_streams; i++) {

(gdb) print ic
$1 = (AVFormatContext *) 0x82bbcd0
(gdb) print pkt
$2 = (AVPacket *) 0xb10afc70
(gdb) print pkt->stream_index
$3 = 851968

I am guessing that ic->streams does not have 851968 elements in it.

If I can do anything else to help you diagnose this, please let me know.

Thanks,

John


More information about the mythtv-dev mailing list