[Libav-user] Reading MPEG-TS from noisy data (drop PIDs not in PAT/PMT).

wl2776 wl2776 at gmail.com
Fri Jun 17 15:22:15 CEST 2011


Hi all.
My program uses libav to read DVB stream (mpeg-ts) and store its parts in
mpeg-ps files.

I was using precompiled binaries but recently pulled the newest git
revision.
I did this because precompiled binaries had limit of the number of streams
in AVFormatContext.
Therefore, my program was able to process only 20 elementary streams from
the incoming dvb stream.

However, I've started to get the problems, sometime my program stops
responding, begins to consume more and more memory, then OS kills it.

I've found that sometimes incoming MPEG-2 TS stream contains a noise. 

And when the noise distorts the PID value in the incoming MPEG-2 TS packets,
libav sees the new PID value, adds the new entry to the input
AVFormatContext::streams array, stores this distorted packet in the
AVFormatContext::raw_packet_buffer and never gets this packet out of that
buffer.

Also it falls in the infinite loop inside the av_read_packet() function. It
reads new data, but always gets the packet with the invalid PID from the
raw_packet_buffer and simply accumulates them without processing.

How can I deal with it?

Is it possible to make libav MPEG-TS demuxer to drop packets whose PIDs are
not listed in PAT/PMT instead of store it and hope that it will have this
stream in the future?


--
View this message in context: http://libav-users.943685.n4.nabble.com/Reading-MPEG-TS-from-noisy-data-drop-PIDs-not-in-PAT-PMT-tp3605385p3605385.html
Sent from the libav-users mailing list archive at Nabble.com.


More information about the Libav-user mailing list