FS-10286: [mod_conference] Sync member joins up with keyframes in shared encoder mode #resolve
This commit is contained in:
parent
77e7d1c216
commit
a0d0dc2d3e
|
@ -923,16 +923,19 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
|||
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) {
|
||||
context->encoder_ctx->profile = FF_PROFILE_H264_BASELINE;
|
||||
context->encoder_ctx->level = 41;
|
||||
context->encoder_ctx->level = 31;
|
||||
|
||||
if (context->hw_encoder) {
|
||||
av_opt_set(context->encoder_ctx->priv_data, "preset", "llhp", 0);
|
||||
av_opt_set_int(context->encoder_ctx->priv_data, "2pass", 1, 0);
|
||||
} else {
|
||||
av_opt_set(context->encoder_ctx->priv_data, "preset", "veryfast", 0);
|
||||
av_opt_set(context->encoder_ctx->priv_data, "tune", "zerolatency", 0);
|
||||
av_opt_set_int(context->encoder_ctx->priv_data, "intra-refresh", 1, 0);
|
||||
av_opt_set(context->encoder_ctx->priv_data, "preset", "fast", 0);
|
||||
av_opt_set(context->encoder_ctx->priv_data, "tune", "animation+zerolatency", 0);
|
||||
av_opt_set(context->encoder_ctx->priv_data, "profile", "baseline", 0);
|
||||
av_opt_set_int(context->encoder_ctx->priv_data, "slice-max-size", SLICE_SIZE, 0);
|
||||
|
||||
/*
|
||||
av_opt_set_int(context->encoder_ctx->priv_data, "sc_threshold", 40, 0);
|
||||
av_opt_set_int(context->encoder_ctx->priv_data, "b_strategy", 1, 0);
|
||||
av_opt_set_int(context->encoder_ctx->priv_data, "crf", 18, 0);
|
||||
|
@ -948,10 +951,11 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
|||
context->encoder_ctx->keyint_min = 25; // keyint_min=25
|
||||
context->encoder_ctx->i_quant_factor = 0.71; // i_qfactor=0.71
|
||||
context->encoder_ctx->b_quant_factor = 0.76923078; // Qscale difference between P-frames and B-frames.
|
||||
context->encoder_ctx->qcompress = 0.6; // qcomp=0.6
|
||||
context->encoder_ctx->qcompress = 0;//0.6; // qcomp=0.6
|
||||
context->encoder_ctx->qmin = 10; // qmin=10
|
||||
context->encoder_ctx->qmax = 51; // qmax=51
|
||||
context->encoder_ctx->max_qdiff = 4; // qdiff=4
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1148,8 +1152,8 @@ static switch_status_t switch_h264_encode(switch_codec_t *codec, switch_frame_t
|
|||
|
||||
if (context->need_key_frame) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG5, "Send AV KEYFRAME\n");
|
||||
av_opt_set_int(context->encoder_ctx->priv_data, "intra-refresh", 1, 0);
|
||||
avframe->pict_type = AV_PICTURE_TYPE_I;
|
||||
avframe->key_frame = 1;
|
||||
}
|
||||
|
||||
/* encode the image */
|
||||
|
@ -1164,6 +1168,7 @@ static switch_status_t switch_h264_encode(switch_codec_t *codec, switch_frame_t
|
|||
|
||||
if (context->need_key_frame) {
|
||||
avframe->pict_type = 0;
|
||||
avframe->key_frame = 0;
|
||||
context->need_key_frame = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -4186,6 +4186,7 @@ SWITCH_STANDARD_API(uuid_video_refresh_function)
|
|||
|
||||
if ((lsession = switch_core_session_locate(argv[0]))) {
|
||||
switch_core_session_request_video_refresh(lsession);
|
||||
switch_core_media_gen_key_frame(lsession);
|
||||
status = SWITCH_STATUS_SUCCESS;
|
||||
switch_core_session_rwunlock(lsession);
|
||||
}
|
||||
|
|
|
@ -1383,7 +1383,10 @@ switch_status_t conference_video_attach_video_layer(conference_member_t *member,
|
|||
member->video_layer_id = idx;
|
||||
member->canvas_id = canvas->canvas_id;
|
||||
member->layer_timeout = DEFAULT_LAYER_TIMEOUT;
|
||||
canvas->send_keyframe = 1;
|
||||
conference_utils_member_set_flag_locked(member, MFLAG_VIDEO_JOIN);
|
||||
switch_channel_set_flag(member->channel, CF_VIDEO_REFRESH_REQ);
|
||||
|
||||
canvas->send_keyframe = 30;
|
||||
|
||||
//member->watching_canvas_id = canvas->canvas_id;
|
||||
conference_video_check_used_layers(canvas);
|
||||
|
@ -1780,7 +1783,13 @@ void conference_video_write_canvas_image_to_codec_group(conference_obj_t *confer
|
|||
if (imember->video_codec_index != codec_index) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (conference_utils_member_test_flag(imember, MFLAG_VIDEO_JOIN) && !send_keyframe) {
|
||||
continue;
|
||||
}
|
||||
|
||||
conference_utils_member_clear_flag(imember, MFLAG_VIDEO_JOIN);
|
||||
|
||||
if (!imember->session || !switch_channel_test_flag(imember->channel, CF_VIDEO_READY) ||
|
||||
switch_core_session_read_lock(imember->session) != SWITCH_STATUS_SUCCESS) {
|
||||
continue;
|
||||
|
@ -3636,6 +3645,10 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr
|
|||
switch_core_session_read_lock(imember->session) != SWITCH_STATUS_SUCCESS)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (conference_utils_member_test_flag(imember, MFLAG_VIDEO_JOIN)) {
|
||||
send_keyframe = SWITCH_TRUE;
|
||||
}
|
||||
|
||||
if (need_refresh && imember->session) {
|
||||
switch_core_session_request_video_refresh(imember->session);
|
||||
|
@ -3750,7 +3763,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr
|
|||
if (canvas->send_keyframe > 0) {
|
||||
if (canvas->send_keyframe == 1 || (canvas->send_keyframe % 10) == 0) {
|
||||
send_keyframe = SWITCH_TRUE;
|
||||
need_refresh = SWITCH_TRUE;
|
||||
//need_refresh = SWITCH_TRUE;
|
||||
}
|
||||
canvas->send_keyframe--;
|
||||
}
|
||||
|
|
|
@ -214,6 +214,7 @@ typedef enum {
|
|||
MFLAG_INDICATE_UNDEAF,
|
||||
MFLAG_TALK_DATA_EVENTS,
|
||||
MFLAG_NO_VIDEO_BLANKS,
|
||||
MFLAG_VIDEO_JOIN,
|
||||
///////////////////////////
|
||||
MFLAG_MAX
|
||||
} member_flag_t;
|
||||
|
|
|
@ -10498,6 +10498,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if (pass_fmtp) {
|
||||
switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=fmtp:%d %s\r\n", v_engine->cur_payload_map->pt, pass_fmtp);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue