aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2015-10-27 14:12:27 +0100
committerHendrik Leppkes <h.leppkes@gmail.com>2015-10-27 14:12:27 +0100
commit856b19d5935b544e96156f8e75e23b28c0a9f318 (patch)
treec6e8461815cff046a92ba95d870037e254800717
parentfe3c22e0c00b5129853f4c02d6fbee2c09846666 (diff)
parenta5d42043093a39636a1f4021a37dd9c612479f6f (diff)
downloadffmpeg-856b19d5935b544e96156f8e75e23b28c0a9f318.tar.gz
Merge commit 'a5d42043093a39636a1f4021a37dd9c612479f6f'
* commit 'a5d42043093a39636a1f4021a37dd9c612479f6f': avformat: Always return ref-counted AVPacket Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
-rw-r--r--ffmpeg.c1
-rw-r--r--ffplay.c4
-rw-r--r--libavformat/utils.c8
3 files changed, 8 insertions, 5 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index a19c81667b..d4c6ec8420 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -3507,7 +3507,6 @@ static void *input_thread(void *arg)
av_thread_message_queue_set_err_recv(f->in_thread_queue, ret);
break;
}
- av_dup_packet(&pkt);
ret = av_thread_message_queue_send(f->in_thread_queue, &pkt, flags);
if (flags && ret == AVERROR(EAGAIN)) {
flags = 0;
diff --git a/ffplay.c b/ffplay.c
index 37db374b67..e0bcc7c392 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -427,10 +427,6 @@ static int packet_queue_put(PacketQueue *q, AVPacket *pkt)
{
int ret;
- /* duplicate the packet */
- if (pkt != &flush_pkt && av_dup_packet(pkt) < 0)
- return -1;
-
SDL_LockMutex(q->mutex);
ret = packet_queue_put_private(q, pkt);
SDL_UnlockMutex(q->mutex);
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 689473e9fb..3b6530f4ca 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -683,6 +683,14 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
continue;
}
+ if (!pkt->buf) {
+ AVPacket tmp = { 0 };
+ ret = av_packet_ref(&tmp, pkt);
+ if (ret < 0)
+ return ret;
+ *pkt = tmp;
+ }
+
if ((s->flags & AVFMT_FLAG_DISCARD_CORRUPT) &&
(pkt->flags & AV_PKT_FLAG_CORRUPT)) {
av_log(s, AV_LOG_WARNING,