Re: [patch] EIT decoder problem

Johann Hanne <[email protected]>
Newsgroups gmane.comp.video.videolan.libdvbpsi.devel
Message-ID <200704192312.11544.jhml__42415.4582004578$1177006311$gmane$org@gmx.net>
Hi Christophe,

On Tuesday 17 April 2007 09:11, Christophe Massiot wrote:
> I have left the old test for completion (checking that we have all
> sections) so that we are still compatible with the old behaviour. It
> is still true that the table is complete if we have all sections, and
> removing the test would have caused a delay of one section in the
> detection of a new EIT.

If you care about requiring a section_number to be received twice, I'd suggest 
the attached method instead. This will also catch the case where 
section_number 0 is received first - it's sufficient to wait for the 
last_section_number to be received then.

> I'm quite for a new version of libdvbpsi, but usually I ask for sam's 
> opinion on it ?

Can I assume him reading this or should I contact him directly?

Cheers, Johann
libdvbpsi-svn142-eit-optimization.patch (text/x-diff, 1.6 KB)
--- libdvbpsi-svn142/src/tables/eit.c.orig	2007-04-19 22:37:07.000000000 +0200
+++ libdvbpsi-svn142/src/tables/eit.c	2007-04-19 23:02:32.000000000 +0200
@@ -419,20 +419,22 @@
 
     /* Check if we have all the sections */
     b_complete = 0;
-    for(i = 0; i <= p_eit_decoder->i_last_section_number; i++)
-    {
-      if(!p_eit_decoder->ap_sections[i])
-        break;
-
-      if(i == p_eit_decoder->i_last_section_number)
-        b_complete = 1;
-    }
 
     /* As there may be gaps in the section_number fields (see below), we
-     * have to wait until we have received a section_number twice - this
-     * is the only way to be sure that a complete table has been sent! */
-    if(!b_complete &&
-       p_section->i_number == p_eit_decoder->i_first_received_section_number)
+     * have to wait until we have received a section_number twice or
+     * until we have a received a section_number which is
+     * first_received_section_number - 1;
+     * if the first_received_section_number is 0, it's enough to wait
+     * until the last_section_number has been received;
+     * this is the only way to be sure that a complete table has been
+     * sent! */
+    if((p_eit_decoder->i_first_received_section_number > 0 &&
+        (p_section->i_number ==
+           p_eit_decoder->i_first_received_section_number ||
+         p_section->i_number ==
+           p_eit_decoder->i_first_received_section_number - 1)) ||
+       (p_eit_decoder->i_first_received_section_number == 0 &&
+        p_section->i_number == p_eit_decoder->i_last_section_number))
     {
       for(i = 0; i <= p_eit_decoder->i_last_section_number; i++)
       {
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.