mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-13 15:50:59 +00:00
fix vid switching in webrtc
This commit is contained in:
parent
230e005a08
commit
850c154bd4
@ -1599,7 +1599,7 @@ static switch_status_t conference_add_member(conference_obj_t *conference, confe
|
||||
static void conference_set_video_floor_holder(conference_obj_t *conference, conference_member_t *member, switch_bool_t force)
|
||||
{
|
||||
switch_event_t *event;
|
||||
conference_member_t *old_member = NULL;
|
||||
conference_member_t *old_member = NULL, *imember = NULL;
|
||||
int old_id = 0;
|
||||
|
||||
if (!member) {
|
||||
@ -1623,8 +1623,6 @@ static void conference_set_video_floor_holder(conference_obj_t *conference, conf
|
||||
|
||||
switch_mutex_lock(conference->mutex);
|
||||
if (!member) {
|
||||
conference_member_t *imember;
|
||||
|
||||
for (imember = conference->members; imember; imember = imember->next) {
|
||||
if (imember != conference->video_floor_holder && imember->channel && switch_channel_test_flag(imember->channel, CF_VIDEO)) {
|
||||
member = imember;
|
||||
@ -1648,6 +1646,20 @@ static void conference_set_video_floor_holder(conference_obj_t *conference, conf
|
||||
//switch_channel_clear_flag(old_member->channel, CF_VIDEO_PASSIVE);
|
||||
}
|
||||
|
||||
for (imember = conference->members; imember; imember = imember->next) {
|
||||
if (!imember->channel || !switch_channel_test_flag(imember->channel, CF_VIDEO)) {
|
||||
continue;
|
||||
}
|
||||
switch_channel_clear_flag(imember->channel, CF_VIDEO_ECHO);
|
||||
|
||||
if (imember == conference->video_floor_holder) {
|
||||
switch_channel_set_flag(imember->channel, CF_VIDEO_PASSIVE);
|
||||
} else {
|
||||
switch_channel_clear_flag(imember->channel, CF_VIDEO_PASSIVE);
|
||||
}
|
||||
switch_core_session_refresh_video(imember->session);
|
||||
}
|
||||
|
||||
switch_set_flag(conference, CFLAG_FLOOR_CHANGE);
|
||||
switch_mutex_unlock(conference->mutex);
|
||||
|
||||
@ -7505,6 +7517,7 @@ SWITCH_STANDARD_APP(conference_function)
|
||||
switch_channel_set_flag(channel, CF_CONFERENCE);
|
||||
switch_channel_set_flag(channel, CF_VIDEO_PASSIVE);
|
||||
|
||||
|
||||
if (switch_channel_answer(channel) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Channel answer failed.\n");
|
||||
goto end;
|
||||
|
@ -54,7 +54,7 @@
|
||||
#include <switch_version.h>
|
||||
#include <switch_ssl.h>
|
||||
|
||||
#define FIR_COUNTDOWN 50
|
||||
#define FIR_COUNTDOWN 25
|
||||
|
||||
#define READ_INC(rtp_session) switch_mutex_lock(rtp_session->read_mutex); rtp_session->reading++
|
||||
#define READ_DEC(rtp_session) switch_mutex_unlock(rtp_session->read_mutex); rtp_session->reading--
|
||||
@ -1527,6 +1527,20 @@ static int check_rtcp_and_ice(switch_rtp_t *rtp_session)
|
||||
int rtcp_ok = 1;
|
||||
switch_time_t now = switch_micro_time_now();
|
||||
|
||||
|
||||
if (rtp_session->fir_countdown) {
|
||||
if (rtp_session->fir_countdown == FIR_COUNTDOWN) {
|
||||
do_flush(rtp_session, SWITCH_TRUE);
|
||||
}
|
||||
|
||||
if (rtp_session->fir_countdown == FIR_COUNTDOWN || rtp_session->fir_countdown == 1) {
|
||||
send_fir(rtp_session);
|
||||
//send_pli(rtp_session);
|
||||
}
|
||||
|
||||
rtp_session->fir_countdown--;
|
||||
}
|
||||
|
||||
if (rtp_session->flags[SWITCH_RTP_FLAG_AUTO_CNG] && rtp_session->send_msg.header.ts &&
|
||||
rtp_session->timer.samplecount >= (rtp_session->last_write_samplecount + (rtp_session->samples_per_interval * 60))) {
|
||||
uint8_t data[10] = { 0 };
|
||||
@ -4621,8 +4635,10 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
|
||||
pt = 100000;
|
||||
}
|
||||
|
||||
|
||||
poll_status = switch_poll(rtp_session->read_pollfd, 1, &fdr, pt);
|
||||
|
||||
|
||||
|
||||
if (rtp_session->dtmf_data.out_digit_dur > 0) {
|
||||
return_cng_frame();
|
||||
}
|
||||
@ -5282,15 +5298,6 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_zerocopy_read_frame(switch_rtp_t *rtp
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
if (rtp_session->fir_countdown) {
|
||||
rtp_session->fir_countdown--;
|
||||
|
||||
if (rtp_session->fir_countdown == FIR_COUNTDOWN / 2 || rtp_session->fir_countdown == 0) {
|
||||
send_fir(rtp_session);
|
||||
//send_pli(rtp_session);
|
||||
}
|
||||
}
|
||||
|
||||
bytes = rtp_common_read(rtp_session, &frame->payload, &frame->flags, io_flags);
|
||||
|
||||
frame->data = RTP_BODY(rtp_session);
|
||||
@ -5524,7 +5531,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session,
|
||||
rtp_session->ts_norm.delta_percent = (double)((double)rtp_session->ts_norm.delta / (double)rtp_session->ts_norm.delta_avg) * 100.0f;
|
||||
|
||||
|
||||
if (rtp_session->ts_norm.delta_ct > 50 && rtp_session->ts_norm.delta_percent > 125.0) {
|
||||
if (rtp_session->ts_norm.delta_ct > 50 && rtp_session->ts_norm.delta_percent > 150.0) {
|
||||
//printf("%s diff %d %d (%.2f)\n", switch_core_session_get_name(rtp_session->session),
|
||||
//rtp_session->ts_norm.delta, rtp_session->ts_norm.delta_avg, rtp_session->ts_norm.delta_percent);
|
||||
switch_rtp_video_refresh(rtp_session);
|
||||
|
Loading…
x
Reference in New Issue
Block a user