demux: fix leaking closed captions packets with unselected sub stream

Calling demux_add_packet() unconditonally frees the packet if the stream
is not selected.
This commit is contained in:
wm4 2016-01-19 14:19:50 +01:00
parent a99b63db08
commit ae4b0f3f7c
1 changed files with 6 additions and 6 deletions

View File

@ -372,18 +372,18 @@ void demuxer_feed_caption(struct sh_stream *stream, demux_packet_t *dp)
if (!sh) {
sh = demux_alloc_sh_stream(STREAM_SUB);
if (!sh)
if (!sh) {
talloc_free(dp);
return;
}
sh->codec->codec = "eia_608";
stream->ds->cc = sh;
demux_add_sh_stream(demuxer, sh);
}
if (demux_stream_is_selected(sh)) {
dp->pts = MP_ADD_PTS(dp->pts, -stream->ds->in->ts_offset);
dp->dts = MP_ADD_PTS(dp->dts, -stream->ds->in->ts_offset);
demux_add_packet(sh, dp);
}
dp->pts = MP_ADD_PTS(dp->pts, -stream->ds->in->ts_offset);
dp->dts = MP_ADD_PTS(dp->dts, -stream->ds->in->ts_offset);
demux_add_packet(sh, dp);
}
void demux_add_packet(struct sh_stream *stream, demux_packet_t *dp)