Skip to content

Commit b89a01c

Browse files
committed
XX DEBUG
1 parent cb0d6d2 commit b89a01c

File tree

2 files changed

+38
-34
lines changed

2 files changed

+38
-34
lines changed

amalgamation/toxcore_amalgamation.c

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -82745,7 +82745,7 @@ static void vc_init_encoder_h265(Logger *log, VCSession *vc, uint32_t bit_rate,
8274582745
//**//uint32_t bit_rate_override = 800 * 1000;
8274682746
vc->h264_enc_bitrate = bit_rate;
8274782747
//******// 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));
8274982749

8275082750

8275182751
// param->bConfigRCFrame = 1; // --frame-rc
@@ -82912,15 +82912,29 @@ int vc_reconfigure_encoder_h265(Logger *log, VCSession *vc, uint32_t bit_rate,
8291282912
(vc->h265_enc_height == height) &&
8291382913
(vc->h264_enc_bitrate == bit_rate))
8291482914
{
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+
8291582928
// no change
8291682929
return 0;
8291782930
}
8291882931

8291982932
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+
)
8292282936
{
82923-
#if 0
82937+
#if 1
8292482938
// HINT: just bitrate has changed
8292582939
// 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);
8292682940
x265_param *param = x265_param_alloc();
@@ -82934,19 +82948,7 @@ int vc_reconfigure_encoder_h265(Logger *log, VCSession *vc, uint32_t bit_rate,
8293482948
x265_param_free(param);
8293582949
setvbuf(stdout, NULL, _IOLBF, 0);
8293682950
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));
8295082952
#endif
8295182953
}
8295282954
else

toxav/codecs/h264/codec.c

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1980,7 +1980,7 @@ static void vc_init_encoder_h265(Logger *log, VCSession *vc, uint32_t bit_rate,
19801980
//**//uint32_t bit_rate_override = 800 * 1000;
19811981
vc->h264_enc_bitrate = bit_rate;
19821982
//******// param->bitrate =
1983-
printf("x265 [###] vc_init_encoder_h265:bit_rate = %d\n", (int)(bit_rate / 1000));
1983+
printf("x265 [####] vc_init_encoder_h265:bit_rate = %d\n", (int)(bit_rate / 1000));
19841984

19851985

19861986
// param->bConfigRCFrame = 1; // --frame-rc
@@ -2147,15 +2147,29 @@ int vc_reconfigure_encoder_h265(Logger *log, VCSession *vc, uint32_t bit_rate,
21472147
(vc->h265_enc_height == height) &&
21482148
(vc->h264_enc_bitrate == bit_rate))
21492149
{
2150+
x265_param *param = x265_param_alloc();
2151+
x265_encoder_parameters(vc->h265_encoder, param);
2152+
2153+
param->rc.bitrate = (int)(bit_rate / 1000);
2154+
param->rc.vbvBufferSize = 50 + (((int)(bit_rate / 1000)) * VIDEO_BUF_FACTOR_H264);
2155+
param->rc.vbvMaxBitrate = ((int)(bit_rate / 1000)) - 1;
2156+
2157+
int res = x265_encoder_reconfig(vc->h265_encoder, param);
2158+
x265_param_free(param);
2159+
setvbuf(stdout, NULL, _IOLBF, 0);
2160+
setvbuf(stderr, NULL, _IOLBF, 0);
2161+
printf("x265 [*F**] x265_encoder_reconfig:res=%d bitrate=%d\n", (int)res, (int)(bit_rate / 1000));
2162+
21502163
// no change
21512164
return 0;
21522165
}
21532166

21542167
if ((vc->h265_enc_width == width) &&
2155-
(vc->h265_enc_height == height) &&
2156-
(vc->h264_enc_bitrate != bit_rate))
2168+
(vc->h265_enc_height == height)
2169+
// && (vc->h264_enc_bitrate != bit_rate)
2170+
)
21572171
{
2158-
#if 0
2172+
#if 1
21592173
// HINT: just bitrate has changed
21602174
// 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);
21612175
x265_param *param = x265_param_alloc();
@@ -2169,19 +2183,7 @@ int vc_reconfigure_encoder_h265(Logger *log, VCSession *vc, uint32_t bit_rate,
21692183
x265_param_free(param);
21702184
setvbuf(stdout, NULL, _IOLBF, 0);
21712185
setvbuf(stderr, NULL, _IOLBF, 0);
2172-
printf("x265 [****] x265_encoder_reconfig:res=%d bitrate=%d\n", (int)res, (int)(bit_rate / 1000));
2173-
#else
2174-
// HINT: more has changed do a full encoder shutdown and re-init
2175-
vc_kill_encoder_h265(vc);
2176-
vc->h265_enc_height = height;
2177-
vc->h265_enc_width = width;
2178-
// 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);
2179-
vc_init_encoder_h265(log, vc, bit_rate, width, height);
2180-
2181-
setvbuf(stdout, NULL, _IOLBF, 0);
2182-
setvbuf(stderr, NULL, _IOLBF, 0);
2183-
printf("x265 [****] x265_encoder_reconfig:bitrate=%d\n", (int)(bit_rate / 1000));
2184-
2186+
printf("x265 [*R**] x265_encoder_reconfig:res=%d bitrate=%d\n", (int)res, (int)(bit_rate / 1000));
21852187
#endif
21862188
}
21872189
else

0 commit comments

Comments
 (0)