mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-06-01 03:05:50 +00:00
FS-11177: [freeswitch-core] h264 vid tweaks #resolve
This commit is contained in:
parent
d3d7b6878e
commit
fe8c1be575
@ -829,7 +829,8 @@ static switch_status_t open_encoder(h264_codec_context_t *context, uint32_t widt
|
|||||||
{
|
{
|
||||||
int sane = 0;
|
int sane = 0;
|
||||||
int threads = switch_core_cpu_count();
|
int threads = switch_core_cpu_count();
|
||||||
|
int fps = 15;
|
||||||
|
|
||||||
#ifdef NVENC_SUPPORT
|
#ifdef NVENC_SUPPORT
|
||||||
if (!context->encoder) {
|
if (!context->encoder) {
|
||||||
if (context->av_codec_id == AV_CODEC_ID_H264) {
|
if (context->av_codec_id == AV_CODEC_ID_H264) {
|
||||||
@ -903,10 +904,21 @@ static switch_status_t open_encoder(h264_codec_context_t *context, uint32_t widt
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (threads > 4) threads = 4;
|
if (threads > 4) threads = 4;
|
||||||
context->bandwidth *= 4;
|
|
||||||
|
|
||||||
|
context->bandwidth *= 3;
|
||||||
|
|
||||||
|
fps = context->codec_settings.video.fps;
|
||||||
|
|
||||||
|
if (!fps) fps = 20;
|
||||||
|
|
||||||
context->encoder_ctx->bit_rate = context->bandwidth * 1024;
|
context->encoder_ctx->bit_rate = context->bandwidth * 1024;
|
||||||
|
context->encoder_ctx->rc_min_rate = context->encoder_ctx->bit_rate;
|
||||||
|
context->encoder_ctx->rc_max_rate = context->encoder_ctx->bit_rate;
|
||||||
|
context->encoder_ctx->rc_buffer_size = context->encoder_ctx->bit_rate;
|
||||||
|
context->encoder_ctx->qcompress = 0.6;
|
||||||
|
context->encoder_ctx->gop_size = fps * 2;
|
||||||
|
context->encoder_ctx->keyint_min = fps * 2;
|
||||||
|
|
||||||
context->encoder_ctx->width = context->codec_settings.video.width;
|
context->encoder_ctx->width = context->codec_settings.video.width;
|
||||||
context->encoder_ctx->height = context->codec_settings.video.height;
|
context->encoder_ctx->height = context->codec_settings.video.height;
|
||||||
/* frames per second */
|
/* frames per second */
|
||||||
@ -915,9 +927,6 @@ static switch_status_t open_encoder(h264_codec_context_t *context, uint32_t widt
|
|||||||
context->encoder_ctx->pix_fmt = AV_PIX_FMT_YUV420P;
|
context->encoder_ctx->pix_fmt = AV_PIX_FMT_YUV420P;
|
||||||
context->encoder_ctx->thread_count = threads;
|
context->encoder_ctx->thread_count = threads;
|
||||||
|
|
||||||
context->encoder_ctx->rc_max_rate = context->bandwidth * 1024;
|
|
||||||
context->encoder_ctx->rc_buffer_size = context->bandwidth * 1024 * 4;
|
|
||||||
|
|
||||||
if (context->av_codec_id == AV_CODEC_ID_H263 || context->av_codec_id == AV_CODEC_ID_H263P) {
|
if (context->av_codec_id == AV_CODEC_ID_H263 || context->av_codec_id == AV_CODEC_ID_H263P) {
|
||||||
#ifndef H263_MODE_B
|
#ifndef H263_MODE_B
|
||||||
# if defined(__ICL) || defined (__INTEL_COMPILER)
|
# if defined(__ICL) || defined (__INTEL_COMPILER)
|
||||||
@ -934,7 +943,6 @@ FF_DISABLE_DEPRECATION_WARNINGS
|
|||||||
context->encoder_ctx->rtp_callback = rtp_callback;
|
context->encoder_ctx->rtp_callback = rtp_callback;
|
||||||
FF_ENABLE_DEPRECATION_WARNINGS
|
FF_ENABLE_DEPRECATION_WARNINGS
|
||||||
#endif
|
#endif
|
||||||
context->encoder_ctx->rc_min_rate = context->encoder_ctx->rc_max_rate;
|
|
||||||
context->encoder_ctx->opaque = context;
|
context->encoder_ctx->opaque = context;
|
||||||
av_opt_set_int(context->encoder_ctx->priv_data, "mb_info", SLICE_SIZE - 8, 0);
|
av_opt_set_int(context->encoder_ctx->priv_data, "mb_info", SLICE_SIZE - 8, 0);
|
||||||
} else if (context->av_codec_id == AV_CODEC_ID_H264) {
|
} else if (context->av_codec_id == AV_CODEC_ID_H264) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user