Github user sreid8 commented on a diff in the pull request:
https://github.com/apache/guacamole-server/pull/159#discussion_r173986084
--- Diff: src/guacenc/ffmpeg-compat.c ---
@@ -165,3 +197,62 @@ int guacenc_avcodec_encode_video(guacenc_video* video,
AVFrame* frame) {
#endif
}
+AVCodecContext* guacenc_build_avcodeccontext(AVStream* stream,
+ AVCodec* codec,
+ int bitrate,
+ int width,
+ int height,
+ int gop_size,
+ int qmax,
+ int qmin,
+ int pix_fmt,
+ AVRational time_base) {
+#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(57, 33, 100)
+ stream->codec->bit_rate = bitrate;
--- End diff --
In video.c, the stream is allocated already with the exact same codec that
is passed here. It was only after libavformat 57.33.100 where the codec output
parameters of the video were promoted from ```AVStream->codec->*``` to
```AVStream->codecpar```. The new function ```guacenc_open_avcodec``` handles
moving the parameters from the ```context``` (which are set here) to
```codecpar``` in the case that libavformat >= 57.33.100. This ffmpeg API
change is documented
[here](https://github.com/FFmpeg/FFmpeg/blob/master/doc/APIchanges#L481).
However, before 57.33.100, the ```stream->codec``` is where the parameters
are placed and the ```codec``` member of this struct has already been set to
the proper codec when it was allocated.
---