Hi list,
Out of curiosity I've been digging in an old minor bug: Sometimes, on
very short recordings, VDR freezes for a few seconds near the end of
playback. This bug is old, imho it must have been there before 1.2.0.
Based on my dig, the cause is cIndexFile::CatchUp() (recording.c line
1233), and the exact conditions are:
(1) The recording was recorded or cutted less than an hour ago
(2) The recording is shorter than 60s (PAL)
(3) Read ahead reaches end of recording (2-3s before end)
On these conditions, VDR will freeze 8 seconds, looking for changes to
the index.vdr file.
(1) is triggered by if (time(NULL) - buf.st_mtime > MININDEXAGE),
(2) is triggered by if (... || Index > 10 * INDEXSAFETYLIMIT),
(3) is triggered by if (Index < last - (i ? 2 * INDEXSAFETYLIMIT : 0) ||
...).
The whole sleeping stuff seems to be for live pause mode, so playback
doesn't stop instantly and waits for some recorded frames.
For one thing, the test of (3) looks fishy to me. i is a loop index
running from 0 to 8 (seconds), so the condition is (Index < last) on
first loop, and (Index < last - 2 * INDEXSAFETYLIMIT) on all other
loops. In words: On loop 0, exit if not on last frame, on loop 1..8 exit
if less than 12 seconds before end. Does this have to be the other way
round? Or is it intended to sleep only on last frame, and then wait up
to 8 seconds for index file to grow by 12 seconds?
Anyway, this doesn't fix the initial problem. The problem is to detect
whether the recording may still be growing or not. The test on age older
than one hour may be adapted for that, but instead of stopping to check
index.vdr, maybe we should (additionally) exit the loop if index.vdr
exists and is older than 10 seconds?
Cheers,
Udo