Skip to content

Commit

Permalink
Merge commit 'a5d42043093a39636a1f4021a37dd9c612479f6f'
Browse files Browse the repository at this point in the history
* commit 'a5d42043093a39636a1f4021a37dd9c612479f6f':
  avformat: Always return ref-counted AVPacket

Merged-by: Hendrik Leppkes <[email protected]>
  • Loading branch information
Nevcairiel committed Oct 27, 2015
2 parents fe3c22e + a5d4204 commit 856b19d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
1 change: 0 additions & 1 deletion ffmpeg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 0 additions & 4 deletions ffplay.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 8 additions & 0 deletions libavformat/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 856b19d

Please sign in to comment.