提交 d9de4134 authored 作者: Anthony Minessale's avatar Anthony Minessale 提交者: Andrey Volk

FS-11394: [mod_av] Fix cpu race created by this patch

上级 f3b65c2e
......@@ -1269,22 +1269,19 @@ GCC_DIAG_ON(deprecated-declarations)
return SWITCH_STATUS_FALSE;
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Could not open hardware codec %s, trying software encoder\n", codec_string);
context->hw_encoder = 0;
av_opt_free(context->encoder_ctx->priv_data);
set_h264_private_data(context, profile);
context->encoder = avcodec_find_encoder(context->av_codec_id);
if (!context->encoder) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot find encoder id: %d\n", context->av_codec_id);
return SWITCH_STATUS_FALSE;
if (context->encoder_ctx) {
if (avcodec_is_open(context->encoder_ctx)) {
avcodec_close(context->encoder_ctx);
}
av_free(context->encoder_ctx);
context->encoder_ctx = NULL;
}
if (avcodec_open2(context->encoder_ctx, context->encoder, NULL) < 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not open codec %s\n", codec_string);
return SWITCH_STATUS_FALSE;
}
context->encoder = NULL;
context->hw_encoder = 0;
context->codec_settings.video.try_hardware_encoder = 0;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Could not open hardware codec %s, trying software encoder\n", codec_string);
return open_encoder(context, width, height);
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "codec opened: %s\n", codec_string);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论