﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc	mlocked
12146	In progress recordings do not always have up to date size/duration	JYA	jpoet	"MythPlayer keeps internally the total number of frames of the video being played and its duration.

Those two values will be updated when the position map is updated by the decoder, when it finds an inconsistencies between the position being played and its size.

When the position map is updated, the decoder will call back MythPlayer::SetFileLength is called.

MythPlayer itself can force an update to the position map when calling TranslatePositionFrameToMs or TranslatePositionMsToFrame.

this will call DecoderBase::TranslatePositionFrameToMs which in turn will check that the position map has information required. If not it will force a call to SyncPositionMap() which in turn will call back MythPlayer::SetFileLength

There is an issue however, in that from time to time, a call to TranslatePositionFrameToMs with a total frame count that is completely inaccurate doesn't trigger a call to SyncPositionMap() which results in an incorrect calculated value.

This cause failure to seek in an in progress recording (or last liveTV program).

Why would the position map not be refreshed when you attempt to seek into a position is the core issue.

Right now, I've added some workaround in places that required an up to date value of MythPlayer::totalFrames: in MythPlayer::CalcMaxFFTime and MythPlayer::FindFrame
but I feel that this is just a dirty work around, and that earlier call to TranslatePositionFrameToMs and TranslatePositionFrameToMs should have forced an update...

To test, attached is a patch that makes the backend records 3 minutes recordings in liveTV.

To test, start liveTV and let it go until it jumps to the next program (it will occur before 3 minutes). Make sure you are playing live (within a few seconds of the actual end position). After about a minute rewind.

In MythPlayer::Rewind()
have a breakpoint on
{{{
        float current = ComputeSecs(framesPlayed, true);
}}}

You can verify here that framesPlayed is superior to totalFrames , which signal an inconsistency.

ComputeSecs calls TranslatePositionFrameToMs, which should force an update to the position map. but it doesn't

"	Developer Task	closed	minor	0.27	MythTV - Video Playback	Unspecified	medium	fixed			0
