From 78fe819e0f30c19b8463c6999195a38eb350b8eb Mon Sep 17 00:00:00 2001
From: Julian Rother <julianr@fsmpi.rwth-aachen.de>
Date: Mon, 27 Nov 2017 01:03:42 +0100
Subject: [PATCH] transcode: Fix frame_size setting

---
 transcode.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/transcode.c b/transcode.c
index 782e9a4..42f179b 100644
--- a/transcode.c
+++ b/transcode.c
@@ -171,6 +171,9 @@ static void setup_output_stream(char *stream, AVStream *st, AVCodecContext *enc,
 	parse_dict(&opts, jlookup(stream, "options"));
 	if ((err = avcodec_open2(enc, enc->codec, &opts)) < 0)
 		job_failed("Opening encoder failed: %s", av_err2str(err));
+	if (enc->codec_type == AVMEDIA_TYPE_AUDIO &&
+			!(enc->codec->capabilities & AV_CODEC_CAP_VARIABLE_FRAME_SIZE && enc->frame_size))
+		av_buffersink_set_frame_size(sink, enc->frame_size);
 	assert_empty_opts(opts);
 	avcodec_parameters_from_context(st->codecpar, enc);
 }
-- 
GitLab