tvhdhomerun: cleanup mutex'es and remove debugging
This commit is contained in:
parent
b04a02dc93
commit
4fb306670f
3 changed files with 5 additions and 52 deletions
|
@ -388,7 +388,7 @@ void tvhdhomerun_done ( void )
|
||||||
tvh_hardware_t *th, *n;
|
tvh_hardware_t *th, *n;
|
||||||
tvhdhomerun_discovery_t *d, *nd;
|
tvhdhomerun_discovery_t *d, *nd;
|
||||||
|
|
||||||
PTHREAD_MUTEX_LOCK(&global_lock);
|
pthread_mutex_lock(&global_lock);
|
||||||
for (th = LIST_FIRST(&tvh_hardware); th != NULL; th = n) {
|
for (th = LIST_FIRST(&tvh_hardware); th != NULL; th = n) {
|
||||||
n = LIST_NEXT(th, th_link);
|
n = LIST_NEXT(th, th_link);
|
||||||
if (idnode_is_instance(&th->th_id, &tvhdhomerun_device_class)) {
|
if (idnode_is_instance(&th->th_id, &tvhdhomerun_device_class)) {
|
||||||
|
@ -399,7 +399,7 @@ void tvhdhomerun_done ( void )
|
||||||
nd = TAILQ_NEXT(d, disc_link);
|
nd = TAILQ_NEXT(d, disc_link);
|
||||||
tvhdhomerun_discovery_destroy(d, 1);
|
tvhdhomerun_discovery_destroy(d, 1);
|
||||||
}
|
}
|
||||||
PTHREAD_MUTEX_UNLOCK(&global_lock);
|
pthread_mutex_unlock(&global_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -319,9 +319,9 @@ tvhdhomerun_frontend_monitor_cb( void *aux )
|
||||||
sm.sm_data = &sigstat;
|
sm.sm_data = &sigstat;
|
||||||
|
|
||||||
LIST_FOREACH(svc, &hfe->mi_transports, s_active_link) {
|
LIST_FOREACH(svc, &hfe->mi_transports, s_active_link) {
|
||||||
PTHREAD_MUTEX_LOCK(&svc->s_stream_mutex);
|
pthread_mutex_lock(&svc->s_stream_mutex);
|
||||||
streaming_pad_deliver(&svc->s_streaming_pad, &sm);
|
streaming_pad_deliver(&svc->s_streaming_pad, &sm);
|
||||||
PTHREAD_MUTEX_UNLOCK(&svc->s_stream_mutex);
|
pthread_mutex_unlock(&svc->s_stream_mutex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -580,10 +580,7 @@ tvhdhomerun_frontend_delete ( tvhdhomerun_frontend_t *hfe )
|
||||||
TAILQ_REMOVE(&hfe->hf_device->hd_frontends, hfe, hf_link);
|
TAILQ_REMOVE(&hfe->hf_device->hd_frontends, hfe, hf_link);
|
||||||
|
|
||||||
pthread_mutex_destroy(&hfe->hf_input_thread_mutex);
|
pthread_mutex_destroy(&hfe->hf_input_thread_mutex);
|
||||||
pthread_mutex_destroy(&hfe->hf_input_thread_mutex);
|
pthread_mutex_destroy(&hfe->hf_hdhomerun_device_mutex);
|
||||||
pthread_mutex_destroy(&hfe->hf_mutex);
|
|
||||||
pthread_mutex_destroy(&hfe->hf_pid_filter_mutex);
|
|
||||||
pthread_mutex_destroy(&hfe->hf_input_mux_lock);
|
|
||||||
|
|
||||||
/* Finish */
|
/* Finish */
|
||||||
mpegts_input_delete((mpegts_input_t*)hfe, 0);
|
mpegts_input_delete((mpegts_input_t*)hfe, 0);
|
||||||
|
@ -679,8 +676,5 @@ tvhdhomerun_frontend_create(tvhdhomerun_device_t *hd, struct hdhomerun_discover_
|
||||||
pthread_mutex_init(&hfe->hf_input_thread_mutex, NULL);
|
pthread_mutex_init(&hfe->hf_input_thread_mutex, NULL);
|
||||||
pthread_cond_init(&hfe->hf_input_thread_cond, NULL);
|
pthread_cond_init(&hfe->hf_input_thread_cond, NULL);
|
||||||
|
|
||||||
// TODO: Need a better heartbeat, or we will need to recreate the hdhomerun-device if something fails.
|
|
||||||
//gtimer_arm_ms(&hfe->hf_monitor_timer, tvhdhomerun_frontend_monitor_cb, hfe, 1);
|
|
||||||
|
|
||||||
return hfe;
|
return hfe;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,39 +33,12 @@ typedef struct tvhdhomerun_frontend tvhdhomerun_frontend_t;
|
||||||
|
|
||||||
static struct hdhomerun_debug_t* hdhomerun_debug_obj = 0;
|
static struct hdhomerun_debug_t* hdhomerun_debug_obj = 0;
|
||||||
|
|
||||||
// Defines for debugging locks...
|
|
||||||
#if 1
|
|
||||||
|
|
||||||
#define PTHREAD_MUTEX_LOCK(x) \
|
|
||||||
tvhdebug("tvhdhomerun", "lock "#x": %s:%d", __FUNCTION__,__LINE__); \
|
|
||||||
pthread_mutex_lock(x);
|
|
||||||
|
|
||||||
#define PTHREAD_MUTEX_UNLOCK(x) \
|
|
||||||
tvhdebug("tvhdhomerun", "unlock "#x": %s:%d", __FUNCTION__,__LINE__); \
|
|
||||||
pthread_mutex_unlock(x);
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
#define PTHREAD_MUTEX_LOCK(x) \
|
|
||||||
pthread_mutex_lock(x);
|
|
||||||
|
|
||||||
#define PTHREAD_MUTEX_UNLOCK(x) \
|
|
||||||
pthread_mutex_unlock(x);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// static pthread_mutex_t global_hdhomerun_device_mutex = PTHREAD_MUTEX_INITIALIZER;
|
|
||||||
|
|
||||||
|
|
||||||
struct tvhdhomerun_device_info
|
struct tvhdhomerun_device_info
|
||||||
{
|
{
|
||||||
char *ip_address; /* IP address */
|
char *ip_address; /* IP address */
|
||||||
char *friendlyname;
|
char *friendlyname;
|
||||||
char *deviceModel;
|
char *deviceModel;
|
||||||
|
|
||||||
char *uuid;
|
char *uuid;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct tvhdhomerun_device
|
struct tvhdhomerun_device
|
||||||
|
@ -117,7 +90,6 @@ struct tvhdhomerun_frontend
|
||||||
*/
|
*/
|
||||||
int hf_tunerNumber;
|
int hf_tunerNumber;
|
||||||
dvb_fe_type_t hf_type;
|
dvb_fe_type_t hf_type;
|
||||||
pthread_mutex_t hf_mutex; // Anything that is used by both input-thread
|
|
||||||
|
|
||||||
// libhdhomerun objects.
|
// libhdhomerun objects.
|
||||||
struct hdhomerun_device_t *hf_hdhomerun_tuner;
|
struct hdhomerun_device_t *hf_hdhomerun_tuner;
|
||||||
|
@ -127,8 +99,6 @@ struct tvhdhomerun_frontend
|
||||||
int hf_ready;
|
int hf_ready;
|
||||||
int hf_status;
|
int hf_status;
|
||||||
|
|
||||||
pthread_mutex_t hf_input_mux_lock; // Lock to make sure we are not running the input-thread
|
|
||||||
// reader during a mux start/stop.
|
|
||||||
// input thread..
|
// input thread..
|
||||||
pthread_t hf_input_thread;
|
pthread_t hf_input_thread;
|
||||||
pthread_mutex_t hf_input_thread_mutex; /* used in condition signaling */
|
pthread_mutex_t hf_input_thread_mutex; /* used in condition signaling */
|
||||||
|
@ -137,16 +107,13 @@ struct tvhdhomerun_frontend
|
||||||
uint8_t hf_input_thread_running; // Indicates if input_thread is running.
|
uint8_t hf_input_thread_running; // Indicates if input_thread is running.
|
||||||
uint8_t hf_input_thread_terminating; // Used for terminating the input_thread.
|
uint8_t hf_input_thread_terminating; // Used for terminating the input_thread.
|
||||||
|
|
||||||
|
|
||||||
// Global lock for the libhdhomerun library since it seems to have some threading-issues.
|
// Global lock for the libhdhomerun library since it seems to have some threading-issues.
|
||||||
pthread_mutex_t hf_hdhomerun_device_mutex;
|
pthread_mutex_t hf_hdhomerun_device_mutex;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Reception
|
* Reception
|
||||||
*/
|
*/
|
||||||
char hf_pid_filter_buf[1024];
|
char hf_pid_filter_buf[1024];
|
||||||
pthread_mutex_t hf_pid_filter_mutex;
|
|
||||||
|
|
||||||
gtimer_t hf_monitor_timer;
|
gtimer_t hf_monitor_timer;
|
||||||
|
|
||||||
|
@ -154,21 +121,15 @@ struct tvhdhomerun_frontend
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Methods
|
* Methods
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void tvhdhomerun_device_init ( void );
|
void tvhdhomerun_device_init ( void );
|
||||||
|
|
||||||
void tvhdhomerun_device_done ( void );
|
void tvhdhomerun_device_done ( void );
|
||||||
|
|
||||||
void tvhdhomerun_device_destroy ( tvhdhomerun_device_t *sd );
|
void tvhdhomerun_device_destroy ( tvhdhomerun_device_t *sd );
|
||||||
|
|
||||||
void tvhdhomerun_device_destroy_later( tvhdhomerun_device_t *sd, int after_ms );
|
void tvhdhomerun_device_destroy_later( tvhdhomerun_device_t *sd, int after_ms );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
tvhdhomerun_frontend_t *
|
tvhdhomerun_frontend_t *
|
||||||
tvhdhomerun_frontend_create( tvhdhomerun_device_t *hd, struct hdhomerun_discover_device_t *discover_info, htsmsg_t *conf, dvb_fe_type_t type, unsigned int frontend_number );
|
tvhdhomerun_frontend_create( tvhdhomerun_device_t *hd, struct hdhomerun_discover_device_t *discover_info, htsmsg_t *conf, dvb_fe_type_t type, unsigned int frontend_number );
|
||||||
|
|
||||||
|
@ -177,6 +138,4 @@ void tvhdhomerun_frontend_delete ( tvhdhomerun_frontend_t *lfe );
|
||||||
void tvhdhomerun_device_save ( tvhdhomerun_device_t *sd );
|
void tvhdhomerun_device_save ( tvhdhomerun_device_t *sd );
|
||||||
void tvhdhomerun_frontend_save ( tvhdhomerun_frontend_t *lfe, htsmsg_t *m );
|
void tvhdhomerun_frontend_save ( tvhdhomerun_frontend_t *lfe, htsmsg_t *m );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue