You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
tests/api-flac-test: ensure the frame is writable before writing to it
The encoder may keep a reference to frames that were sent to it, so the caller cannot modify them without checking first.
This commit is contained in:
@@ -154,6 +154,10 @@ static int run_test(AVCodec *enc, AVCodec *dec, AVCodecContext *enc_ctx,
|
|||||||
enc_pkt.data = NULL;
|
enc_pkt.data = NULL;
|
||||||
enc_pkt.size = 0;
|
enc_pkt.size = 0;
|
||||||
|
|
||||||
|
result = av_frame_make_writable(in_frame);
|
||||||
|
if (result < 0)
|
||||||
|
return result;
|
||||||
|
|
||||||
generate_raw_frame((uint16_t*)(in_frame->data[0]), i, enc_ctx->sample_rate,
|
generate_raw_frame((uint16_t*)(in_frame->data[0]), i, enc_ctx->sample_rate,
|
||||||
enc_ctx->channels, enc_ctx->frame_size);
|
enc_ctx->channels, enc_ctx->frame_size);
|
||||||
in_frame_bytes = in_frame->nb_samples * in_frame->channels * sizeof(uint16_t);
|
in_frame_bytes = in_frame->nb_samples * in_frame->channels * sizeof(uint16_t);
|
||||||
|
Reference in New Issue
Block a user