From: Jaroslav Kysela Date: Mon, 20 Nov 2017 16:21:52 +0000 (+0100) Subject: dvbcam: use better check for the concurrent service decoding X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=eaa7bf56b293f0a861d6c317632f09da0ff47a9e;p=thirdparty%2Ftvheadend.git dvbcam: use better check for the concurrent service decoding --- diff --git a/src/descrambler/dvbcam.c b/src/descrambler/dvbcam.c index 480743fbc..3bc514e96 100644 --- a/src/descrambler/dvbcam.c +++ b/src/descrambler/dvbcam.c @@ -39,6 +39,7 @@ typedef struct dvbcam_active_cam { linuxdvb_ca_t *ca; uint8_t slot; int active_programs; + int allocated_programs; } dvbcam_active_cam_t; typedef struct dvbcam_active_service { @@ -316,6 +317,7 @@ dvbcam_service_destroy(th_descrambler_t *td) if (as->ac == ac) ac->active_programs--; } + ac->allocated_programs--; mpegts_pid_done(&as->ecm_pids); mpegts_pid_done(&as->cat_pids); free(as->cat_data); @@ -403,7 +405,7 @@ dvbcam_service_start(caclient_t *cac, service_t *t) TAILQ_FOREACH(ac, &dvbcam_active_cams, global_link) if (dvbcam_ca_lookup(ac, ((mpegts_service_t *)t)->s_dvb_active_input, c->caid)) { /* limit the concurrent service decoders per CAM */ - if (dc->limit > 0 && ac->active_programs <= dc->limit) + if (dc->limit > 0 && ac->allocated_programs <= dc->limit) continue; #if ENABLE_DDCI @@ -423,6 +425,8 @@ end_of_search_for_cam: if ((as = calloc(1, sizeof(*as))) == NULL) goto end; + ac->allocated_programs++; + as->ac = ac; as->caid = c->caid; mpegts_pid_init(&as->ecm_pids);