if (sip && sip->sip_content_type && sip->sip_content_type->c_type && sip->sip_content_type->c_subtype &&
sip->sip_payload && sip->sip_payload->pl_data) {
if (!strncasecmp(sip->sip_content_type->c_type, "application", 11) && !strcasecmp(sip->sip_content_type->c_subtype, "media_control+xml")) {
+ switch_core_session_t *other_session;
+
if (switch_channel_test_flag(channel, CF_VIDEO)) {
switch_core_media_gen_key_frame(session);
- switch_channel_set_flag(channel, CF_VIDEO_REFRESH_REQ);
+ if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) {
+ sofia_glue_build_vid_refresh_message(other_session, sip->sip_payload->pl_data);
+ switch_core_session_rwunlock(other_session);
+ } else {
+ switch_channel_set_flag(channel, CF_VIDEO_REFRESH_REQ);
+ }
}
} else if (!strncasecmp(sip->sip_content_type->c_type, "application", 11) &&
switch_rtp_set_video_buffer_size(v_engine->rtp_session, frames, max_frames);
}
return;
- } else if (!strcasecmp(input, "vpause")) {
- switch_rtp_pause_jitter_buffer(v_engine->rtp_session, SWITCH_TRUE);
- return;
- } else if (!strcasecmp(input, "vresume")) {
- switch_rtp_pause_jitter_buffer(v_engine->rtp_session, SWITCH_FALSE);
- return;
- } else if (!strcasecmp(input, "vstop")) {
- switch_rtp_deactivate_jitter_buffer(v_engine->rtp_session);
- return;
} else if (!strncasecmp(input, "vdebug:", 7)) {
s = input + 7;
}
fps = switch_core_media_get_video_fps(session);
-
-
- if (switch_test_flag(smh, SMF_JB_PAUSED)) {
- return;
- }
switch_rtp_get_video_buffer_size(v_engine->rtp_session, &min_frames, &max_frames, &cur_frames, NULL);
return SWITCH_STATUS_GENERR;
}
- if (type == SWITCH_MEDIA_TYPE_AUDIO && !switch_test_flag(frame, SFF_CNG) && !switch_test_flag(frame, SFF_PROXY_PACKET)) {
+ if (!switch_test_flag(frame, SFF_CNG) && !switch_test_flag(frame, SFF_PROXY_PACKET)) {
if (engine->read_impl.encoded_bytes_per_packet) {
bytes = engine->read_impl.encoded_bytes_per_packet;
frames = ((int) frame->datalen / bytes);
case SWITCH_MESSAGE_INDICATE_BRIDGE:
{
- if (switch_rtp_ready(a_engine->rtp_session) || switch_rtp_ready(v_engine->rtp_session)) {
+ if (switch_rtp_ready(a_engine->rtp_session)) {
const char *val;
-
- if (
+ int ok = 0;
+
+ if (!switch_channel_test_flag(session->channel, CF_VIDEO) &&
(!(val = switch_channel_get_variable(session->channel, "rtp_jitter_buffer_during_bridge")) || switch_false(val))) {
if (switch_channel_test_flag(session->channel, CF_JITTERBUFFER) && switch_channel_test_cap_partner(session->channel, CC_FS_RTP)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
"%s PAUSE Jitterbuffer\n", switch_channel_get_name(session->channel));
- if (a_engine->rtp_session) {
- switch_rtp_pause_jitter_buffer(a_engine->rtp_session, SWITCH_TRUE);
- }
-
- if (v_engine->rtp_session) {
- switch_rtp_pause_jitter_buffer(v_engine->rtp_session, SWITCH_TRUE);
- }
+ switch_rtp_pause_jitter_buffer(a_engine->rtp_session, SWITCH_TRUE);
switch_set_flag(smh, SMF_JB_PAUSED);
}
}
- }
-
- if (switch_rtp_ready(a_engine->rtp_session)) {
- const char *val;
- int ok = 0;
if (switch_channel_test_flag(session->channel, CF_PASS_RFC2833) && switch_channel_test_flag_partner(session->channel, CF_FS_RTP)) {
switch_rtp_set_flag(a_engine->rtp_session, SWITCH_RTP_FLAG_PASS_RFC2833);
}
goto end;
case SWITCH_MESSAGE_INDICATE_UNBRIDGE:
-
- if (switch_rtp_ready(a_engine->rtp_session) || switch_rtp_ready(v_engine->rtp_session)) {
+ if (switch_rtp_ready(a_engine->rtp_session)) {
+
if (switch_test_flag(smh, SMF_JB_PAUSED)) {
switch_clear_flag(smh, SMF_JB_PAUSED);
if (switch_channel_test_flag(session->channel, CF_JITTERBUFFER)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
"%s RESUME Jitterbuffer\n", switch_channel_get_name(session->channel));
- if (a_engine->rtp_session) {
- switch_rtp_pause_jitter_buffer(a_engine->rtp_session, SWITCH_FALSE);
- }
-
- if (v_engine->rtp_session) {
- switch_rtp_pause_jitter_buffer(v_engine->rtp_session, SWITCH_FALSE);
- }
+ switch_rtp_pause_jitter_buffer(a_engine->rtp_session, SWITCH_FALSE);
}
}
- }
-
- if (switch_rtp_ready(a_engine->rtp_session)) {
+
if (switch_rtp_test_flag(a_engine->rtp_session, SWITCH_RTP_FLAG_PASS_RFC2833)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s deactivate passthru 2833 mode.\n",
switch_channel_get_name(session->channel));
frame = &write_frame;
frame->img = img;
-
if (!switch_test_flag(frame, SFF_USE_VIDEO_TIMESTAMP)) {
if (!(timer = switch_core_media_get_timer(session, SWITCH_MEDIA_TYPE_VIDEO))) {
frame->timestamp = timer->samplecount;
}
-
switch_clear_flag(frame, SFF_SAME_IMAGE);
frame->m = 0;
SWITCH_DECLARE(switch_status_t) switch_rtp_pause_jitter_buffer(switch_rtp_t *rtp_session, switch_bool_t pause)
{
- if (!switch_rtp_ready(rtp_session) || (!rtp_session->jb && !rtp_session->vb)) {
+ if (!switch_rtp_ready(rtp_session) || !rtp_session->jb) {
return SWITCH_STATUS_FALSE;
}
}
if (rtp_session->pause_jb && !pause) {
- if (rtp_session->vb) {
- switch_jb_reset(rtp_session->vb);
- } else {
- switch_jb_reset(rtp_session->jb);
- }
+ switch_jb_reset(rtp_session->jb);
}
rtp_session->pause_jb = pause ? 1 : 0;
if (rtp_session->has_rtp && *bytes) {
uint32_t read_ssrc = ntohl(rtp_session->last_rtp_hdr.ssrc);
- if (rtp_session->vb && jb_valid(rtp_session) && !rtp_session->pause_jb) {
+ if (rtp_session->vb && jb_valid(rtp_session)) {
status = switch_jb_put_packet(rtp_session->vb, (switch_rtp_packet_t *) &rtp_session->recv_msg, *bytes);
if (status == SWITCH_STATUS_TOO_LATE) {
}
}
- if (rtp_session->vb && jb_valid(rtp_session) && !rtp_session->pause_jb) {
+ if (rtp_session->vb && jb_valid(rtp_session)) {
switch_status_t vstatus = switch_jb_get_packet(rtp_session->vb, (switch_rtp_packet_t *) &rtp_session->recv_msg, bytes);
status = vstatus;
pt = 200000;
}
- if (rtp_session->vb && !rtp_session->pause_jb) {
+ if (rtp_session->vb) {
if (switch_jb_poll(rtp_session->vb)) {
pt = 0;
}
if ((io_flags & SWITCH_IO_FLAG_NOBLOCK)) {
pt = 0;
}
-
+
poll_status = switch_poll(rtp_session->read_pollfd, 1, &fdr, pt);
//if (rtp_session->flags[SWITCH_RTP_FLAG_VIDEO]) {
- // switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_WARNING, "WTF Poll %d %d\n", pt, poll_status);
+ // switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_WARNING, "WTF Poll %d\n", poll_status);
//}
if (!rtp_session->flags[SWITCH_RTP_FLAG_VIDEO] && rtp_session->dtmf_data.out_digit_dur > 0) {
}
- if (poll_status == SWITCH_STATUS_SUCCESS || (rtp_session->vb && !rtp_session->pause_jb && switch_jb_poll(rtp_session->vb))) {
+ if (poll_status == SWITCH_STATUS_SUCCESS || (rtp_session->vb && switch_jb_poll(rtp_session->vb))) {
got_rtp_poll = 1;
}
}
+
if (switch_rtp_test_flag(rtp_session, SWITCH_RTP_FLAG_GEN_TS_DELTA) || switch_rtp_test_flag(rtp_session, SWITCH_RTP_FLAG_VIDEO)) {
/* Normalize the timestamps to our own base by generating a made up starting point then adding the measured deltas to that base
so if the timestamps and ssrc of the source change, it will not break the other end's jitter bufffer / decoder etc *cough* CHROME *cough*