Commit a2cc3895 authored by Christophe Massiot's avatar Christophe Massiot

* dvb_print_si.c: Compare whole tables instead of just the version. Also fix rare segfault.

parent a0c759a9
...@@ -138,9 +138,8 @@ static void handle_pat(void) ...@@ -138,9 +138,8 @@ static void handle_pat(void)
uint8_t i; uint8_t i;
if (psi_table_validate(pp_current_pat_sections) && if (psi_table_validate(pp_current_pat_sections) &&
psi_table_get_version(pp_current_pat_sections) psi_table_compare(pp_current_pat_sections, pp_next_pat_sections)) {
== psi_table_get_version(pp_next_pat_sections)) { /* Identical PAT. Shortcut. */
/* Same version PAT. Shortcut. */
psi_table_free(pp_next_pat_sections); psi_table_free(pp_next_pat_sections);
psi_table_init(pp_next_pat_sections); psi_table_init(pp_next_pat_sections);
return; return;
...@@ -235,6 +234,7 @@ static void handle_pat(void) ...@@ -235,6 +234,7 @@ static void handle_pat(void)
if (pp_sids[i_pmt]->i_sid == i_sid) { if (pp_sids[i_pmt]->i_sid == i_sid) {
pp_sids[i_pmt]->i_sid = 0; pp_sids[i_pmt]->i_sid = 0;
free(pp_sids[i_pmt]->p_current_pmt); free(pp_sids[i_pmt]->p_current_pmt);
pp_sids[i_pmt]->p_current_pmt = NULL;
break; break;
} }
} }
...@@ -326,8 +326,8 @@ static void handle_pmt(uint16_t i_pid, uint8_t *p_pmt) ...@@ -326,8 +326,8 @@ static void handle_pmt(uint16_t i_pid, uint8_t *p_pmt)
} }
if (p_sid->p_current_pmt != NULL && if (p_sid->p_current_pmt != NULL &&
psi_get_version(p_sid->p_current_pmt) == psi_get_version(p_pmt)) { psi_compare(p_sid->p_current_pmt, p_pmt)) {
/* Same version PMT. Shortcut. */ /* Identical PMT. Shortcut. */
free(p_pmt); free(p_pmt);
return; return;
} }
...@@ -344,8 +344,7 @@ static void handle_pmt(uint16_t i_pid, uint8_t *p_pmt) ...@@ -344,8 +344,7 @@ static void handle_pmt(uint16_t i_pid, uint8_t *p_pmt)
static void handle_nit(void) static void handle_nit(void)
{ {
if (psi_table_validate(pp_current_nit_sections) && if (psi_table_validate(pp_current_nit_sections) &&
psi_table_get_version(pp_current_nit_sections) psi_table_compare(pp_current_nit_sections, pp_next_nit_sections)) {
== psi_table_get_version(pp_next_nit_sections)) {
/* Same version NIT. Shortcut. */ /* Same version NIT. Shortcut. */
psi_table_free(pp_next_nit_sections); psi_table_free(pp_next_nit_sections);
psi_table_init(pp_next_nit_sections); psi_table_init(pp_next_nit_sections);
...@@ -401,9 +400,8 @@ static void handle_nit_section(uint16_t i_pid, uint8_t *p_section) ...@@ -401,9 +400,8 @@ static void handle_nit_section(uint16_t i_pid, uint8_t *p_section)
static void handle_sdt(void) static void handle_sdt(void)
{ {
if (psi_table_validate(pp_current_sdt_sections) && if (psi_table_validate(pp_current_sdt_sections) &&
psi_table_get_version(pp_current_sdt_sections) psi_table_compare(pp_current_sdt_sections, pp_next_sdt_sections)) {
== psi_table_get_version(pp_next_sdt_sections)) { /* Identical SDT. Shortcut. */
/* Same version SDT. Shortcut. */
psi_table_free(pp_next_sdt_sections); psi_table_free(pp_next_sdt_sections);
psi_table_init(pp_next_sdt_sections); psi_table_init(pp_next_sdt_sections);
return; return;
......
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