On 20/10/15 19:20, Anton Khirnov wrote:
> Quoting Luca Barbato (2015-10-20 15:07:39)
>> And drop the av_dup_packet from the input_thread.
>> ---
>>  avconv.c            | 1 -
>>  avplay.c            | 4 ----
>>  libavformat/utils.c | 8 ++++++++
>>  3 files changed, 8 insertions(+), 5 deletions(-)
>>
>> diff --git a/avconv.c b/avconv.c
>> index c52f292..f6bcb02 100644
>> --- a/avconv.c
>> +++ b/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);
>> diff --git a/avplay.c b/avplay.c
>> index 546fb90..f063050 100644
>> --- a/avplay.c
>> +++ b/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;
>> diff --git a/libavformat/utils.c b/libavformat/utils.c
>> index f8926bd..fd96b9d 100644
>> --- a/libavformat/utils.c
>> +++ b/libavformat/utils.c
>> @@ -413,6 +413,14 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
>>              continue;
>>          }
>>  
>> +        if (!pkt->buf) {
>> +            AVPacket tmp = { 0 };
> 
> Given 6/6, this will become forbidden. Perhaps you should introduce
> av_packet_clone(), which would do the same as av_frame_clone()
> (alloc+ref)
> 

I considered doing that after alloc + free, would be ok for you if I
first get this set landed and then I go over the AVPackets on stack and
fix all of them?

lu

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to