summaryrefslogtreecommitdiff
path: root/libavformat/matroskadec.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavformat/matroskadec.c')
-rw-r--r--libavformat/matroskadec.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 9acfdf5b32..1dc188c946 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -381,6 +381,8 @@ typedef struct MatroskaDemuxContext {
/* byte position of the segment inside the stream */
int64_t segment_start;
+ /* This packet coincides with AVFormatInternal.parse_pkt
+ * and is not owned by us. */
AVPacket *pkt;
/* the packet queue */
@@ -2945,9 +2947,7 @@ static int matroska_read_header(AVFormatContext *s)
}
ebml_free(ebml_syntax, &ebml);
- matroska->pkt = av_packet_alloc();
- if (!matroska->pkt)
- return AVERROR(ENOMEM);
+ matroska->pkt = s->internal->parse_pkt;
/* The next thing is a segment. */
pos = avio_tell(matroska->ctx->pb);
@@ -3528,7 +3528,6 @@ static int matroska_parse_frame(MatroskaDemuxContext *matroska,
if (!pkt_size && !additional_size)
goto no_output;
- av_packet_unref(pkt);
if (!buf)
pkt->buf = av_buffer_create(pkt_data, pkt_size + AV_INPUT_BUFFER_PADDING_SIZE,
NULL, NULL, 0);
@@ -3902,7 +3901,6 @@ static int matroska_read_close(AVFormatContext *s)
int n;
matroska_clear_queue(matroska);
- av_packet_free(&matroska->pkt);
for (n = 0; n < matroska->tracks.nb_elem; n++)
if (tracks[n].type == MATROSKA_TRACK_TYPE_AUDIO)