Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
mpegts: table dispatch - replace assert with debug log
  • Loading branch information
perexg committed Jul 12, 2014
1 parent 3a1651e commit 9c783ef
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/input/mpegts/mpegts_input.c
Expand Up @@ -542,8 +542,7 @@ mpegts_input_recv_packets
static void
mpegts_input_table_dispatch ( mpegts_mux_t *mm, const uint8_t *tsb )
{
int i = 0;
int len;
int i = 0, len, err = 0;
uint16_t pid = ((tsb[1] & 0x1f) << 8) | tsb[2];
uint8_t cc = (tsb[3] & 0x0f);
mpegts_table_t *mt, **vec;
Expand All @@ -554,10 +553,16 @@ mpegts_input_table_dispatch ( mpegts_mux_t *mm, const uint8_t *tsb )
vec = alloca(len * sizeof(mpegts_table_t *));
LIST_FOREACH(mt, &mm->mm_tables, mt_link) {
mpegts_table_grab(mt);
vec[i++] = mt;
if (i < len)
vec[i++] = mt;
else
err++;
}
pthread_mutex_unlock(&mm->mm_tables_lock);
assert(i == len);
if (i != len) {
tvherror("psi", "tables count inconsistency (num %d, list %d)", len, i + err);
len = i;
}

/* Process */
for (i = 0; i < len; i++) {
Expand Down

2 comments on commit 9c783ef

@adamsutton
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wrong, I've seen this myself, and never got to the bottom of it, but it implies something is VERY wrong if you ask me. Simply warning about it feels like stacking up trouble!

Though maybe the real issue has been addressed in other commits, but I would have left the assert()

@perexg
Copy link
Contributor Author

@perexg perexg commented on 9c783ef Jul 13, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added it back, but the code is a bit different, because unsubscribed pids are not queued to vec[] and also the numbers are printed to log before assert.. It's really weird issue, because I added mutex protection to all mm_num_tables/mm_tables updates and the problem seems not to be solved..

Here is the crash:

http://pastebin.com/ccuYb3B5

It looks that the difference (num 27, list 21) is same as the count of unsubscribed PIDs:

2014-07-13 02:05:22.740 [ DEBUG]:mpegts: 10729V in 19E - close PID 040A (1034) [1/0x146a270]
2014-07-13 02:05:22.740 [ DEBUG]:mpegts: 10729V in 19E - close PID 00A3 (163) [1/0x146a270]
2014-07-13 02:05:22.740 [ DEBUG]:mpegts: 10729V in 19E - close PID 0062 (98) [1/0x146a270]
2014-07-13 02:05:22.740 [ DEBUG]:mpegts: 10729V in 19E - close PID 0063 (99) [1/0x146a270]
2014-07-13 02:05:22.740 [ DEBUG]:mpegts: 10729V in 19E - close PID 0064 (100) [1/0x146a270]
2014-07-13 02:05:22.740 [ DEBUG]:mpegts: 10729V in 19E - close PID 0065 (101) [1/0x146a270]

But these PIDs are not TABLES!!!

Please sign in to comment.