mirror of
				https://github.com/vdr-projects/vdr.git
				synced 2025-03-01 10:50:46 +00:00 
			
		
		
		
	Additional 'emergency exit' in case channel switching doesn't work several times in a row
This commit is contained in:
		
							
								
								
									
										5
									
								
								HISTORY
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								HISTORY
									
									
									
									
									
								
							| @@ -534,7 +534,10 @@ Video Disk Recorder Revision History | ||||
| - No longer getting stuck when a channel doesn't sync while switching | ||||
|   with the 'Up' and 'Down' keys. | ||||
|  | ||||
| 2001-06-27: Version 0.84 | ||||
| 2001-07-12: Version 0.84 | ||||
|  | ||||
| - Fixed video packet scanning to make it recognize the whole range of | ||||
|   allowed video packet ids. | ||||
| - Added an additional "emergency exit" in case channel switching doesn't | ||||
|   work several times in a row (when will the driver finally become stable | ||||
|   enough to allow rock solid channel switching??). | ||||
|   | ||||
							
								
								
									
										4
									
								
								dvbapi.c
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								dvbapi.c
									
									
									
									
									
								
							| @@ -4,7 +4,7 @@ | ||||
|  * See the main source file 'vdr.c' for copyright information and | ||||
|  * how to reach the author. | ||||
|  * | ||||
|  * $Id: dvbapi.c 1.81 2001/06/27 08:32:32 kls Exp $ | ||||
|  * $Id: dvbapi.c 1.82 2001/06/27 11:34:17 kls Exp $ | ||||
|  */ | ||||
|  | ||||
| #include "dvbapi.h" | ||||
| @@ -2222,6 +2222,8 @@ bool cDvbApi::SetChannel(int ChannelNumber, int FrequencyMHz, char Polarization, | ||||
|  | ||||
|   if (!ChannelSynced) { | ||||
|      esyslog(LOG_ERR, "ERROR: channel %d not sync'ed!", ChannelNumber); | ||||
|      if (this == PrimaryDvbApi) | ||||
|         cThread::RaisePanic(); | ||||
|      return false; | ||||
|      } | ||||
|  | ||||
|   | ||||
							
								
								
									
										23
									
								
								thread.c
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								thread.c
									
									
									
									
									
								
							| @@ -4,7 +4,7 @@ | ||||
|  * See the main source file 'vdr.c' for copyright information and | ||||
|  * how to reach the author. | ||||
|  * | ||||
|  * $Id: thread.c 1.8 2001/05/25 09:37:00 kls Exp $ | ||||
|  * $Id: thread.c 1.9 2001/06/27 11:34:41 kls Exp $ | ||||
|  */ | ||||
|  | ||||
| #include "thread.h" | ||||
| @@ -47,6 +47,8 @@ void cMutex::Unlock(void) | ||||
| // The signal handler is necessary to be able to use SIGIO to wake up any | ||||
| // pending 'select()' call. | ||||
|  | ||||
| time_t cThread::lastPanic = 0; | ||||
| int cThread::panicLevel = 0; | ||||
| bool cThread::signalHandlerInstalled = false; | ||||
| bool cThread::emergencyExitRequested = false; | ||||
|  | ||||
| @@ -139,6 +141,25 @@ void cThread::WakeUp(void) | ||||
|   kill(parentPid, SIGIO); // makes any waiting 'select()' call return immediately | ||||
| } | ||||
|  | ||||
| #define MAXPANICLEVEL 10 | ||||
|  | ||||
| void cThread::RaisePanic(void) | ||||
| { | ||||
|   if (lastPanic > 0) { | ||||
|      if (time(NULL) - lastPanic < 5) | ||||
|         panicLevel++; | ||||
|      else if (panicLevel > 0) | ||||
|         panicLevel--; | ||||
|      } | ||||
|   lastPanic = time(NULL); | ||||
|   if (panicLevel > MAXPANICLEVEL) { | ||||
|      esyslog(LOG_ERR, "ERROR: max. panic level exceeded"); | ||||
|      EmergencyExit(true); | ||||
|      } | ||||
|   else | ||||
|      dsyslog(LOG_INFO, "panic level: %d", panicLevel); | ||||
| } | ||||
|  | ||||
| bool cThread::EmergencyExit(bool Request) | ||||
| { | ||||
|   if (!Request) | ||||
|   | ||||
							
								
								
									
										5
									
								
								thread.h
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								thread.h
									
									
									
									
									
								
							| @@ -4,7 +4,7 @@ | ||||
|  * See the main source file 'vdr.c' for copyright information and | ||||
|  * how to reach the author. | ||||
|  * | ||||
|  * $Id: thread.h 1.5 2001/05/25 09:36:27 kls Exp $ | ||||
|  * $Id: thread.h 1.6 2001/06/27 11:22:04 kls Exp $ | ||||
|  */ | ||||
|  | ||||
| #ifndef __THREAD_H | ||||
| @@ -33,6 +33,8 @@ private: | ||||
|   pid_t parentPid, threadPid, lockingPid; | ||||
|   int locked; | ||||
|   bool running; | ||||
|   static time_t lastPanic; | ||||
|   static int panicLevel; | ||||
|   static bool emergencyExitRequested; | ||||
|   static bool signalHandlerInstalled; | ||||
|   static void SignalHandler(int signum); | ||||
| @@ -48,6 +50,7 @@ public: | ||||
|   virtual ~cThread(); | ||||
|   bool Start(void); | ||||
|   bool Active(void); | ||||
|   static void RaisePanic(void); | ||||
|   static bool EmergencyExit(bool Request = false); | ||||
|   }; | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user