]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
dvbcam: use better check for the concurrent service decoding
authorJaroslav Kysela <perex@perex.cz>
Mon, 20 Nov 2017 16:21:52 +0000 (17:21 +0100)
committerJaroslav Kysela <perex@perex.cz>
Mon, 20 Nov 2017 16:22:10 +0000 (17:22 +0100)
src/descrambler/dvbcam.c

index 480743fbc5fb546e53b7677178b1c8fae2f65b31..3bc514e96099b26d9fbd8293f3f7fa1dec4aa114 100644 (file)
@@ -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);