]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Correctly extract PCR
authorAndreas Öman <andreas@lonelycoder.com>
Tue, 17 Nov 2009 21:32:26 +0000 (21:32 +0000)
committerAndreas Öman <andreas@lonelycoder.com>
Tue, 17 Nov 2009 21:32:26 +0000 (21:32 +0000)
Log CC errors

src/tsdemux.c

index 2c27de97087ea19598481b1ca3fa6cedece1a060..8f65b7bb6c9d44ddb8c621266e62f161a3b8f424 100644 (file)
@@ -79,6 +79,13 @@ ts_recv_packet0(th_transport_t *t, th_stream_t *st, uint8_t *tsb)
     cc = tsb[3] & 0xf;
     if(st->st_cc_valid && cc != st->st_cc) {
       /* Incorrect CC */
+
+      tvhlog(LOG_DEBUG, "TS", 
+            "Continuity counter error on %s : %s PID #%d (%s)",
+            t->tht_svcname ?: "???",
+            streaming_component_type2txt(st->st_type),
+            st->st_pid, t->tht_identifier);
+
       avgstat_add(&t->tht_cc_errors, 1, dispatch_clock);
       avgstat_add(&st->st_cc_errors, 1, dispatch_clock);
       err = 1;
@@ -146,11 +153,11 @@ ts_extract_pcr(th_transport_t *t, th_stream_t *st, uint8_t *tsb)
   int64_t real = getmonoclock();
   int64_t pcr, d;
 
-  pcr  = tsb[6] << 25;
-  pcr |= tsb[7] << 17;
-  pcr |= tsb[8] << 9;
-  pcr |= tsb[9] << 1;
-  pcr |= (tsb[10] >> 7) & 0x01;
+  pcr  = (uint64_t)tsb[6] << 25;
+  pcr |= (uint64_t)tsb[7] << 17;
+  pcr |= (uint64_t)tsb[8] << 9;
+  pcr |= (uint64_t)tsb[9] << 1;
+  pcr |= ((uint64_t)tsb[10] >> 7) & 0x01;
   
   pcr = av_rescale_q(pcr, st->st_tb, AV_TIME_BASE_Q);