FS-9494 #resolve [Issues with video avatar switching when video starts/stops]
This commit is contained in:
parent
55e41a8ea3
commit
34bff55ffd
|
@ -711,6 +711,7 @@ void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *ob
|
|||
conference_video_check_avatar(member, SWITCH_FALSE);
|
||||
switch_core_session_video_reinit(member->session);
|
||||
conference_video_set_floor_holder(member->conference, member, SWITCH_FALSE);
|
||||
conference_video_check_flush(member, SWITCH_TRUE);
|
||||
switch_core_session_request_video_refresh(member->session);
|
||||
} else if (conference_utils_member_test_flag(member, MFLAG_ACK_VIDEO) && !switch_channel_test_flag(channel, CF_VIDEO)) {
|
||||
conference_video_check_avatar(member, SWITCH_FALSE);
|
||||
|
|
|
@ -1201,7 +1201,7 @@ switch_status_t conference_member_del(conference_obj_t *conference, conference_m
|
|||
conference->count--;
|
||||
}
|
||||
|
||||
conference_video_check_flush(member);
|
||||
conference_video_check_flush(member, SWITCH_FALSE);
|
||||
|
||||
if (conference_utils_member_test_flag(member, MFLAG_ENDCONF)) {
|
||||
if (!--conference->end_count) {
|
||||
|
|
|
@ -1700,6 +1700,7 @@ void conference_video_check_avatar(conference_member_t *member, switch_bool_t fo
|
|||
{
|
||||
const char *avatar = NULL, *var = NULL;
|
||||
mcu_canvas_t *canvas;
|
||||
int novid = 0;
|
||||
|
||||
if (member->canvas_id < 0) {
|
||||
return;
|
||||
|
@ -1732,6 +1733,7 @@ void conference_video_check_avatar(conference_member_t *member, switch_bool_t fo
|
|||
switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_SENDONLY && switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_INACTIVE) {
|
||||
conference_utils_member_set_flag_locked(member, MFLAG_ACK_VIDEO);
|
||||
switch_core_session_request_video_refresh(member->session);
|
||||
conference_video_check_flush(member, SWITCH_TRUE);
|
||||
} else {
|
||||
if (member->conference->no_video_avatar) {
|
||||
avatar = member->conference->no_video_avatar;
|
||||
|
@ -1740,6 +1742,7 @@ void conference_video_check_avatar(conference_member_t *member, switch_bool_t fo
|
|||
if ((var = switch_channel_get_variable_dup(member->channel, "video_no_video_avatar_png", SWITCH_FALSE, -1))) {
|
||||
avatar = var;
|
||||
}
|
||||
novid++;
|
||||
}
|
||||
|
||||
if ((var = switch_channel_get_variable_dup(member->channel, "video_avatar_png", SWITCH_FALSE, -1))) {
|
||||
|
@ -1756,23 +1759,27 @@ void conference_video_check_avatar(conference_member_t *member, switch_bool_t fo
|
|||
switch_img_copy(member->video_mute_img, &member->avatar_png_img);
|
||||
}
|
||||
|
||||
if (avatar && novid) {
|
||||
member->auto_avatar = 1;
|
||||
}
|
||||
|
||||
if (canvas) {
|
||||
switch_mutex_unlock(canvas->mutex);
|
||||
conference_video_release_canvas(&canvas);
|
||||
}
|
||||
}
|
||||
|
||||
void conference_video_check_flush(conference_member_t *member)
|
||||
void conference_video_check_flush(conference_member_t *member, switch_bool_t force)
|
||||
{
|
||||
int flushed;
|
||||
|
||||
if (!member->channel || !switch_channel_test_flag(member->channel, CF_VIDEO_READY)) {
|
||||
if (!member->channel || !switch_channel_test_flag(member->channel, CF_VIDEO)) {
|
||||
return;
|
||||
}
|
||||
|
||||
flushed = conference_video_flush_queue(member->video_queue, 1);
|
||||
|
||||
if (flushed && member->auto_avatar) {
|
||||
if ((flushed || force) && member->auto_avatar) {
|
||||
switch_channel_video_sync(member->channel);
|
||||
|
||||
switch_img_free(&member->avatar_png_img);
|
||||
|
@ -1931,11 +1938,11 @@ void conference_video_pop_next_image(conference_member_t *member, switch_image_t
|
|||
int size = 0;
|
||||
void *pop;
|
||||
|
||||
if (member->avatar_png_img && switch_channel_test_flag(member->channel, CF_VIDEO_READY) && conference_utils_member_test_flag(member, MFLAG_ACK_VIDEO)) {
|
||||
switch_img_free(&member->avatar_png_img);
|
||||
}
|
||||
//if (member->avatar_png_img && switch_channel_test_flag(member->channel, CF_VIDEO_READY) && conference_utils_member_test_flag(member, MFLAG_ACK_VIDEO)) {
|
||||
// switch_img_free(&member->avatar_png_img);
|
||||
//}
|
||||
|
||||
if (!member->avatar_png_img && switch_channel_test_flag(member->channel, CF_VIDEO_READY)) {
|
||||
if (switch_channel_test_flag(member->channel, CF_VIDEO_READY)) {
|
||||
do {
|
||||
if (switch_queue_trypop(member->video_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
|
||||
switch_img_free(&img);
|
||||
|
@ -1952,36 +1959,37 @@ void conference_video_pop_next_image(conference_member_t *member, switch_image_t
|
|||
switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_SENDONLY &&
|
||||
switch_core_session_media_flow(member->session, SWITCH_MEDIA_TYPE_VIDEO) != SWITCH_MEDIA_FLOW_INACTIVE
|
||||
) {
|
||||
|
||||
|
||||
|
||||
if (img) {
|
||||
member->good_img++;
|
||||
if ((member->good_img % (int)(member->conference->video_fps.fps * 10)) == 0) {
|
||||
conference_video_reset_video_bitrate_counters(member);
|
||||
}
|
||||
|
||||
if (member->auto_avatar && member->good_img > member->conference->video_fps.fps * 3) {
|
||||
conference_video_check_flush(member, SWITCH_TRUE);
|
||||
}
|
||||
|
||||
} else {
|
||||
member->blanks++;
|
||||
member->good_img = 0;
|
||||
|
||||
|
||||
if (member->blanks == member->conference->video_fps.fps || (member->blanks % (int)(member->conference->video_fps.fps * 10)) == 0) {
|
||||
switch_core_session_request_video_refresh(member->session);
|
||||
member->good_img = 0;
|
||||
}
|
||||
|
||||
if (member->blanks == member->conference->video_fps.fps * 5) {
|
||||
member->blackouts++;
|
||||
conference_video_check_avatar(member, SWITCH_TRUE);
|
||||
conference_video_clear_managed_kps(member);
|
||||
|
||||
if (member->avatar_png_img) {
|
||||
//if (layer) {
|
||||
//layer->is_avatar = 1;
|
||||
//}
|
||||
|
||||
member->auto_avatar = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
conference_video_check_flush(member);
|
||||
conference_video_check_flush(member, SWITCH_FALSE);
|
||||
}
|
||||
|
||||
*imgP = img;
|
||||
|
@ -3647,7 +3655,7 @@ void conference_video_set_floor_holder(conference_obj_t *conference, conference_
|
|||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "Adding video floor %s\n",
|
||||
switch_channel_get_name(member->channel));
|
||||
|
||||
conference_video_check_flush(member);
|
||||
conference_video_check_flush(member, SWITCH_FALSE);
|
||||
switch_core_session_video_reinit(member->session);
|
||||
conference->video_floor_holder = member->id;
|
||||
conference_member_update_status_field(member);
|
||||
|
|
|
@ -949,7 +949,7 @@ void conference_video_layer_set_banner(conference_member_t *member, mcu_layer_t
|
|||
void conference_video_layer_set_logo(conference_member_t *member, mcu_layer_t *layer, const char *path);
|
||||
void conference_video_detach_video_layer(conference_member_t *member);
|
||||
void conference_video_check_used_layers(mcu_canvas_t *canvas);
|
||||
void conference_video_check_flush(conference_member_t *member);
|
||||
void conference_video_check_flush(conference_member_t *member, switch_bool_t force);
|
||||
void conference_video_set_canvas_letterbox_bgcolor(mcu_canvas_t *canvas, char *color);
|
||||
void conference_video_set_canvas_bgcolor(mcu_canvas_t *canvas, char *color);
|
||||
void conference_video_scale_and_patch(mcu_layer_t *layer, switch_image_t *ximg, switch_bool_t freeze);
|
||||
|
|
Loading…
Reference in New Issue