[FFmpeg-devel] 0001-fix-segment-fault-in-function-decode
陈督
cnduxd at 163.com
Fri Jan 12 23:57:18 EET 2024
/*When it is not a planar arrangement, data[1] is empty,
and all the data is interleaved in data[0].
This can result in a segmentation fault when accessing data[ch] .*/
//So I delete the code below:
for (i = 0; i < frame->nb_samples; i++)
for (ch = 0; ch < dec_ctx->ch_layout.nb_channels; ch++)
fwrite(frame->data[ch] + data_size*i, 1, data_size, outfile);
//And I write this instead
// L R data order
if (av_sample_fmt_is_planar(dec_ctx->sample_fmt))
{
// planar:LLL...RRR... in different data[ch]
for (ch = 0; ch < dec_ctx->ch_layout.nb_channels; ch++)
{
fwrite(frame->data[ch], 1, frame->linesize[0], outfile); // only linesize[0] has data.
}
}
else
{
// not planar:LRLR...all in data[0]
fwrite(frame->data[0], 1, frame->linesize[0], outfile);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-fix-segment-fault-in-doc-examples-decode_audio.c.patch
Type: application/octet-stream
Size: 3332 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20240113/37203f87/attachment.obj>
More information about the ffmpeg-devel
mailing list