@@ -82745,7 +82745,7 @@ static void vc_init_encoder_h265(Logger *log, VCSession *vc, uint32_t bit_rate,
82745
82745
//**//uint32_t bit_rate_override = 800 * 1000;
82746
82746
vc->h264_enc_bitrate = bit_rate;
82747
82747
//******// param->bitrate =
82748
- printf("x265 [###] vc_init_encoder_h265:bit_rate = %d\n", (int)(bit_rate / 1000));
82748
+ printf("x265 [#### ] vc_init_encoder_h265:bit_rate = %d\n", (int)(bit_rate / 1000));
82749
82749
82750
82750
82751
82751
// param->bConfigRCFrame = 1; // --frame-rc
@@ -82912,15 +82912,29 @@ int vc_reconfigure_encoder_h265(Logger *log, VCSession *vc, uint32_t bit_rate,
82912
82912
(vc->h265_enc_height == height) &&
82913
82913
(vc->h264_enc_bitrate == bit_rate))
82914
82914
{
82915
+ x265_param *param = x265_param_alloc();
82916
+ x265_encoder_parameters(vc->h265_encoder, param);
82917
+
82918
+ param->rc.bitrate = (int)(bit_rate / 1000);
82919
+ param->rc.vbvBufferSize = 50 + (((int)(bit_rate / 1000)) * VIDEO_BUF_FACTOR_H264);
82920
+ param->rc.vbvMaxBitrate = ((int)(bit_rate / 1000)) - 1;
82921
+
82922
+ int res = x265_encoder_reconfig(vc->h265_encoder, param);
82923
+ x265_param_free(param);
82924
+ setvbuf(stdout, NULL, _IOLBF, 0);
82925
+ setvbuf(stderr, NULL, _IOLBF, 0);
82926
+ printf("x265 [*F**] x265_encoder_reconfig:res=%d bitrate=%d\n", (int)res, (int)(bit_rate / 1000));
82927
+
82915
82928
// no change
82916
82929
return 0;
82917
82930
}
82918
82931
82919
82932
if ((vc->h265_enc_width == width) &&
82920
- (vc->h265_enc_height == height) &&
82921
- (vc->h264_enc_bitrate != bit_rate))
82933
+ (vc->h265_enc_height == height)
82934
+ // && (vc->h264_enc_bitrate != bit_rate)
82935
+ )
82922
82936
{
82923
- #if 0
82937
+ #if 1
82924
82938
// HINT: just bitrate has changed
82925
82939
// LOGGER_API_WARNING(vc->av->tox, "vc_reconfigure_encoder_h265:1:bit_rate = %d vc->h264_enc_bitrate = %d", (int)bit_rate, (int)vc->h264_enc_bitrate);
82926
82940
x265_param *param = x265_param_alloc();
@@ -82934,19 +82948,7 @@ int vc_reconfigure_encoder_h265(Logger *log, VCSession *vc, uint32_t bit_rate,
82934
82948
x265_param_free(param);
82935
82949
setvbuf(stdout, NULL, _IOLBF, 0);
82936
82950
setvbuf(stderr, NULL, _IOLBF, 0);
82937
- printf("x265 [****] x265_encoder_reconfig:res=%d bitrate=%d\n", (int)res, (int)(bit_rate / 1000));
82938
- #else
82939
- // HINT: more has changed do a full encoder shutdown and re-init
82940
- vc_kill_encoder_h265(vc);
82941
- vc->h265_enc_height = height;
82942
- vc->h265_enc_width = width;
82943
- // LOGGER_API_WARNING(vc->av->tox, "vc_reconfigure_encoder_h265:2:bit_rate = %d vc->h264_enc_bitrate = %d", (int)bit_rate, (int)vc->h264_enc_bitrate);
82944
- vc_init_encoder_h265(log, vc, bit_rate, width, height);
82945
-
82946
- setvbuf(stdout, NULL, _IOLBF, 0);
82947
- setvbuf(stderr, NULL, _IOLBF, 0);
82948
- printf("x265 [****] x265_encoder_reconfig:bitrate=%d\n", (int)(bit_rate / 1000));
82949
-
82951
+ printf("x265 [*R**] x265_encoder_reconfig:res=%d bitrate=%d\n", (int)res, (int)(bit_rate / 1000));
82950
82952
#endif
82951
82953
}
82952
82954
else
0 commit comments