]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
SAT>IP Client: fix close_pid callback
authorJaroslav Kysela <perex@perex.cz>
Tue, 28 Apr 2015 07:07:29 +0000 (09:07 +0200)
committerJaroslav Kysela <perex@perex.cz>
Tue, 28 Apr 2015 07:07:29 +0000 (09:07 +0200)
src/input/mpegts/satip/satip_frontend.c

index 185f151d1a5e7525e766ddd082881c70aebb6e5a..7087b48b576b3c9e6b485f2e2b2e03fb3272252c 100644 (file)
@@ -596,8 +596,14 @@ satip_frontend_close_pid
   satip_tune_req_t *tr;
   int change = 0, r;
 
+  if (pid < MPEGTS_FULLMUX_PID) {
+    pthread_mutex_lock(&lfe->sf_dvr_lock);
+    change = mpegts_pid_del(&lfe->sf_req->sf_pids, pid, weight) >= 0;
+    pthread_mutex_unlock(&lfe->sf_dvr_lock);
+  }
+
   if ((r = mpegts_input_close_pid(mi, mm, pid, type, weight, owner)) <= 0)
-    return r;
+    return r; /* return here even if change is nonzero - multiple PID subscribers */
 
   /* Skip internal PIDs */
   if (pid > MPEGTS_FULLMUX_PID)
@@ -613,8 +619,6 @@ satip_frontend_close_pid
           change = 1;
         }
       }
-    } else {
-      change = mpegts_pid_del(&tr->sf_pids, pid, weight) >= 0;
     }
     if (change)
       tvh_write(lfe->sf_dvr_pipe.wr, "c", 1);