]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
subscriptions: reporting of subs output caused passthru streams to crash
authorAdam Sutton <dev@adamsutton.me.uk>
Thu, 12 Sep 2013 21:48:22 +0000 (22:48 +0100)
committerAdam Sutton <dev@adamsutton.me.uk>
Thu, 12 Sep 2013 21:48:22 +0000 (22:48 +0100)
I had forgotten that MPEGTS passes raw pktbuf not pkt and so was attempting
to incorrectly extract the length and causing it to crash.

src/dvr/dvr_rec.c
src/webui/webui.c

index ba1e880c3945d056559be733e1fb7396f0c8db28..a9bfd8738685f8266e891732cc5a6d312cec0244 100644 (file)
@@ -424,10 +424,14 @@ dvr_thread(void *aux)
       continue;
     }
 
-    if (de->de_s && started &&
-        (sm->sm_type == SMT_PACKET || sm->sm_type == SMT_MPEGTS)) {
-      th_pkt_t *pkt = sm->sm_data;
-      atomic_add(&de->de_s->ths_bytes_out, pktbuf_len(pkt->pkt_payload));
+    if (de->de_s && started) {
+      pktbuf_t *pb = NULL;
+      if (sm->sm_type == SMT_PACKET)
+        pb = ((th_pkt_t*)sm->sm_data)->pkt_payload;
+      else if (sm->sm_type == SMT_MPEGTS)
+        pb = sm->sm_data;
+      if (pb)
+        atomic_add(&de->de_s->ths_bytes_out, pktbuf_len(pb));
     }
 
     TAILQ_REMOVE(&sq->sq_queue, sm, sm_link);
index 85fd8161d74d8800315ea880acf690a2880b70a2..7636d3a32aec13f1a2cb79902aee27004e3f38d0 100644 (file)
@@ -274,9 +274,13 @@ http_stream_run(http_connection_t *hc, streaming_queue_t *sq,
     case SMT_MPEGTS:
     case SMT_PACKET:
       if(started) {
-        th_pkt_t *pkt = sm->sm_data;
-        atomic_add(&s->ths_bytes_out, pktbuf_len(pkt->pkt_payload));
-        muxer_write_pkt(mux, sm->sm_type, pkt);
+        pktbuf_t *pb;;
+        if (sm->sm_type == SMT_PACKET)
+          pb = ((th_pkt_t*)sm->sm_data)->pkt_payload;
+        else
+          pb = sm->sm_data;
+        atomic_add(&s->ths_bytes_out, pktbuf_len(pb));
+        muxer_write_pkt(mux, sm->sm_type, sm->sm_data);
         sm->sm_data = NULL;
       }
       break;