mpegts mux: the mm_pids flush must be protected by mi_output_lock

This commit is contained in:
Jaroslav Kysela 2014-10-21 16:07:59 +02:00
parent 33449e80f5
commit 43a7a077e6

View file

@ -713,9 +713,12 @@ mpegts_mux_stop ( mpegts_mux_t *mm, int force )
mpegts_input_flush_mux(mi, mm);
/* Ensure PIDs are cleared */
if (mi) {
pthread_mutex_lock(&mi->mi_output_lock);
mm->mm_last_pid = -1;
mm->mm_last_mp = NULL;
while ((mp = RB_FIRST(&mm->mm_pids))) {
assert(mi);
while ((mps = RB_FIRST(&mp->mp_subs))) {
RB_REMOVE(&mp->mp_subs, mps, mps_link);
free(mps);
@ -727,6 +730,10 @@ mpegts_mux_stop ( mpegts_mux_t *mm, int force )
}
free(mp);
}
pthread_mutex_unlock(&mi->mi_output_lock);
} else {
assert(RB_FIRST(&mm->mm_pids) == NULL);
}
/* Scanning */
mpegts_network_scan_mux_cancel(mm, 1);