correctly de-init muxer
This commit is contained in:
parent
4a18583645
commit
d2e702041a
3 changed files with 29 additions and 5 deletions
6
mux.c
6
mux.c
|
@ -64,8 +64,10 @@ muxer_play(th_muxer_t *tm, int64_t toffset)
|
|||
{
|
||||
th_subscription_t *s = tm->tm_subscription;
|
||||
|
||||
if(!tm->tm_linked)
|
||||
if(!tm->tm_linked) {
|
||||
LIST_INSERT_HEAD(&s->ths_transport->tht_muxers, tm, tm_transport_link);
|
||||
tm->tm_linked = 1;
|
||||
}
|
||||
|
||||
if(toffset == AV_NOPTS_VALUE) {
|
||||
/* continue from last playback */
|
||||
|
@ -197,7 +199,7 @@ muxer_deinit(th_muxer_t *tm, th_subscription_t *s)
|
|||
s->ths_muxer = NULL;
|
||||
|
||||
if(tm->tm_linked)
|
||||
LIST_INSERT_HEAD(&s->ths_transport->tht_muxers, tm, tm_transport_link);
|
||||
LIST_REMOVE(tm, tm_transport_link);
|
||||
|
||||
while((tms = LIST_FIRST(&tm->tm_streams)) != NULL)
|
||||
tms_destroy(tms);
|
||||
|
|
|
@ -108,8 +108,10 @@ transport_stop(th_transport_t *t, int flush_subscriptions)
|
|||
st->st_buffer_ptr = 0;
|
||||
st->st_startcode = 0;
|
||||
|
||||
if(st->st_curpkt != NULL)
|
||||
if(st->st_curpkt != NULL) {
|
||||
pkt_deref(st->st_curpkt);
|
||||
st->st_curpkt = NULL;
|
||||
}
|
||||
|
||||
/* Clear PTS queue */
|
||||
|
||||
|
|
24
tsmux.c
24
tsmux.c
|
@ -696,9 +696,29 @@ ts_muxer_init(th_subscription_t *s, ts_mux_output_t *output,
|
|||
void
|
||||
ts_muxer_deinit(ts_muxer_t *ts, th_subscription_t *s)
|
||||
{
|
||||
free(ts->ts_packet);
|
||||
muxer_deinit(ts->ts_muxer, s);
|
||||
th_muxstream_t *tms;
|
||||
th_muxer_t *tm = s->ths_muxer;
|
||||
th_muxpkt_t *f;
|
||||
th_refpkt_t *o;
|
||||
|
||||
dtimer_disarm(&ts->ts_patpmt_timer);
|
||||
|
||||
LIST_FOREACH(tms, &tm->tm_streams, tms_muxer_link0) {
|
||||
dtimer_disarm(&tms->tms_mux_timer);
|
||||
|
||||
/* Free mux packets */
|
||||
while((f = tmf_deq(&tms->tms_delivery_fifo)) != NULL)
|
||||
free(f);
|
||||
|
||||
/* Unreference lookahead queue */
|
||||
while((o = TAILQ_FIRST(&tms->tms_lookahead)) != NULL) {
|
||||
pkt_deref(o->trp_pkt);
|
||||
TAILQ_REMOVE(&tms->tms_lookahead, o, trp_link);
|
||||
}
|
||||
}
|
||||
|
||||
free(ts->ts_packet);
|
||||
muxer_deinit(tm, s);
|
||||
free(ts);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue