shithub: treason

Download patch

ref: 970595a58461c94175a7ee6d85a2892477508f38
parent: 259ee29d6ed2c083e621f3ddf2edb0c191fbd83a
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Sun Dec 13 14:48:33 EST 2020

h264: few cosmetic changes after mcfs ebml timestamping has been fixed

--- a/decoder_h264.c
+++ b/decoder_h264.c
@@ -46,12 +46,12 @@
 {
 	int i, firstvalid;
 
-	if(a->npics && a->ctx.pLastDecPicInfo->pPreviousDecodedPictureInDpb && a->ctx.pLastDecPicInfo->pPreviousDecodedPictureInDpb->bNewSeqBegin){
+	if(a->ctx.pLastDecPicInfo->pPreviousDecodedPictureInDpb && a->ctx.pLastDecPicInfo->pPreviousDecodedPictureInDpb->bNewSeqBegin){
 		a->lastgopremain = a->npics;
 
 		for(i = 0; i <= a->lbufpicind; i++)
 			a->pics[i].bLastGOP = a->pics[i].iPOC > IMinInt32;
-	}else if(a->npics > 0){
+	}else{
 		for(i = 0; i <= a->lbufpicind; i++){
 			if(a->pics[i].iPOC == a->ctx.pSliceHeader->iPicOrderCntLsb){
 				a->lastgopremain = a->npics;
@@ -137,7 +137,7 @@
 			}
 		}
 	}
-	if(a->minpoc > IMinInt32 && (a->lastwritten > IMinInt32 && a->minpoc - a->lastwritten <= 1) || a->minpoc < a->ctx.pSliceHeader->iPicOrderCntLsb){//a->pics[a->lastbuffered].iPOC){
+	if(a->minpoc > IMinInt32 && ((a->lastwritten > IMinInt32 && a->minpoc - a->lastwritten <= 1) || a->minpoc < a->ctx.pSliceHeader->iPicOrderCntLsb)){
 		a->lastwritten = a->minpoc;
 		memmove(&a->info, &a->pics[a->picind].sBufferInfo, sizeof (SBufferInfo));
 		a->data[0] = a->info.pDst[0];
@@ -184,7 +184,7 @@
 				continue;
 		}
 
-		if(sf.timestamp < lasttimestamp) /* in case frames AREN'T reordered (mcfs HAS to do that) */
+		if(sf.timestamp < lasttimestamp) /* this is not supposed to happen unless mcfs is wrong */
 			continue;
 		w = a->info.UsrData.sSystemBuffer.iWidth;
 		h = a->info.UsrData.sSystemBuffer.iHeight;
@@ -209,6 +209,8 @@
 	}
 	if(res != 0)
 		fprint(2, "h264: %r\n");
+
+	/* FIXME the frames are finished but there might still be left-overs */
 
 done:
 	WelsEndDecoder(&a->ctx);