On Tue, Jan 15, 2013 at 4:27 PM, David Longest
<[email protected]> wrote:
>
> I have found what my problem was. As the following code sample would show, I
> was using av_malloc to allocate an AVPacket on the heap. While I called
> av_init_packet to initialize the fields of the AVPacket struct, that function
> does not zero out the data or size field. Changing this to av_mallocz instead
> fixed the issue I was running into.
There is little advantage in allocation AVPacket in the heap. In the
“decoding_encoding.c” example, the packet structure is placed on stack
and reused during encoding; but for each frame it is re-initialized
av_init_packet(&pkt);
pkt.data = NULL; // packet data will be allocated by the encoder
pkt.size = 0;
Anyways, it's good that you succeeded to resolve your problem.
Alex
_______________________________________________
Libav-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/libav-user