mirror of
https://github.com/xenia-project/FFmpeg.git
synced 2024-11-24 12:09:55 +00:00
avformat: Always return ref-counted AVPacket
And drop the av_dup_packet from the input_thread.
This commit is contained in:
parent
f0ca6ffa0a
commit
a5d4204309
1
avconv.c
1
avconv.c
@ -2130,7 +2130,6 @@ static void *input_thread(void *arg)
|
||||
while (!av_fifo_space(f->fifo))
|
||||
pthread_cond_wait(&f->fifo_cond, &f->fifo_lock);
|
||||
|
||||
av_dup_packet(&pkt);
|
||||
av_fifo_generic_write(f->fifo, &pkt, sizeof(pkt), NULL);
|
||||
|
||||
pthread_mutex_unlock(&f->fifo_lock);
|
||||
|
4
avplay.c
4
avplay.c
@ -320,10 +320,6 @@ static int packet_queue_put(PacketQueue *q, AVPacket *pkt)
|
||||
{
|
||||
AVPacketList *pkt1;
|
||||
|
||||
/* duplicate the packet */
|
||||
if (pkt != &flush_pkt && av_dup_packet(pkt) < 0)
|
||||
return -1;
|
||||
|
||||
pkt1 = av_malloc(sizeof(AVPacketList));
|
||||
if (!pkt1)
|
||||
return -1;
|
||||
|
@ -413,6 +413,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,
|
||||
|
Loading…
Reference in New Issue
Block a user