mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-14 00:00:44 +00:00
few core tweaks
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7565 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
a1be7a5b87
commit
a3081374a1
@ -101,6 +101,8 @@ struct switch_core_session {
|
||||
switch_io_event_hooks_t event_hooks;
|
||||
switch_codec_t *read_codec;
|
||||
switch_codec_t *write_codec;
|
||||
switch_codec_t *video_read_codec;
|
||||
switch_codec_t *video_write_codec;
|
||||
|
||||
switch_buffer_t *raw_write_buffer;
|
||||
switch_frame_t raw_write_frame;
|
||||
|
@ -1084,6 +1084,36 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_write_codec(_In_ switch_
|
||||
*/
|
||||
SWITCH_DECLARE(switch_codec_t *) switch_core_session_get_write_codec(_In_ switch_core_session_t *session);
|
||||
|
||||
/*!
|
||||
\brief Assign the video_read codec to a given session
|
||||
\param session session to add the codec to
|
||||
\param codec the codec to add
|
||||
\return SWITCH_STATUS_SUCCESS if successful
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_set_video_read_codec(_In_ switch_core_session_t *session, switch_codec_t *codec);
|
||||
|
||||
/*!
|
||||
\brief Retrieve the video_read codec from a given session
|
||||
\param session session to retrieve from
|
||||
\return a pointer to the codec
|
||||
*/
|
||||
SWITCH_DECLARE(switch_codec_t *) switch_core_session_get_video_read_codec(_In_ switch_core_session_t *session);
|
||||
|
||||
/*!
|
||||
\brief Assign the video_write codec to a given session
|
||||
\param session session to add the codec to
|
||||
\param codec the codec to add
|
||||
\return SWITCH_STATUS_SUCCESS if successful
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_set_video_write_codec(_In_ switch_core_session_t *session, switch_codec_t *codec);
|
||||
|
||||
/*!
|
||||
\brief Retrieve the video_write codec from a given session
|
||||
\param session session to retrieve from
|
||||
\return a pointer to the codec
|
||||
*/
|
||||
SWITCH_DECLARE(switch_codec_t *) switch_core_session_get_video_write_codec(_In_ switch_core_session_t *session);
|
||||
|
||||
///\}
|
||||
///\defgroup db Database Functions
|
||||
///\ingroup core1
|
||||
|
@ -386,6 +386,40 @@ typedef enum {
|
||||
SWITCH_RTP_FLAG_SECURE_RECV_RESET = (1 << 17)
|
||||
} switch_rtp_flag_t;
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma pack(push, r1, 1)
|
||||
#endif
|
||||
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
typedef struct {
|
||||
unsigned version:2; /* protocol version */
|
||||
unsigned p:1; /* padding flag */
|
||||
unsigned x:1; /* header extension flag */
|
||||
unsigned cc:4; /* CSRC count */
|
||||
unsigned m:1; /* marker bit */
|
||||
unsigned pt:7; /* payload type */
|
||||
unsigned seq:16; /* sequence number */
|
||||
unsigned ts:32; /* timestamp */
|
||||
unsigned ssrc:32; /* synchronization source */
|
||||
} switch_rtp_hdr_t;
|
||||
|
||||
#else /* BIG_ENDIAN */
|
||||
|
||||
typedef struct {
|
||||
unsigned cc:4; /* CSRC count */
|
||||
unsigned x:1; /* header extension flag */
|
||||
unsigned p:1; /* padding flag */
|
||||
unsigned version:2; /* protocol version */
|
||||
unsigned pt:7; /* payload type */
|
||||
unsigned m:1; /* marker bit */
|
||||
unsigned seq:16; /* sequence number */
|
||||
unsigned ts:32; /* timestamp */
|
||||
unsigned ssrc:32; /* synchronization source */
|
||||
} switch_rtp_hdr_t;
|
||||
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\enum switch_priority_t
|
||||
\brief Priority Indication
|
||||
|
@ -47,6 +47,7 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32
|
||||
int use_cng = 1;
|
||||
const char *val;
|
||||
const char *pass_fmtp = switch_channel_get_variable(tech_pvt->channel, "sip_video_fmtp");
|
||||
const char *ov_fmtp = switch_channel_get_variable(tech_pvt->channel, "sip_force_video_fmtp");
|
||||
|
||||
if (sofia_test_pflag(tech_pvt->profile, PFLAG_SUPRESS_CNG) ||
|
||||
((val = switch_channel_get_variable(tech_pvt->channel, "supress_cng")) && switch_true(val))) {
|
||||
@ -261,21 +262,22 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32
|
||||
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);
|
||||
|
||||
|
||||
pass_fmtp = NULL;
|
||||
|
||||
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 (ov_fmtp) {
|
||||
pass_fmtp = ov_fmtp;
|
||||
}
|
||||
|
||||
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) {
|
||||
int i;
|
||||
int already_did[128] = { 0 };
|
||||
@ -1063,7 +1065,8 @@ switch_status_t sofia_glue_tech_set_video_codec(private_object_t *tech_pvt, int
|
||||
tech_pvt->video_read_frame.codec = &tech_pvt->video_read_codec;
|
||||
|
||||
tech_pvt->video_fmtp_out = switch_core_session_strdup(tech_pvt->session, tech_pvt->video_write_codec.fmtp_out);
|
||||
|
||||
switch_core_session_set_video_read_codec(tech_pvt->session, &tech_pvt->video_read_codec);
|
||||
switch_core_session_set_video_write_codec(tech_pvt->session, &tech_pvt->video_write_codec);
|
||||
}
|
||||
}
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
|
@ -98,6 +98,62 @@ SWITCH_DECLARE(switch_codec_t *) switch_core_session_get_write_codec(switch_core
|
||||
return session->write_codec;
|
||||
}
|
||||
|
||||
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_set_video_read_codec(switch_core_session_t *session, switch_codec_t *codec)
|
||||
{
|
||||
switch_event_t *event;
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
char tmp[30];
|
||||
|
||||
if (switch_event_create(&event, SWITCH_EVENT_CODEC) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_channel_event_set_data(session->channel, event);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-video-read-codec-name", "%s", codec->implementation->iananame);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-video-read-codec-rate", "%d", codec->implementation->actual_samples_per_second);
|
||||
switch_event_fire(&event);
|
||||
}
|
||||
|
||||
switch_channel_set_variable(channel, "video_read_codec", codec->implementation->iananame);
|
||||
switch_snprintf(tmp, sizeof(tmp), "%d", codec->implementation->actual_samples_per_second);
|
||||
switch_channel_set_variable(channel, "video_read_rate", tmp);
|
||||
|
||||
session->video_read_codec = codec;
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_codec_t *) switch_core_session_get_video_read_codec(switch_core_session_t *session)
|
||||
{
|
||||
return session->video_read_codec;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_session_set_video_write_codec(switch_core_session_t *session, switch_codec_t *codec)
|
||||
{
|
||||
switch_event_t *event;
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
char tmp[30];
|
||||
|
||||
if (switch_event_create(&event, SWITCH_EVENT_CODEC) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_channel_event_set_data(session->channel, event);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-video-write-codec-name", "%s", codec->implementation->iananame);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-video-write-codec-rate", "%d", codec->implementation->actual_samples_per_second);
|
||||
switch_event_fire(&event);
|
||||
}
|
||||
|
||||
switch_channel_set_variable(channel, "video_write_codec", codec->implementation->iananame);
|
||||
switch_snprintf(tmp, sizeof(tmp), "%d", codec->implementation->actual_samples_per_second);
|
||||
switch_channel_set_variable(channel, "video_write_rate", tmp);
|
||||
|
||||
session->video_write_codec = codec;
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_codec_t *) switch_core_session_get_video_write_codec(switch_core_session_t *session)
|
||||
{
|
||||
return session->video_write_codec;
|
||||
}
|
||||
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_codec_init(switch_codec_t *codec, char *codec_name, char *fmtp,
|
||||
uint32_t rate, int ms, int channels, uint32_t flags,
|
||||
const switch_codec_settings_t *codec_settings, switch_memory_pool_t *pool)
|
||||
|
Loading…
x
Reference in New Issue
Block a user