[libdvbpsi-devel] TOT CRC Problem

Angelo Schiavone angelo.schiavone at gmail.com
Tue Jan 22 12:20:38 CET 2013


Hi guys, it's me again.
I found a bug in libdvbpsi TOT table decoding.
Every time a TOT occurres in my transport stream the library throws a CRC
error even if the CRC is correct.
That's because "dvbpsi_ValidPSISection" always return false since TOT
tables have "section_syntax_indicator" set to 0
but it has a CRC field.
TOT has section_syntax_indicator==0 and CRC field (ETSI EN 300 468
clause 5.2.6) but the dvbpsi_ValidPSISection function assumes that any table
which have "section_syntax_indicator" set to 0 has no CRC field, thus it
returns false, which comes to TOT crc error.


bool dvbpsi_ValidPSISection(dvbpsi_psi_section_t* p_section)

{

    if (p_section->b_syntax_indicator)

    {

        /* Check the CRC_32 if b_syntax_indicator is false */

        uint32_t i_crc = 0xffffffff;

        uint8_t* p_byte = p_section->p_data;

         while(p_byte < p_section->p_payload_end + 4)

        {

            i_crc = (i_crc << 8) ^ dvbpsi_crc32_table[(i_crc >> 24) ^
(*p_byte)];

            p_byte++;

        }

         if (i_crc == 0)

            return true;

        else

            return false;

    }

    else

    {

        /* No check to do if b_syntax_indicator is false */

        return false;

    }

}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/libdvbpsi-devel/attachments/20130122/5473ab4f/attachment.html>


More information about the libdvbpsi-devel mailing list