GNOME Bugzilla – Bug 621027
mpegtsparse problem when parsing EIT and obtaining Transport Stream packet size
Last modified: 2011-05-09 10:00:28 UTC
Created attachment 163109 [details] mpegtspacketizer.c Hi, I have found some bugs when using mpegtsparse with DVB-T. mpegtsparse is not parsing EIT correctly. Some event informations may be lost during parsing. This is because EIT with the same version number may be divided into sections. In that case the packet containing EIT with higher section number, but with the same version number will be discarded (see function "mpegts_packetizer_parse_section_header"). mpegtsparse is not handling seeks correctly. In my case when I was playing MPEG-TS from file and then trying to seek, the mpegtsparse is holding data (not pushing it further). After seek the information about transport stream packet size is lost. Then in function "mpegts_try_discover_packet_size" the packet size is obtained again (when new data in arriving). If the packets at the beginning of "gst_adapter" are invalid, the "mpegts_try_discover_packet_size" would not be able to determine the packet size and the packets at the beginning of the gst_adapter will not be discarded. Therefore all incoming data will be queued in gst_adapter indefinitely. I have fixed this issues and I am attaching my versions of "mpegtspacketizer.c" and "mpegtspacketizer.h". I was using 10.18 version as code base. In those files I have also added support for TDT tables, but it is already implemented in 10.19 versions of those files. My fixes are in functions: mpegts_packetizer_stream_subtable_compare, mpegts_packetizer_stream_subtable_new, mpegts_packetizer_parse_section_header, mpegts_try_discover_packet_size. and they are quite simple. Kind regards, Karol
Created attachment 163110 [details] mpegtspacketizer.h
Created attachment 164382 [details] [review] fix diff against 10.18
Created attachment 164383 [details] [review] fix diff against 10.18 (header)
ok taking a look.
I have made patch for mpegtspacketizer.c based on the newest code in git. What I have fixed: In function "mpegts_try_discover_packet_size" the MPEG-TS packet size is obtained (when new data in arriving). If the packets at the beginning of "gst_adapter" are invalid, the "mpegts_try_discover_packet_size" would not be able to determine the packet size and the packets at the beginning of the "gst_adapter" instance are not discarded. Therefore all incoming data will be queued in "gst_adapter" instance indefinitely. My patch discards single packet from the beginning of the "gst_adapter" instance in the case, that the the MPEG-TS packet size cannot be obtained because of invalid packet data. What was already fixed in the newest git code: 1. The EIT problem is fixed in the newest git code. Now the CRCs of the tables are stored. When the new EIT comes with the same version number and higher section number, it would have different CRC and therefore will not be ignored.
Created attachment 166044 [details] [review] mpegtspacketizer.c patch based on the code in git My patch discards single packet from the beginning of the "gst_adapter" instance in the case, that the the MPEG-TS packet size cannot be obtained because of invalid packet data.
Review of attachment 166044 [details] [review]: looks good
Seems this was already committed a while back in 0b4dfa68 in January, closing