Commit 8a610332 authored by James Almer's avatar James Almer

avutil/samplefmt: don't add offsets to NULL pointers

Signed-off-by: 's avatarJames Almer <jamrial@gmail.com>
parent 7916c147
...@@ -160,13 +160,20 @@ int av_samples_fill_arrays(uint8_t **audio_data, int *linesize, ...@@ -160,13 +160,20 @@ int av_samples_fill_arrays(uint8_t **audio_data, int *linesize,
if (buf_size < 0) if (buf_size < 0)
return buf_size; return buf_size;
if (linesize)
*linesize = line_size;
memset(audio_data, 0, planar
? sizeof(*audio_data) * nb_channels
: sizeof(*audio_data));
if (!buf)
return buf_size;
audio_data[0] = (uint8_t *)buf; audio_data[0] = (uint8_t *)buf;
for (ch = 1; planar && ch < nb_channels; ch++) for (ch = 1; planar && ch < nb_channels; ch++)
audio_data[ch] = audio_data[ch-1] + line_size; audio_data[ch] = audio_data[ch-1] + line_size;
if (linesize)
*linesize = line_size;
return buf_size; return buf_size;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment