diff --git a/src/input/mpegts/tvhdhomerun/tvhdhomerun.c b/src/input/mpegts/tvhdhomerun/tvhdhomerun.c index 807aee1b..db4fe02e 100644 --- a/src/input/mpegts/tvhdhomerun/tvhdhomerun.c +++ b/src/input/mpegts/tvhdhomerun/tvhdhomerun.c @@ -388,7 +388,7 @@ void tvhdhomerun_done ( void ) tvh_hardware_t *th, *n; 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) { n = LIST_NEXT(th, th_link); if (idnode_is_instance(&th->th_id, &tvhdhomerun_device_class)) { @@ -399,7 +399,7 @@ void tvhdhomerun_done ( void ) nd = TAILQ_NEXT(d, disc_link); tvhdhomerun_discovery_destroy(d, 1); } - PTHREAD_MUTEX_UNLOCK(&global_lock); + pthread_mutex_unlock(&global_lock); } void diff --git a/src/input/mpegts/tvhdhomerun/tvhdhomerun_frontend.c b/src/input/mpegts/tvhdhomerun/tvhdhomerun_frontend.c index 7421730a..c1ffe27e 100644 --- a/src/input/mpegts/tvhdhomerun/tvhdhomerun_frontend.c +++ b/src/input/mpegts/tvhdhomerun/tvhdhomerun_frontend.c @@ -319,9 +319,9 @@ tvhdhomerun_frontend_monitor_cb( void *aux ) sm.sm_data = &sigstat; 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); - 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); pthread_mutex_destroy(&hfe->hf_input_thread_mutex); - pthread_mutex_destroy(&hfe->hf_input_thread_mutex); - pthread_mutex_destroy(&hfe->hf_mutex); - pthread_mutex_destroy(&hfe->hf_pid_filter_mutex); - pthread_mutex_destroy(&hfe->hf_input_mux_lock); + pthread_mutex_destroy(&hfe->hf_hdhomerun_device_mutex); /* Finish */ 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_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; } diff --git a/src/input/mpegts/tvhdhomerun/tvhdhomerun_private.h b/src/input/mpegts/tvhdhomerun/tvhdhomerun_private.h index 11e28cdc..40344a82 100644 --- a/src/input/mpegts/tvhdhomerun/tvhdhomerun_private.h +++ b/src/input/mpegts/tvhdhomerun/tvhdhomerun_private.h @@ -33,39 +33,12 @@ typedef struct tvhdhomerun_frontend tvhdhomerun_frontend_t; 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 { char *ip_address; /* IP address */ char *friendlyname; char *deviceModel; - char *uuid; - }; struct tvhdhomerun_device @@ -117,7 +90,6 @@ struct tvhdhomerun_frontend */ int hf_tunerNumber; dvb_fe_type_t hf_type; - pthread_mutex_t hf_mutex; // Anything that is used by both input-thread // libhdhomerun objects. struct hdhomerun_device_t *hf_hdhomerun_tuner; @@ -127,8 +99,6 @@ struct tvhdhomerun_frontend int hf_ready; 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.. pthread_t hf_input_thread; 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_terminating; // Used for terminating the input_thread. - // Global lock for the libhdhomerun library since it seems to have some threading-issues. pthread_mutex_t hf_hdhomerun_device_mutex; - /* * Reception */ char hf_pid_filter_buf[1024]; - pthread_mutex_t hf_pid_filter_mutex; gtimer_t hf_monitor_timer; @@ -154,21 +121,15 @@ struct tvhdhomerun_frontend }; - /* * Methods */ void tvhdhomerun_device_init ( void ); - void tvhdhomerun_device_done ( void ); - void tvhdhomerun_device_destroy ( tvhdhomerun_device_t *sd ); - void tvhdhomerun_device_destroy_later( tvhdhomerun_device_t *sd, int after_ms ); - - 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 ); @@ -177,6 +138,4 @@ void tvhdhomerun_frontend_delete ( tvhdhomerun_frontend_t *lfe ); void tvhdhomerun_device_save ( tvhdhomerun_device_t *sd ); void tvhdhomerun_frontend_save ( tvhdhomerun_frontend_t *lfe, htsmsg_t *m ); - - #endif