shithub: mcfs

Download patch

ref: 75b936c2cb56b308248a2249d9c008f9f95fb979
parent: bbba27dbb73cf46b659a707a425be7d8fd8097fe
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Sun Dec 13 14:46:03 EST 2020

ebml: fix wrong placement of timestamp calculation code

--- a/ebml.c
+++ b/ebml.c
@@ -281,6 +281,7 @@
 	timestampscale = 1000000;
 	e.tracknum = -1;
 	duration = 0;
+	ts = 0;
 	for(isebml = 0; left != 0;){
 		if(id == 0x9b)
 			te.blockdur *= timestampscale;
@@ -425,10 +426,10 @@
 					break;
 				}
 
-				/* ns timestamp */
-				ts = (timestamp + (s16int)(buf[0]<<8 | buf[1])) * timestampscale - te.codec.delay;
 				if(te.fpacket(&out, &te, packets, npackets, ts) != 0)
 					goto err;
+				/* ns timestamp */
+				ts = (timestamp + (s16int)(buf[0]<<8 | buf[1])) * timestampscale - te.codec.delay;
 				continue;
 			}
 		}else{