diff recpt1/tssplitter_lite.c @ 125:a910b49dfbee

work in progress improvement: - fix bugs around cond_timedwait - try to avoid sticking in PMT analysis
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Tue, 21 Feb 2012 15:46:04 +0900
parents 38091ff0c8ed
children 8e0f7191b92e
line wrap: on
line diff
--- a/recpt1/tssplitter_lite.c	Thu Feb 16 13:11:38 2012 +0900
+++ b/recpt1/tssplitter_lite.c	Tue Feb 21 15:46:04 2012 +0900
@@ -227,7 +227,7 @@
 		// PAT
 		if(0x0000 == pid) {
 			result = AnalyzePat(sp, sbuf->data + index);
-			if(TSS_SUCCESS != result) {
+			if(result != TSS_SUCCESS) {
 				/* 下位の関数内部でmalloc error発生 */
 				return result;
 			}
@@ -238,7 +238,10 @@
 		 * 残すべきPCR/AUDIO/VIDEO PIDを取得する */
 		if(sp->pmt_pids[pid] == 1) {
 			/* この中にはPMT毎に一度しか入らないようにしておく */
-			AnalyzePmt(sp, sbuf->data + index);
+			result = AnalyzePmt(sp, sbuf->data + index);
+			if(result != TSS_SUCCESS) {
+				return result;
+			}
 			sp->pmt_pids[pid]++;
 			sp->pmt_counter += 1;
 		}
@@ -587,6 +590,7 @@
 	unsigned char N;
 	int pcr;
 	int epid;
+	int retry_count = 0;
 
 	Nall = ((buf[6] & 0x0F) << 4) + buf[7];
 	if(Nall > LENGTH_PACKET)
@@ -627,6 +631,10 @@
 			sp->pids[epid] = 1;
 		}
 		N += 4 + (((buf[N + 3]) & 0x0F) << 4) + buf[N + 4] + 1;
+		retry_count++;
+		if(retry_count > Nall) {
+			return TSS_ERROR;
+		}
 	}
 
 	return TSS_SUCCESS;