Commit 6d7d5422 authored by Jean-Paul Saman's avatar Jean-Paul Saman

src/dvbpsi.c: dvbpsi_decoder_psi_sections_completed: detect gaps in multi section psi tables

The function dvbpsi_decoder_psi_sections_completed() is meant to detect if all
sections of a multi section psi table have arrived. After the rewrite in
commit-id 57c6cd63 it ignored gaps in the arrived sections. This means that
the function now expects that individual sections of multi section psi tables
arrive in order. However the ISO/IEC 13818-1 standard explains in Annex C, C 2ii
that it is allowed to transmit sections out of order.

 "The section_number field allows the sections of a particular table to be reassembled
  in their original order by the decoder. There is no obligation within this Recommendation
  | International Standard that sections must be transmitted in numerical order, but this
  is recommended, unless it is desired to transmit some sections of the table more frequently
  than others, e.g. due to random access considerations."

The p_decoder->p_sections linked list is sequentially ordered and is now changed to detect
a gap in the ordering. This is possible because the first section in a multi-section psi table
is numbered 0.
parent 5288d55a
...@@ -221,11 +221,16 @@ bool dvbpsi_decoder_psi_sections_completed(dvbpsi_decoder_t* p_decoder) ...@@ -221,11 +221,16 @@ bool dvbpsi_decoder_psi_sections_completed(dvbpsi_decoder_t* p_decoder)
bool b_complete = false; bool b_complete = false;
dvbpsi_psi_section_t *p = p_decoder->p_sections; dvbpsi_psi_section_t *p = p_decoder->p_sections;
unsigned int prev_nr = 0;
while (p) while (p)
{ {
assert(prev_nr < 256);
if (prev_nr != p->i_number)
break;
if (p_decoder->i_last_section_number == p->i_number) if (p_decoder->i_last_section_number == p->i_number)
b_complete = true; b_complete = true;
p = p->p_next; p = p->p_next;
prev_nr++;
} }
return b_complete; return b_complete;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment