mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-05-08 00:33:20 +00:00
vid stuff
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7546 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
b44d74f35f
commit
bd133f6413
@ -43,7 +43,7 @@
|
|||||||
#define SWITCH_END_EXTERN_C
|
#define SWITCH_END_EXTERN_C
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define SWITCH_VIDEO_IN_THREADS
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
#include <switch_am_config.h>
|
#include <switch_am_config.h>
|
||||||
|
@ -212,6 +212,7 @@ SWITCH_DECLARE(char *) switch_channel_get_uuid(switch_channel_t *channel);
|
|||||||
SWITCH_DECLARE(switch_status_t) switch_channel_set_variable(switch_channel_t *channel, const char *varname, const char *value);
|
SWITCH_DECLARE(switch_status_t) switch_channel_set_variable(switch_channel_t *channel, const char *varname, const char *value);
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_partner(switch_channel_t *channel, const char *varname, const char *value);
|
SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_partner(switch_channel_t *channel, const char *varname, const char *value);
|
||||||
|
SWITCH_DECLARE(const char *) switch_channel_get_variable_partner(switch_channel_t *channel, const char *varname);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Retrieve a variable from a given channel
|
\brief Retrieve a variable from a given channel
|
||||||
|
@ -1745,6 +1745,8 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session
|
|||||||
switch_ivr_transfer_variable(session, nsession, SOFIA_REPLACES_HEADER);
|
switch_ivr_transfer_variable(session, nsession, SOFIA_REPLACES_HEADER);
|
||||||
switch_ivr_transfer_variable(session, nsession, "sip_auto_answer");
|
switch_ivr_transfer_variable(session, nsession, "sip_auto_answer");
|
||||||
switch_ivr_transfer_variable(session, nsession, SOFIA_SIP_HEADER_PREFIX_T);
|
switch_ivr_transfer_variable(session, nsession, SOFIA_SIP_HEADER_PREFIX_T);
|
||||||
|
switch_ivr_transfer_variable(session, nsession, "sip_video_fmtp");
|
||||||
|
|
||||||
if (switch_core_session_compare(session, nsession)) {
|
if (switch_core_session_compare(session, nsession)) {
|
||||||
/* It's another sofia channel! so lets cache what they use as a pt for telephone event so
|
/* It's another sofia channel! so lets cache what they use as a pt for telephone event so
|
||||||
we can keep it the same
|
we can keep it the same
|
||||||
|
@ -46,6 +46,7 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32
|
|||||||
uint32_t v_port;
|
uint32_t v_port;
|
||||||
int use_cng = 1;
|
int use_cng = 1;
|
||||||
const char *val;
|
const char *val;
|
||||||
|
const char *pass_fmtp = switch_channel_get_variable(tech_pvt->channel, "sip_video_fmtp");
|
||||||
|
|
||||||
if (sofia_test_pflag(tech_pvt->profile, PFLAG_SUPRESS_CNG) ||
|
if (sofia_test_pflag(tech_pvt->profile, PFLAG_SUPRESS_CNG) ||
|
||||||
((val = switch_channel_get_variable(tech_pvt->channel, "supress_cng")) && switch_true(val))) {
|
((val = switch_channel_get_variable(tech_pvt->channel, "supress_cng")) && switch_true(val))) {
|
||||||
@ -219,15 +220,15 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (switch_test_flag(tech_pvt, TFLAG_VIDEO) && tech_pvt->video_rm_encoding) {
|
if (switch_test_flag(tech_pvt, TFLAG_VIDEO)) {
|
||||||
sofia_glue_tech_choose_video_port(tech_pvt);
|
sofia_glue_tech_choose_video_port(tech_pvt);
|
||||||
|
|
||||||
if ((v_port = tech_pvt->adv_sdp_video_port)) {
|
if ((v_port = tech_pvt->adv_sdp_video_port)) {
|
||||||
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "m=video %d RTP/AVP", v_port);
|
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "m=video %d RTP/AVP", v_port);
|
||||||
|
|
||||||
sofia_glue_tech_set_video_codec(tech_pvt, 0);
|
|
||||||
|
|
||||||
/*****************************/
|
/*****************************/
|
||||||
if (tech_pvt->video_rm_encoding) {
|
if (tech_pvt->video_rm_encoding) {
|
||||||
|
sofia_glue_tech_set_video_codec(tech_pvt, 0);
|
||||||
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->video_pt);
|
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->video_pt);
|
||||||
} else if (tech_pvt->num_codecs) {
|
} else if (tech_pvt->num_codecs) {
|
||||||
int i;
|
int i;
|
||||||
@ -255,15 +256,30 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32
|
|||||||
|
|
||||||
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "\n");
|
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "\n");
|
||||||
|
|
||||||
if (tech_pvt->rm_encoding) {
|
if (tech_pvt->video_rm_encoding) {
|
||||||
|
const char *of;
|
||||||
rate = tech_pvt->video_rm_rate;
|
rate = tech_pvt->video_rm_rate;
|
||||||
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%ld\n", tech_pvt->video_pt, tech_pvt->video_rm_encoding, tech_pvt->video_rm_rate);
|
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%ld\n", tech_pvt->video_pt, tech_pvt->video_rm_encoding, tech_pvt->video_rm_rate);
|
||||||
if (tech_pvt->video_fmtp_out) {
|
|
||||||
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=fmtp:%d %s\n", tech_pvt->video_pt, tech_pvt->video_fmtp_out);
|
|
||||||
|
if (switch_channel_get_variable(tech_pvt->channel, SWITCH_SIGNAL_BOND_VARIABLE)) {
|
||||||
|
if ((of = switch_channel_get_variable_partner(tech_pvt->channel, "sip_video_fmtp"))) {
|
||||||
|
pass_fmtp = of;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!pass_fmtp) {
|
||||||
|
pass_fmtp = tech_pvt->video_fmtp_out;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pass_fmtp) {
|
||||||
|
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=fmtp:%d %s\n", tech_pvt->video_pt, pass_fmtp);
|
||||||
|
}
|
||||||
|
|
||||||
} else if (tech_pvt->num_codecs) {
|
} else if (tech_pvt->num_codecs) {
|
||||||
int i;
|
int i;
|
||||||
int already_did[128] = { 0 };
|
int already_did[128] = { 0 };
|
||||||
|
|
||||||
for (i = 0; i < tech_pvt->num_codecs; i++) {
|
for (i = 0; i < tech_pvt->num_codecs; i++) {
|
||||||
const switch_codec_implementation_t *imp = tech_pvt->codecs[i];
|
const switch_codec_implementation_t *imp = tech_pvt->codecs[i];
|
||||||
|
|
||||||
@ -285,6 +301,10 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32
|
|||||||
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%d\n", imp->ianacode, imp->iananame, imp->samples_per_second);
|
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%d\n", imp->ianacode, imp->iananame, imp->samples_per_second);
|
||||||
if (imp->fmtp) {
|
if (imp->fmtp) {
|
||||||
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=fmtp:%d %s\n", imp->ianacode, imp->fmtp);
|
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=fmtp:%d %s\n", imp->ianacode, imp->fmtp);
|
||||||
|
} else {
|
||||||
|
if (pass_fmtp) {
|
||||||
|
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=fmtp:%d %s\n", imp->ianacode, pass_fmtp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1042,7 +1062,8 @@ switch_status_t sofia_glue_tech_set_video_codec(private_object_t *tech_pvt, int
|
|||||||
switch_channel_get_name(tech_pvt->channel), tech_pvt->video_rm_encoding, tech_pvt->video_rm_rate, tech_pvt->video_codec_ms);
|
switch_channel_get_name(tech_pvt->channel), tech_pvt->video_rm_encoding, tech_pvt->video_rm_rate, tech_pvt->video_codec_ms);
|
||||||
tech_pvt->video_read_frame.codec = &tech_pvt->video_read_codec;
|
tech_pvt->video_read_frame.codec = &tech_pvt->video_read_codec;
|
||||||
|
|
||||||
tech_pvt->fmtp_out = switch_core_session_strdup(tech_pvt->session, tech_pvt->video_write_codec.fmtp_out);
|
tech_pvt->video_fmtp_out = switch_core_session_strdup(tech_pvt->session, tech_pvt->video_write_codec.fmtp_out);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
@ -1878,6 +1899,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, sdp_session_t *
|
|||||||
switch_snprintf(tmp, sizeof(tmp), "%d", tech_pvt->remote_sdp_video_port);
|
switch_snprintf(tmp, sizeof(tmp), "%d", tech_pvt->remote_sdp_video_port);
|
||||||
switch_channel_set_variable(tech_pvt->channel, SWITCH_REMOTE_VIDEO_IP_VARIABLE, tech_pvt->remote_sdp_audio_ip);
|
switch_channel_set_variable(tech_pvt->channel, SWITCH_REMOTE_VIDEO_IP_VARIABLE, tech_pvt->remote_sdp_audio_ip);
|
||||||
switch_channel_set_variable(tech_pvt->channel, SWITCH_REMOTE_VIDEO_PORT_VARIABLE, tmp);
|
switch_channel_set_variable(tech_pvt->channel, SWITCH_REMOTE_VIDEO_PORT_VARIABLE, tmp);
|
||||||
|
switch_channel_set_variable(tech_pvt->channel, "sip_video_fmtp", tech_pvt->video_rm_fmtp);
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
vmatch = 0;
|
vmatch = 0;
|
||||||
|
@ -416,6 +416,31 @@ SWITCH_DECLARE(const char *) switch_channel_get_variable(switch_channel_t *chann
|
|||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SWITCH_DECLARE(const char *) switch_channel_get_variable_partner(switch_channel_t *channel, const char *varname)
|
||||||
|
{
|
||||||
|
const char *uuid;
|
||||||
|
const char *val = NULL;
|
||||||
|
switch_assert(channel != NULL);
|
||||||
|
|
||||||
|
if (!switch_strlen_zero(varname)) {
|
||||||
|
if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
|
||||||
|
switch_core_session_t *session;
|
||||||
|
switch_mutex_lock(channel->profile_mutex);
|
||||||
|
if ((session = switch_core_session_locate(uuid))) {
|
||||||
|
switch_channel_t *tchannel = switch_core_session_get_channel(session);
|
||||||
|
switch_mutex_lock(tchannel->profile_mutex);
|
||||||
|
val = switch_channel_get_variable(tchannel, varname);
|
||||||
|
switch_mutex_unlock(tchannel->profile_mutex);
|
||||||
|
switch_core_session_rwunlock(session);
|
||||||
|
}
|
||||||
|
switch_mutex_unlock(channel->profile_mutex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
SWITCH_DECLARE(void) switch_channel_variable_last(switch_channel_t *channel)
|
SWITCH_DECLARE(void) switch_channel_variable_last(switch_channel_t *channel)
|
||||||
{
|
{
|
||||||
switch_assert(channel != NULL);
|
switch_assert(channel != NULL);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user