mpegts: ensure all data queues are properly flushed
This ensures that we don't get stale data into the SI table pipelines which can result in processing of data that doesn't match the expected mux (and ultimately screws up addressing).
This commit is contained in:
parent
af162a3c15
commit
f69bc70665
3 changed files with 24 additions and 1 deletions
|
@ -487,6 +487,8 @@ int mpegts_input_current_weight ( mpegts_input_t *mi );
|
|||
|
||||
void mpegts_input_save ( mpegts_input_t *mi, htsmsg_t *c );
|
||||
|
||||
void mpegts_input_flush_mux ( mpegts_input_t *mi, mpegts_mux_t *mm );
|
||||
|
||||
void mpegts_table_dispatch
|
||||
(const uint8_t *sec, size_t r, void *mt);
|
||||
void mpegts_table_release
|
||||
|
|
|
@ -336,6 +336,23 @@ mpegts_input_table_thread ( void *aux )
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
mpegts_input_flush_mux
|
||||
( mpegts_input_t *mi, mpegts_mux_t *mm )
|
||||
{
|
||||
mpegts_table_feed_t *mtf, *next;
|
||||
|
||||
pthread_mutex_lock(&mi->mi_delivery_mutex);
|
||||
mtf = TAILQ_FIRST(&mi->mi_table_feed);
|
||||
while (mtf) {
|
||||
next = TAILQ_NEXT(mtf, mtf_link);
|
||||
if (mtf->mtf_mux == mm)
|
||||
TAILQ_REMOVE(&mi->mi_table_feed, mtf, mtf_link);
|
||||
mtf = next;
|
||||
}
|
||||
pthread_mutex_unlock(&mi->mi_delivery_mutex);
|
||||
}
|
||||
|
||||
/* **************************************************************************
|
||||
* Creation/Config
|
||||
* *************************************************************************/
|
||||
|
|
|
@ -262,7 +262,7 @@ mpegts_mux_stop ( mpegts_mux_t *mm )
|
|||
{
|
||||
char buf[256];
|
||||
mpegts_mux_instance_t *mmi = mm->mm_active;
|
||||
mpegts_input_t *mi;
|
||||
mpegts_input_t *mi = NULL;
|
||||
|
||||
mm->mm_display_name(mm, buf, sizeof(buf));
|
||||
tvhdebug("mpegts", "%s - stopping mux", buf);
|
||||
|
@ -277,6 +277,10 @@ mpegts_mux_stop ( mpegts_mux_t *mm )
|
|||
tvhtrace("mpegts", "%s - flush tables", buf);
|
||||
mpegts_table_flush_all(mm);
|
||||
|
||||
/* Flush table data queue */
|
||||
if (mi)
|
||||
mpegts_input_flush_mux(mi, mm);
|
||||
|
||||
/* Alert listeners */
|
||||
// TODO
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue