On 20/10/15 18:51, wm4 wrote:
> On Tue, 20 Oct 2015 18:41:46 +0200
> Luca Barbato <[email protected]> wrote:
> 
>> On 20/10/15 16:03, wm4 wrote:
>>> I don't understand the condition for the last parameter to
>>> add_to_pktbuf. Something about the packet being already referenced in
>>> some cases?  
>>
>> If the memory comes from the parser it is a chunk of a packet, so you
>> create a new packet out of it.
>>
>> If the packet parsed is the same as the input packet, you just take it
>> as is.
>>
>> I'll doublecheck that part again to see if I can make easier to follow.
> 
> This should not matter if you just use av_packet_ref().

Actually you are right and it can be simplified like this:

diff --git a/libavformat/utils.c b/libavformat/utils.c
index a9b864a..42f60d5 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -848,15 +848,9 @@ static int parse_packet(AVFormatContext *s,
AVPacket *pkt, int stream_index)
                                0, 0, AVINDEX_KEYFRAME);
         }

-        if (out_pkt.data == pkt->data && out_pkt.size == pkt->size) {
-            out_pkt.buf = pkt->buf;
-            pkt->buf    = NULL;
-        }
-
         if ((ret = add_to_pktbuf(&s->internal->parse_queue, &out_pkt,
                                  &s->internal->parse_queue_end,
-                                 out_pkt.data != pkt->data ||
-                                 out_pkt.size != pkt->size) < 0)) {
+                                 1))) {
             av_packet_unref(&out_pkt);
             goto fail;
         }

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

Reply via email to