[vlc-devel] [RFC] Broken current_next handling for SI tables

Marian Ďurkovič md at bts.sk
Mon Nov 16 11:46:39 CET 2009


Hi all,

  recently I discovered a weird bug in handling of current_next indicator in
all SI tables (PAT, PMT, etc). The applications typically only consider
current tables (current_next=1) and discard next tables (current_next=0).

  However, libdvbpsi has a strange "feature", that it delivers empty
current tables, if they were preceeded with the same next table. From
the libdvbpsi headers:

 * Application interface for the PAT decoder and the PAT generator. New
 * decoded PAT tables are sent by callback to the application. If a table
 * wasn't active (b_current_next == 0) and the next is the same but active
 * (b_current_next == 1) then the program list is *empty* and should be
 * caught from the previous structure.

Not sure what was the motivation for this "feature", but this behaviour
is really weird and affects all aplications. AFAICT, only VLS is handling
this right, which requires this ugly piece of code, different for every
table type:

void C_DvbPsiPmt::BuildFromNext(C_DvbPsiPmt *pNextPmt)
{
  ASSERT(pNextPmt);

  if(    (m_sPmt.i_program_number == pNextPmt->m_sPmt.i_program_number)
      && (m_sPmt.i_version == pNextPmt->m_sPmt.i_version)
      && (m_sPmt.i_pcr_pid == pNextPmt->m_sPmt.i_pcr_pid)
      && (!pNextPmt->m_sPmt.b_current_next)
      && (m_sPmt.b_current_next)
      && (m_sPmt.p_first_descriptor == NULL)
      && (m_sPmt.p_first_es == NULL))
  {
    m_sPmt.p_first_descriptor = pNextPmt->m_sPmt.p_first_descriptor;
    pNextPmt->m_sPmt.p_first_descriptor = NULL;
    m_sPmt.p_first_es = pNextPmt->m_sPmt.p_first_es;
    pNextPmt->m_sPmt.p_first_es = NULL;
  }
  else
  {
    ASSERT(false);
  }
} 

   Thus I strongly believe we should remove this "feature" from libdvbpsi
ASAP and make it deliver correct tables at all cases without the need
for past-references.

   Comments welcome.

        With kind regards,

            M.



More information about the vlc-devel mailing list