[mythtv-commits] Ticket #7397: libav seeking near the start of video is broken

MythTV mythtv at cvs.mythtv.org
Thu Oct 22 16:49:28 UTC 2009

#7397: libav seeking near the start of video is broken
 Reporter:  tralph11@…               |       Owner:  janne  
     Type:  patch                    |      Status:  new    
 Priority:  minor                    |   Milestone:  unknown
Component:  MythTV - Video Playback  |     Version:  head   
 Severity:  medium                   |     Mlocked:  0      
 Using libav seeking to a position near the start when the video has a non-
 zero context start time causes future seeks to be broken. The following
 code in avformatdecoder.cpp is incorrect since the start_time is not zero
 for some videos and is required to correctly calculate the timestamp fed
 to av_seek_frame().

     if (desiredFrame <= 1)
         av_update_cur_dts(ic, st, 0);
         ic->start_time = 0;

 This code appears to have been added because it was assumed that seeking
 to the beginning caused it to return a DTS timestamp toward the end of the
 video. In actuality it sometimes returns a DTS value that is _earlier_
 than the start time. This causes the lsb3full function called later to
 generate an adj_cur_dts value well beyond the end of the video. The fix
 should be to check if the cur_dts is earlier than the context start_time.
 If so, either one of the following changes should work:

  * fix1 -> remove broken code and set the start_time to the current DTS


  * fix2 -> remove broken code and set adj_cur_dts to zero if it's earlier
 than the start time

 I've tested both methods wiht success and no apparent problems. I'm
 attaching both methods to the ticket.

Ticket URL: <http://svn.mythtv.org/trac/ticket/7397>
MythTV <http://www.mythtv.org/>

More information about the mythtv-commits mailing list