From eae680fe85f770efbcc87ee980eea2e1f9c383ab Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Tue, 23 Aug 2016 17:57:24 +0200 Subject: [PATCH] Libavcodec: use tune zerolatency for x265 x265 supports only single tune parameter (in opposite to x264, where we currently use "zerolatency,fastdecode"). --- src/video_compress/libavcodec.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/video_compress/libavcodec.cpp b/src/video_compress/libavcodec.cpp index 13edbb8b5..984f229cf 100644 --- a/src/video_compress/libavcodec.cpp +++ b/src/video_compress/libavcodec.cpp @@ -1075,10 +1075,15 @@ static void setparam_default(AVCodecContext *codec_ctx, struct setparam_param *p static void configure_x264_x265(AVCodecContext *codec_ctx, struct setparam_param *param) { - int ret; - ret = av_opt_set(codec_ctx->priv_data, "tune", "zerolatency,fastdecode", 0); + const char *tune; + if (codec_ctx->codec->id == AV_CODEC_ID_H264) { + tune = "zerolatency,fastdecode"; + } else { // x265 supports only single tune parameter + tune = "zerolatency"; + } + int ret = av_opt_set(codec_ctx->priv_data, "tune", tune, 0); if (ret != 0) { - log_msg(LOG_LEVEL_WARNING, "[lavc] Unable to set tune zerolatency/fastdecode.\n"); + log_msg(LOG_LEVEL_WARNING, "[lavc] Unable to set tune %s.\n", tune); } // try to keep frame sizes as even as possible