if (av_samples_alloc(audio_frame->data, nullptr, 2, num_samples, ctx->sample_fmt, 0) < 0) {
fprintf(stderr, "Could not allocate %zu samples.\n", num_samples);
if (av_samples_alloc(audio_frame->data, nullptr, 2, num_samples, ctx->sample_fmt, 0) < 0) {
fprintf(stderr, "Could not allocate %zu samples.\n", num_samples);