summaryrefslogtreecommitdiffstats
path: root/demux
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-01-19 14:19:50 +0100
committerwm4 <wm4@nowhere>2016-01-19 14:19:50 +0100
commitae4b0f3f7ce31e1f9f5ea51422cd21c900179d52 (patch)
tree1c6e5b67f9ca40a3e4b8f7d3a3c73cb478df8574 /demux
parenta99b63db08306b34ef53f5a18807c811b64491a7 (diff)
downloadmpv-ae4b0f3f7ce31e1f9f5ea51422cd21c900179d52.tar.bz2
mpv-ae4b0f3f7ce31e1f9f5ea51422cd21c900179d52.tar.xz
demux: fix leaking closed captions packets with unselected sub stream
Calling demux_add_packet() unconditonally frees the packet if the stream is not selected.
Diffstat (limited to 'demux')
-rw-r--r--demux/demux.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/demux/demux.c b/demux/demux.c
index af0a93c03d..d0a37b9d83 100644
--- a/demux/demux.c
+++ b/demux/demux.c
@@ -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)