Re: TOT CRC Problem

Angelo Schiavone <[email protected]>
Newsgroups gmane.comp.video.videolan.libdvbpsi.devel
Message-ID <CADyCdYfegdyLuG4dN4cPLL5aP8dvB_CpzxWEv_aBYK_rYKNikg@mail.gmail.com>
Hi Jean-Paul,
thanks for your attention,
Here is my actual solution which does not break those sections which have
section_indicator set to 0 and do not have a CRC32 field

bool dvbpsi_ValidPSISection(dvbpsi_psi_section_t* p_section)

{

// TOT has table_id  0x73

    if ( (p_section->p_data[0]==0x73) || 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;

    }

}


Anyway, i'm gonna patch everything on git.
Currently I found problem in decoding NIT CAT BAT TOT.
thanks


2013/1/23 Jean-Paul Saman <[email protected]>

> HI Angelo,
>
> Thank you for bringing this to my attention.
>
> On Tue, Jan 22, 2013 at 12:20 PM, Angelo Schiavone <
> [email protected]> wrote:
>
>> 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.
>>
>>
> Removing this check will break RST, ST and DIT  tables, both have
> section_indicator set to 0 and do not have a CRC32 field.
> The change should be a little more intelligent, then that and properly
> reviewed and tested.
>
> Kind regards,
>
> Jean-Paul Saman.
>
>
>>
>> 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;
>>
>>     }
>>
>> }
>>
>>
>>
>> _______________________________________________
>> libdvbpsi-devel mailing list
>> [email protected]
>> http://mailman.videolan.org/listinfo/libdvbpsi-devel
>>
>>
>

_______________________________________________
libdvbpsi-devel mailing list
[email protected]
http://mailman.videolan.org/listinfo/libdvbpsi-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.