From bf5e9b89d2a67c293aae503c03e193307ea7990b Mon Sep 17 00:00:00 2001 From: mannol Date: Thu, 13 Aug 2015 00:19:24 +0200 Subject: Fix bug in codec initialization --- toxav/video.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'toxav/video.c') diff --git a/toxav/video.c b/toxav/video.c index f5f9f513..389d2e1c 100644 --- a/toxav/video.c +++ b/toxav/video.c @@ -324,17 +324,9 @@ bool create_video_encoder (vpx_codec_ctx_t* dest, int32_t bit_rate) return false; } - rc = vpx_codec_enc_init_ver(dest, VIDEO_CODEC_ENCODER_INTERFACE, &cfg, 0, - VPX_ENCODER_ABI_VERSION); - - if ( rc != VPX_CODEC_OK) { - LOGGER_ERROR("Failed to initialize encoder: %s", vpx_codec_err_to_string(rc)); - return false; - } - cfg.rc_target_bitrate = bit_rate; - cfg.g_w = 800; - cfg.g_h = 600; + cfg.g_w = 4000; + cfg.g_h = 4000; cfg.g_pass = VPX_RC_ONE_PASS; cfg.g_error_resilient = VPX_ERROR_RESILIENT_DEFAULT | VPX_ERROR_RESILIENT_PARTITIONS; cfg.g_lag_in_frames = 0; @@ -342,6 +334,14 @@ bool create_video_encoder (vpx_codec_ctx_t* dest, int32_t bit_rate) cfg.kf_max_dist = 48; cfg.kf_mode = VPX_KF_AUTO; + rc = vpx_codec_enc_init_ver(dest, VIDEO_CODEC_ENCODER_INTERFACE, &cfg, 0, + VPX_ENCODER_ABI_VERSION); + + if ( rc != VPX_CODEC_OK) { + LOGGER_ERROR("Failed to initialize encoder: %s", vpx_codec_err_to_string(rc)); + return false; + } + rc = vpx_codec_control(dest, VP8E_SET_CPUUSED, 8); if ( rc != VPX_CODEC_OK) { -- cgit v1.2.3