Commit a85a718f authored by Michael Niedermayer's avatar Michael Niedermayer

doc/examples/decoding_encoding: Check all av_samples_get_buffer_size() returns

Fixed CID1135755
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent c89f8f80
......@@ -307,6 +307,11 @@ static void audio_decode_example(const char *outfilename, const char *filename)
int data_size = av_samples_get_buffer_size(NULL, c->channels,
decoded_frame->nb_samples,
c->sample_fmt, 1);
if (data_size < 0) {
/* This should not occur, checking just for paranoia */
fprintf(stderr, "Failed to calculate data size\n");
exit(1);
}
fwrite(decoded_frame->data[0], 1, data_size, outfile);
}
avpkt.size -= len;
......
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