Commit Message
Klaus Schmidinger wrote:
> Klaus Schmidinger wrote:
>
>> Markus Hahn wrote:
>>
>>> Hi there
>>> A full or not available disk causes a endless lopp of TimerStart and
>>> EmergencyExit if a timer is active.
>>>
>>> To avoid this, I added this code to cRecordControls::Start() :
>>> menu.c:3518
>>> bool cRecordControls::Start(cTimer *Timer, bool Pause)
>>> {
>>> ChangeState();
>>> if (!VideoFileSpaceAvailable(300))
>>> {
>>> Skins.Message(mtInfo, tr("No disk space!"));
>>> if (Timer)
>>> Timer->Delete();
>>>
>>> return false;
>>> }
>>>
>>> Now the message pops up endlessly, because the timer is still
>>> aktive??? Any suggestions?
>>
>>
>>
>> Maybe a better place for this would be in the main VDR loop:
>>
>> // Start new recordings:
>> if (VideoFileSpaceAvailable(300)) {
>> cTimer *Timer = Timers.GetMatch(Now);
>> if (Timer) {
>> if (!cRecordControls::Start(Timer))
>> Timer->SetPending(true);
>> else
>> LastTimerChannel = Timer->Channel()->Number();
>> }
>> }
>> else if (/*TimeSinceLastNoDiskSpaceMessageGreaterLimit*/) {
>> Skins.Message(mtWarning, tr("No disk space!"));
>> // reset timeout limit
>> }
>
>
> After some more thinking I believe cRecordControls::Start() actually
> is the better place for this check, since it is called several times.
>
> Please try the attached patch.
Sorry, forgot the attachment...
Klaus
@@ -36,6 +36,8 @@
#define MAXRECORDCONTROLS (MAXDEVICES * MAXRECEIVERS)
#define MAXINSTANTRECTIME (24 * 60 - 1) // 23:59 hours
#define MAXWAITFORCAMMENU 4 // seconds to wait for the CAM menu to open
+#define MINFREEDISK 300 // minimum free disk space required to start recording
+#define NODISKSPACEDELTA 300 // seconds between "Not enough disk space to start recording!" messages
#define CHNUMWIDTH (numdigits(Channels.MaxNumber()) + 1)
@@ -3520,6 +3522,19 @@
bool cRecordControls::Start(cTimer *Timer, bool Pause)
{
+ static time_t LastNoDiskSpaceMessage = 0;
+ int FreeMB = 0;
+ VideoDiskSpace(&FreeMB);
+ if (FreeMB < MINFREEDISK) {
+ if (!Timer || time(NULL) - LastNoDiskSpaceMessage > NODISKSPACEDELTA) {
+ isyslog("not enough disk space to start recording%s%s", Timer ? " timer " : "", Timer ? *Timer->ToDescr() : "");
+ Skins.Message(mtWarning, tr("Not enough disk space to start recording!"));
+ LastNoDiskSpaceMessage = time(NULL);
+ }
+ return false;
+ }
+ LastNoDiskSpaceMessage = 0;
+
ChangeState();
int ch = Timer ? Timer->Channel()->Number() : cDevice::CurrentChannel();
cChannel *channel = Channels.GetByNumber(ch);
@@ -3548,8 +3563,10 @@
}
}
}
- else if (!Timer || (Timer->Priority() >= Setup.PrimaryLimit && !Timer->Pending()))
+ else if (!Timer || (Timer->Priority() >= Setup.PrimaryLimit && !Timer->Pending())) {
isyslog("no free DVB device to record channel %d!", ch);
+ Skins.Message(mtError, tr("No free DVB device to record!"));
+ }
}
else
esyslog("ERROR: channel %d not defined!", ch);
@@ -902,8 +902,6 @@
if (!cControl::Control()) {
if (cRecordControls::Start())
Skins.Message(mtInfo, tr("Recording started"));
- else
- Skins.Message(mtError, tr("No free DVB device to record!"));
key = kNone; // nobody else needs to see this key
}
break;
@@ -947,8 +945,6 @@
case osRecord: DELETE_MENU;
if (cRecordControls::Start())
Skins.Message(mtInfo, tr("Recording started"));
- else
- Skins.Message(mtError, tr("No free DVB device to record!"));
break;
case osRecordings:
DELETE_MENU;