On Mon, 19 May 2014 11:32:58 +0200, Alessandro Ghedini <[email protected]> wrote: > On Sun, May 18, 2014 at 09:20:07PM +0200, Anton Khirnov wrote: > > > > On Sun, 18 May 2014 14:35:28 +0200, Alessandro Ghedini > > <[email protected]> wrote: > > > Well, now it doesn't segfault or spit free() errors, but it still fails > > > with: > > > > > > [gif @ 0x31b3820] Invalid palette extradata > > > av_interleaved_write_frame(): Invalid data found when processing input > > > > > > so it looks like the side data is still not copied properly. What fixes > > > it is > > > the following: > > > > > > diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c > > > index c0a0f8c..f3edd37 100644 > > > --- a/libavcodec/avpacket.c > > > +++ b/libavcodec/avpacket.c > > > @@ -327,20 +327,25 @@ int av_packet_copy_props(AVPacket *dst, const > > > AVPacket *src) > > > dst->stream_index = src->stream_index; > > > dst->side_data_elems = src->side_data_elems; > > > > > > - for (i = 0; i < src->side_data_elems; i++) { > > > - enum AVPacketSideDataType type = src->side_data[i].type; > > > - int size = src->side_data[i].size; > > > - uint8_t *src_data = src->side_data[i].data; > > > - uint8_t *dst_data = av_packet_new_side_data(dst, type, size); > > > - > > > - if (!dst_data) { > > > - av_packet_free_side_data(dst); > > > - return AVERROR(ENOMEM); > > > + if (src->side_data_elems) { > > > + DUP_DATA(dst->side_data, src->side_data, > > > + src->side_data_elems * sizeof(*src->side_data), 0, > > > ALLOC_MALLOC); > > > + if (src != dst) { > > > + memset(dst->side_data, 0, > > > + src->side_data_elems * sizeof(*src->side_data)); > > > + } > > > + for (i = 0; i < src->side_data_elems; i++) { > > > + DUP_DATA(dst->side_data[i].data, src->side_data[i].data, > > > + src->side_data[i].size, 1, ALLOC_MALLOC); > > > + dst->side_data[i].size = src->side_data[i].size; > > > + dst->side_data[i].type = src->side_data[i].type; > > > } > > > - memcpy(dst_data, src_data, size); > > > } > > > - > > > + dst->side_data_elems = src->side_data_elems; > > > return 0; > > > + > > > +failed_alloc: > > > + return AVERROR(ENOMEM); > > > } > > > > > > i.e. doing what ffmpeg's av_copy_packet_side_data() does, but in > > > av_packet_copy_props(). Not sure if it's correct. > > > > Just found a bug in av_packet_copy_props(), which almost surely causes this > > problem. > > > > Try the patch I just sent to the ML. > > Yup, that works!!! That only leaves the pix fmt problem now. >
Comparing the codes, seems like removing the avpriv_set_systematic_pal2() is the cause -- Anton Khirnov _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
