]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
mkvmuxer: fix DVBSUB packets reordering
authorJaroslav Kysela <perex@perex.cz>
Sat, 29 Apr 2017 08:16:55 +0000 (10:16 +0200)
committerJaroslav Kysela <perex@perex.cz>
Sat, 29 Apr 2017 08:16:55 +0000 (10:16 +0200)
src/muxer/muxer_mkv.c
src/packet.c
src/packet.h

index 522f1ca58219ebb180dd4fb53695701dd9784d72..effb2d41d0af6e7bb3d943dff75c37bc7a5de6e6 100644 (file)
@@ -1127,10 +1127,10 @@ mk_mux_write_pkt(mk_muxer_t *mk, th_pkt_t *pkt)
   mark = 0;
   if(SCT_ISAUDIO(pkt->pkt_type)) {
     while ((opkt = pktref_first(&mk->holdq)) != NULL) {
-      if (pts_diff(opkt->pkt_pts, pkt->pkt_pts) > 90000)
+      if (pts_diff(pkt->pkt_pts, opkt->pkt_pts) > 90000)
         break;
       opkt = pktref_get_first(&mk->holdq);
-      tvhtrace(LS_MKV, "hold push, pts %"PRId64"\n", opkt->pkt_pts);
+      tvhtrace(LS_MKV, "hold push, pts %"PRId64", audio pts %"PRId64"\n", opkt->pkt_pts, pkt->pkt_pts);
       tpkt = pkt_copy_shallow(opkt);
       pkt_ref_dec(opkt);
       tpkt->pkt_pcr = tpkt->pkt_pts;
@@ -1474,6 +1474,8 @@ mkv_muxer_destroy(muxer_t *m)
   mk_muxer_t *mk = (mk_muxer_t*)m;
   mk_chapter_t *ch;
 
+  pktref_clear_queue(&mk->holdq);
+
   while((ch = TAILQ_FIRST(&mk->chapters)) != NULL) {
     TAILQ_REMOVE(&mk->chapters, ch, link);
     free(ch);
index bb23ef1e4f5548bf7e80beb7e6b999822782dc18..08b59ba76a27a7fc8c4839aac39ac7bb19b32297 100644 (file)
@@ -247,6 +247,20 @@ pktref_remove(struct th_pktref_queue *q, th_pktref_t *pr)
   }
 }
 
+/**
+ *
+ */
+th_pkt_t *
+pktref_first(struct th_pktref_queue *q)
+{
+  th_pktref_t *pr;
+
+  pr = TAILQ_FIRST(q);
+  if (pr)
+    return pr->pr_pkt;
+  return NULL;
+}
+
 /**
  *
  */
index c3e6e5716b9a0a4917a0af3faaa78ba2e4f5283e..e32182815585b78295553d0834ab331412e8e883 100644 (file)
@@ -117,8 +117,7 @@ void pktref_enqueue_sorted(struct th_pktref_queue *q, th_pkt_t *pkt,
 
 void pktref_remove(struct th_pktref_queue *q, th_pktref_t *pr);
 
-static inline th_pkt_t *pktref_first(struct th_pktref_queue *q)
-  { return (th_pkt_t *)TAILQ_FIRST(q); }
+th_pkt_t *pktref_first(struct th_pktref_queue *q);
 
 th_pkt_t *pktref_get_first(struct th_pktref_queue *q);