shithub: libtags

Download patch

ref: 18e35dc31ede2965080fc4634b6d1c0c48ab21c7
parent: 3ccb46aa2aa7f4e8e0d28f8924000d0121fb3b69
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Fri Aug 21 04:24:07 EDT 2020

opus: granule positions are 48KHz

--- a/opus.c
+++ b/opus.c
@@ -80,7 +80,7 @@
 				v = memchr(v, 'O', ctx->buf+sz - v - 14);
 				if(v != nil && v[1] == 'g' && v[2] == 'g' && v[3] == 'S' && (v[5] & 4) == 4){ /* last page */
 					uvlong g = leuint(v+6) | (uvlong)leuint(v+10)<<32;
-					ctx->duration = g * 1000 / ctx->samplerate;
+					ctx->duration = g * 1000 / 48000; /* granule positions are always 48KHz */
 					return 0;
 				}
 				if(v != nil)