shithub: mcfs

Download patch

ref: 5dc44497e08df77ed4e7a12981a6a527bf70424e
parent: 75b936c2cb56b308248a2249d9c008f9f95fb979
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Sun Dec 13 15:44:01 EST 2020

ivf: make sure it IS a proper AVC decoder configuration record

--- a/ivf.c
+++ b/ivf.c
@@ -98,13 +98,19 @@
 
 			if(ctx->codec.priv.sz > 0){
 				if(ctx->fmt != FmtAvc1){
-					werrstr("no idea what to do with codec private data");
+					werrstr("no idea what to do with codec private data for non-AVC1");
 					goto err;
 				}
 
 				x = ctx->codec.priv.data;
-				/* FIXME make sure it's actually a proper AVC decoder configuration record */
-				/* FIXME nal unit length: might not be 4 at all times */
+				if(x[0] != 1){
+					werrstr("avc config: invalid version %d", x[0]);
+					goto err;
+				}
+				if((x[4] & 3) != 3){
+					werrstr("avc config: NAL size %d not implemented", (x[4] & 3)+1);
+					goto err;
+				}
 				/* sps */
 				x[0] = 0;
 				x[1] = 0;