The PAT/PMT is now only processed if its version changes

This commit is contained in:
Klaus Schmidinger 2009-01-24 13:47:46 +01:00
parent f311ce508a
commit 85e34776ff
5 changed files with 25 additions and 3 deletions

View File

@ -1195,6 +1195,8 @@ Reinhard Nissl <rnissl@gmx.de>
for reporting a possible problem with removing deleted recordings
for pointing out that a check of mutexCurrentAudioTrack needs to be done in
to cDevice::PlayTs()
for reporting that the PAT/PMT is processed too often, even if its version
hasn't changed
Richard Robson <richard_robson@beeb.net>
for reporting freezing replay if a timer starts while in Transfer Mode from the

View File

@ -5963,3 +5963,5 @@ Video Disk Recorder Revision History
the edited PES recording is set to 1 for I-frames and 2 for all others (P- and
B-frames). The exact frame type doesn't matter for VDR, it only needs to know if
it's an I-frame or not.
- The PAT/PMT is now only processed if its version changes (reported by Reinhard
Nissl).

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: device.c 2.9 2009/01/24 11:16:31 kls Exp $
* $Id: device.c 2.10 2009/01/24 13:40:54 kls Exp $
*/
#include "device.h"
@ -1340,6 +1340,7 @@ int cDevice::PlayTs(const uchar *Data, int Length, bool VideoOnly)
}
}
else if (Data == NULL) {
patPmtParser.Reset();
tsToPesVideo.Reset();
tsToPesAudio.Reset();
tsToPesSubtitle.Reset();

14
remux.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: remux.c 2.12 2009/01/24 12:29:19 kls Exp $
* $Id: remux.c 2.13 2009/01/24 13:44:45 kls Exp $
*/
#include "remux.h"
@ -351,8 +351,14 @@ uchar *cPatPmtGenerator::GetPmt(int &Index)
// --- cPatPmtParser ---------------------------------------------------------
cPatPmtParser::cPatPmtParser(void)
{
Reset();
}
void cPatPmtParser::Reset(void)
{
pmtSize = 0;
patVersion = pmtVersion = -1;
pmtPid = -1;
vpid = vtype = 0;
}
@ -370,6 +376,8 @@ void cPatPmtParser::ParsePat(const uchar *Data, int Length)
SI::PAT Pat(Data, false);
if (Pat.CheckCRCAndParse()) {
dbgpatpmt("PAT: TSid = %d, c/n = %d, v = %d, s = %d, ls = %d\n", Pat.getTransportStreamId(), Pat.getCurrentNextIndicator(), Pat.getVersionNumber(), Pat.getSectionNumber(), Pat.getLastSectionNumber());
if (patVersion == Pat.getVersionNumber())
return;
SI::PAT::Association assoc;
for (SI::Loop::Iterator it; Pat.associationLoop.getNext(assoc, it); ) {
dbgpatpmt(" isNITPid = %d\n", assoc.isNITPid());
@ -378,6 +386,7 @@ void cPatPmtParser::ParsePat(const uchar *Data, int Length)
dbgpatpmt(" service id = %d, pid = %d\n", assoc.getServiceId(), assoc.getPid());
}
}
patVersion = Pat.getVersionNumber();
}
else
esyslog("ERROR: can't parse PAT");
@ -428,6 +437,8 @@ void cPatPmtParser::ParsePmt(const uchar *Data, int Length)
if (Pmt.CheckCRCAndParse()) {
dbgpatpmt("PMT: sid = %d, c/n = %d, v = %d, s = %d, ls = %d\n", Pmt.getServiceId(), Pmt.getCurrentNextIndicator(), Pmt.getVersionNumber(), Pmt.getSectionNumber(), Pmt.getLastSectionNumber());
dbgpatpmt(" pcr = %d\n", Pmt.getPCRPid());
if (pmtVersion == Pmt.getVersionNumber())
return;
cDevice::PrimaryDevice()->ClrAvailableTracks(false, true);
int NumApids = 0;
int NumDpids = 0;
@ -533,6 +544,7 @@ void cPatPmtParser::ParsePmt(const uchar *Data, int Length)
cDevice::PrimaryDevice()->EnsureAudioTrack(true);
cDevice::PrimaryDevice()->EnsureSubtitleTrack();
}
pmtVersion = Pmt.getVersionNumber();
}
else
esyslog("ERROR: can't parse PMT");

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: remux.h 2.6 2009/01/23 16:44:46 kls Exp $
* $Id: remux.h 2.7 2009/01/24 13:38:10 kls Exp $
*/
#ifndef __REMUX_H
@ -192,6 +192,8 @@ class cPatPmtParser {
private:
uchar pmt[MAX_SECTION_SIZE];
int pmtSize;
int patVersion;
int pmtVersion;
int pmtPid;
int vpid;
int vtype;
@ -199,6 +201,9 @@ protected:
int SectionLength(const uchar *Data, int Length) { return (Length >= 3) ? ((int(Data[1]) & 0x0F) << 8)| Data[2] : 0; }
public:
cPatPmtParser(void);
void Reset(void);
///< Resets the parser. This function must be called whenever a new
///< stream is parsed.
void ParsePat(const uchar *Data, int Length);
///< Parses the PAT data from the single TS packet in Data.
///< Length is always TS_SIZE.