[Libav-user] segfault decoding a copied packet
Michael R. Hines
michael at hinespot.com
Mon Dec 24 21:20:42 CET 2012
Hi all,
So, this is related to a previous post: I've written a program that duplicates an AVPacket over the network.
But, when it gets to the decoder on the other side (in another C program talking TCP/IP),
I get this from my debugger:
Program received signal SIGSEGV, Segmentation fault.
avui_decode_frame (avctx=0x0, data=0x15f90, data_size=0x0, avpkt=0x180) at libavcodec/avuidec.c:114
114 a[2 * k ] = 0xFF - (transparent ? *srca++ : 0);
(gdb) bt
#0 avui_decode_frame (avctx=0x0, data=0x15f90, data_size=0x0, avpkt=0x180) at libavcodec/avuidec.c:114
#1 0x00015f90 in ?? ()
(gdb)
The code up to this point was done with the following sequence of a events:
1. avcodec_find_decoder(mpeg2)
2. avcodec_alloc_context3()
3. avcodec_open2()
4. copy the AVPacket to duplicate AVPacket
5. av_malloc() some space to store the duplicate packet data from network
6. assigned the newly allocated memory to the duplicate AVPacket
7. read the packet data bytes from the network
8. avcodec_decode_video2(duplicated packet)
Is av_malloc() not sufficient to duplicate the packet? Do I need to align
the memory somehow before ?
- Michael R. Hines
More information about the Libav-user
mailing list