[FFmpeg-devel] [PATCH 14/28] don't reparse PMT unless it's version has changed readded: don't accept PMT that isn't current
Mans Rullgard
mans
Wed Jun 30 11:09:42 CEST 2010
From: Cory Fields <theuni-nospam- at xbmc.org>
---
libavformat/mpegts.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 3653094..c901454 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -71,6 +71,7 @@ typedef struct MpegTSSectionFilter {
struct MpegTSFilter {
int pid;
int last_cc; /* last cc code (-1 if first packet) */
+ int last_version; /* last version of data on this pid */
enum MpegTSFilterType type;
union {
MpegTSPESFilter pes_filter;
@@ -299,6 +300,7 @@ static MpegTSFilter *mpegts_open_section_filter(MpegTSContext *ts, unsigned int
filter->type = MPEGTS_SECTION;
filter->pid = pid;
filter->last_cc = -1;
+ filter->last_version = -1;
sec = &filter->u.section_filter;
sec->section_cb = section_cb;
sec->opaque = opaque;
@@ -401,6 +403,7 @@ typedef struct SectionHeader {
uint8_t tid;
uint16_t id;
uint8_t version;
+ uint8_t current;
uint8_t sec_num;
uint8_t last_sec_num;
} SectionHeader;
@@ -472,6 +475,7 @@ static int parse_section_header(SectionHeader *h,
val = get8(pp, p_end);
if (val < 0)
return -1;
+ h->current = val & 0x1;
h->version = (val >> 1) & 0x1f;
val = get8(pp, p_end);
if (val < 0)
@@ -1041,6 +1045,12 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
return;
if (h->tid != PAT_TID)
return;
+ if (!h->current)
+ return;
+ if (h->version == filter->last_version)
+ return;
+ filter->last_version = h->version;
+ dprintf(ts->stream, "version=%d\n", filter->last_version);
clear_programs(ts);
for(;;) {
--
1.7.1.1
More information about the ffmpeg-devel
mailing list