mpegts input: mm_active cleanups, fix also memory leak introduced by mi_stop

This commit is contained in:
Jaroslav Kysela 2014-10-28 21:02:39 +01:00
parent a4cfbb99b0
commit 863ea6f707
2 changed files with 6 additions and 3 deletions

View file

@ -605,6 +605,8 @@ mpegts_input_recv_packets
if (!mi->mi_stop) {
TAILQ_INSERT_TAIL(&mi->mi_input_queue, mp, mp_link);
pthread_cond_signal(&mi->mi_input_cond);
} else {
free(mp);
}
pthread_mutex_unlock(&mi->mi_input_lock);
}
@ -718,6 +720,8 @@ mpegts_input_process
mpegts_mux_instance_t *mmi = mm->mm_active;
mpegts_pid_t *last_mp = NULL;
assert(mmi);
mi->mi_live = 1;
/* Process */

View file

@ -692,9 +692,6 @@ mpegts_mux_stop ( mpegts_mux_t *mm, int force )
/* Stop possible recursion */
if (!mmi) return;
/* Clear */
mm->mm_active = NULL;
mpegts_mux_nice_name(mm, buf, sizeof(buf));
tvhdebug("mpegts", "%s - stopping mux", buf);
@ -706,6 +703,8 @@ mpegts_mux_stop ( mpegts_mux_t *mm, int force )
mi->mi_stop_mux(mi, mmi);
mi->mi_stopped_mux(mi, mmi);
assert(mm->mm_active == NULL);
/* Flush all tables */
tvhtrace("mpegts", "%s - flush tables", buf);
mpegts_table_flush_all(mm);