[mythtv-commits] Ticket #799: DTV recordings sometimes show doubled recording length

MythTV mythtv at cvs.mythtv.org
Sun Sep 30 16:27:40 UTC 2007

#799: DTV recordings sometimes show doubled recording length
 Reporter:  danielk  |        Owner:  janne   
     Type:  defect   |       Status:  assigned
 Priority:  major    |    Milestone:  0.21    
Component:  mythtv   |      Version:  head    
 Severity:  high     |   Resolution:          
  Mlocked:  0        |  

Comment(by Tom Dexter <digitalaudiorock at hotmail.com>):

 I've been trying to debug this issue myself (actually using the 0.20-fixes
 code that I'm running on my frontend) by adding some verbose playback code
 to NuppelVideoPlayer.cpp, and have discovered a situation that I simply
 can't explain.  I figured I'd post it in case another set of eyes would
 see something I missed.  Just to be clear, since there seem to have been
 several different issues discussed here, I'm talking about the following
 issue: When you're playing a recorded program that's still in the process
 of recording and recording finishes, the total length displayed is
 erroneously doubled.  If you exit playback and play it again, it displays
 correctly from the database.  Note that in my case I reproduced this with
 a 720p HD broadcast recording at 59.94 fps.

 I changed NuppelVideoPlayer::SetFileLength as follows:

 void NuppelVideoPlayer::SetFileLength(int total, int frames)
     totalLength = total;
     totalFrames = frames;
     VERBOSE(VB_PLAYBACK, QString("SetFileLength set: total: %1, frames:


 I also made the following change within NuppelVideoPlayer::calcSliderPos
 to monitor what's being displayed in the OSD and where it's coming from:

     int playbackLen = totalLength;

     if (livetv && livetvchain)
         posInfo.progBefore = livetvchain->HasPrev();
         posInfo.progAfter = livetvchain->HasNext();
         playbackLen = livetvchain->GetLengthAtCurPos();
     else if (watchingrecording && nvr_enc && nvr_enc->IsValidRecorder()) {
         playbackLen =
             (int)(((float)nvr_enc->GetFramesWritten() /
         VERBOSE(VB_PLAYBACK, QString("calcSliderPos: nvr_enc playbackLen:
 %1, video_frame_rate: %2").arg(playbackLen).arg(video_frame_rate));
     } else {
         VERBOSE(VB_PLAYBACK, QString("calcSliderPos: playbackLen: %1,
 video_frame_rate: %2").arg(playbackLen).arg(video_frame_rate));

 I then reproduced the bug with a recording that, when finished, would be
 about 27 minutes long and a bit over 96000 frames (at 59.9401 fps). Before
 it finished recording, the verbose outout when displaying the OSD (by
 pausing or entering 'i') looked fine:

 2007-09-30 10:56:55.605 calcSliderPos: nvr_enc playbackLen: 1432,
 video_frame_rate: 59.9401

 The 1432 seconds (about 24 minutes) was correct at that point.

 When the recording finished and it switched from WatchingRecording to
 WatchingPreRecorded, I got the following output:

 2007-09-30 11:00:01.104 SyncPositionMap prerecorded, from DB: 3206 entries
 2007-09-30 11:00:01.104 SetFileLength set: total: 1604, frames: 96149
 2007-09-30 11:00:01.104 SyncPositionMap, new totframes: 96149, new length:
 1604, posMap size: 3206

 So far, this looked fine as well.  The 1604 seconds and the 96149 frames
 are correct.

 Here's where I get stumpted...without stopping playback, bringin up the
 OSD produced the following:

 2007-09-30 11:00:37.111 calcSliderPos: playbackLen: 3235,
 video_frame_rate: 59.9401
 2007-09-30 11:00:37.375 calcSliderPos: playbackLen: 3235,
 video_frame_rate: 59.9401
 2007-09-30 11:00:37.823 calcSliderPos: playbackLen: 3235,
 video_frame_rate: 59.9401

 ...and the OSD displayed an erroneous total length of over 53 minutes.
 First of all, note that the playbackLen variable is in fact doubled at
 this point.  Also note that this output can only come from a situation
 where the playbackLen is coming directly from the contents of the
 totalLength member variable.

 That's where I hit a brick wall.  This appears to indicate that the
 totalLength member is incorrect at this point, yet there's no sign of
 SetFileLength (the only place I can find that should be setting it)
 setting it incorrectly.

 I figured I'd post this in the hopes it would point someone in the right
 direction to get to the bottom of this old one.

Ticket URL: <http://svn.mythtv.org/trac/ticket/799#comment:26>
MythTV <http://svn.mythtv.org/trac>

More information about the mythtv-commits mailing list