Commit 52606018 authored by massiot's avatar massiot

* dvb.c: Re-introduce the DVR watchdog since it happens to be effective

   with some DVB-S2 frontends.


git-svn-id: svn://svn.videolan.org/dvblast/trunk@152 55d3f8b6-4a41-4d2d-a900-313d1436a5b8
parent 6565bfc5
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
* Local declarations * Local declarations
*****************************************************************************/ *****************************************************************************/
#define FRONTEND_LOCK_TIMEOUT 30000000 /* 30 s */ #define FRONTEND_LOCK_TIMEOUT 30000000 /* 30 s */
#define DVR_READ_TIMEOUT 30000000 /* 30 s */
#define CA_POLL_PERIOD 100000 /* 100 ms */ #define CA_POLL_PERIOD 100000 /* 100 ms */
#define MAX_READ_ONCE 50 #define MAX_READ_ONCE 50
#define DVR_BUFFER_SIZE 40*188*1024 /* bytes */ #define DVR_BUFFER_SIZE 40*188*1024 /* bytes */
...@@ -60,6 +61,7 @@ ...@@ -60,6 +61,7 @@
static int i_frontend, i_dvr; static int i_frontend, i_dvr;
static fe_status_t i_last_status; static fe_status_t i_last_status;
static mtime_t i_frontend_timeout; static mtime_t i_frontend_timeout;
static mtime_t i_last_packet = 0;
static mtime_t i_ca_next_event = 0; static mtime_t i_ca_next_event = 0;
static block_t *p_freelist = NULL; static block_t *p_freelist = NULL;
...@@ -79,6 +81,8 @@ void dvb_Open( void ) ...@@ -79,6 +81,8 @@ void dvb_Open( void )
msg_Dbg( NULL, "using linux-dvb API version %d", DVB_API_VERSION ); msg_Dbg( NULL, "using linux-dvb API version %d", DVB_API_VERSION );
i_wallclock = mdate();
sprintf( psz_tmp, "/dev/dvb/adapter%d/frontend%d", i_adapter, i_fenum ); sprintf( psz_tmp, "/dev/dvb/adapter%d/frontend%d", i_adapter, i_fenum );
if( (i_frontend = open(psz_tmp, O_RDWR | O_NONBLOCK)) < 0 ) if( (i_frontend = open(psz_tmp, O_RDWR | O_NONBLOCK)) < 0 )
{ {
...@@ -155,7 +159,20 @@ block_t *dvb_Read( mtime_t i_poll_timeout ) ...@@ -155,7 +159,20 @@ block_t *dvb_Read( mtime_t i_poll_timeout )
} }
if ( ufds[0].revents ) if ( ufds[0].revents )
{
p_blocks = DVRRead(); p_blocks = DVRRead();
i_wallclock = mdate();
}
if ( p_blocks != NULL )
i_last_packet = i_wallclock;
else if ( !i_frontend_timeout
&& i_wallclock > i_last_packet + DVR_READ_TIMEOUT )
{
msg_Warn( NULL, "no DVR output, resetting" );
FrontendSet(false);
en50221_Reset();
}
if ( i_ca_handle && i_ca_type == CA_CI_LINK ) if ( i_ca_handle && i_ca_type == CA_CI_LINK )
{ {
...@@ -341,6 +358,7 @@ static void FrontendPoll( void ) ...@@ -341,6 +358,7 @@ static void FrontendPoll( void )
int32_t i_value = 0; int32_t i_value = 0;
msg_Dbg( NULL, "frontend has acquired lock" ); msg_Dbg( NULL, "frontend has acquired lock" );
i_frontend_timeout = 0; i_frontend_timeout = 0;
i_last_packet = i_wallclock;
/* Read some statistics */ /* Read some statistics */
if( ioctl( i_frontend, FE_READ_BER, &i_value ) >= 0 ) if( ioctl( i_frontend, FE_READ_BER, &i_value ) >= 0 )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment