From d46cfee72d7a4f22924dfb8feebbd28651d1695f Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Mon, 11 Nov 2013 14:04:59 +0400 Subject: [PATCH] driver/record.cpp: save added pids from pmt update; add safe-check for max pids recorded Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/545f1dee6adcb5d990ad644cc60fab62d9527e12 Author: [CST] Focus Date: 2013-11-11 (Mon, 11 Nov 2013) --- src/driver/record.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/driver/record.cpp b/src/driver/record.cpp index d9541c3bf..c10d2e924 100644 --- a/src/driver/record.cpp +++ b/src/driver/record.cpp @@ -175,8 +175,11 @@ record_error_msg_t CRecordInstance::Start(CZapitChannel * channel) psi.addPid(recMovieInfo->audioPids[i].epgAudioPid, EN_TYPE_AUDIO_EAC3, recMovieInfo->audioPids[i].atype, channel->getAudioChannel(i)->description.c_str()); }else psi.addPid(recMovieInfo->audioPids[i].epgAudioPid, EN_TYPE_AUDIO, recMovieInfo->audioPids[i].atype, channel->getAudioChannel(i)->description.c_str()); + + if (numpids >= REC_MAX_APIDS) + break; } - if ((StreamVTxtPid) && (allpids.PIDs.vtxtpid != 0)){ + if ((StreamVTxtPid) && (allpids.PIDs.vtxtpid != 0) && (numpids < REC_MAX_APIDS)){ apids[numpids++] = allpids.PIDs.vtxtpid; psi.addPid(allpids.PIDs.vtxtpid, EN_TYPE_TELTEX, 0, channel->getTeletextLang()); } @@ -186,6 +189,8 @@ record_error_msg_t CRecordInstance::Start(CZapitChannel * channel) if (s->thisSubType == CZapitAbsSub::DVB) { if(i>9)//max sub pids break; + if (numpids >= REC_MAX_APIDS) + break; CZapitDVBSub* sd = reinterpret_cast(s); apids[numpids++] = sd->pId; @@ -196,9 +201,10 @@ record_error_msg_t CRecordInstance::Start(CZapitChannel * channel) } psi.genpsi(fd); - - if ((StreamPmtPid) && (allpids.PIDs.pmtpid != 0)) +#if 0 + if ((StreamPmtPid) && (allpids.PIDs.pmtpid != 0) && (numpids < REC_MAX_APIDS)) apids[numpids++] = allpids.PIDs.pmtpid; +#endif if(record == NULL) record = new cRecord(channel->getRecordDemux() /*RECORD_DEMUX*/); @@ -317,6 +323,9 @@ bool CRecordInstance::Update() if(!found) { update = true; printf("%s: apid %x not found in recording pids\n", __FUNCTION__, it->apid); + if (numpids < REC_MAX_APIDS) + apids[numpids++] = it->apid; + record->AddPid(it->apid); for(unsigned int i = 0; i < allpids.APIDs.size(); i++) { if(allpids.APIDs[i].pid == it->apid) {