mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-24 05:02:10 +00:00
Adjust core and add video caps to mod_conference with video follow audio (first cut)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10314 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -686,6 +686,38 @@ static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_f
|
||||
*frame = NULL;
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
|
||||
|
||||
if (tech_pvt->check_frames < 50) {
|
||||
if (tech_pvt->last_ts && tech_pvt->read_frame.datalen != tech_pvt->read_codec.implementation->encoded_bytes_per_packet) {
|
||||
switch_size_t codec_ms = (int)(tech_pvt->read_frame.timestamp -
|
||||
tech_pvt->last_ts) / (tech_pvt->read_codec.implementation->samples_per_second / 1000);
|
||||
|
||||
if ((codec_ms % 10) != 0) {
|
||||
tech_pvt->check_frames = 50;
|
||||
} else {
|
||||
if (switch_rtp_ready(tech_pvt->rtp_session) && codec_ms != tech_pvt->codec_ms) {
|
||||
tech_pvt->codec_ms = codec_ms;
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Changing codec ptime to %d\n", tech_pvt->codec_ms);
|
||||
switch_core_codec_destroy(&tech_pvt->read_codec);
|
||||
switch_core_codec_destroy(&tech_pvt->write_codec);
|
||||
if (sofia_glue_tech_set_codec(tech_pvt, 2) != SWITCH_STATUS_SUCCESS) {
|
||||
*frame = NULL;
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
|
||||
switch_rtp_change_interval(tech_pvt->rtp_session,
|
||||
tech_pvt->read_codec.implementation->samples_per_packet,
|
||||
tech_pvt->codec_ms * 1000);
|
||||
}
|
||||
|
||||
}
|
||||
tech_pvt->check_frames++;
|
||||
tech_pvt->last_ts = tech_pvt->read_frame.timestamp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ((bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_packet)) {
|
||||
frames = (tech_pvt->read_frame.datalen / bytes);
|
||||
}
|
||||
|
||||
@@ -505,6 +505,8 @@ struct private_object {
|
||||
int got_bye;
|
||||
int hold_laps;
|
||||
switch_thread_id_t locker;
|
||||
switch_size_t last_ts;
|
||||
uint32_t check_frames;
|
||||
};
|
||||
|
||||
struct callback_t {
|
||||
@@ -708,3 +710,4 @@ void sofia_reg_send_reboot(sofia_profile_t *profile, const char *user, const cha
|
||||
void sofia_glue_restart_all_profiles(void);
|
||||
void sofia_glue_toggle_hold(private_object_t *tech_pvt, int sendonly);
|
||||
const char * sofia_state_string(int state);
|
||||
switch_status_t sofia_glue_tech_set_codec(private_object_t *tech_pvt, int force);
|
||||
|
||||
@@ -182,6 +182,7 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32
|
||||
} else {
|
||||
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=silenceSupp:off - - - -\n");
|
||||
}
|
||||
|
||||
if (ptime) {
|
||||
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=ptime:%d\n", ptime);
|
||||
}
|
||||
@@ -1535,7 +1536,7 @@ switch_status_t sofia_glue_tech_set_codec(private_object_t *tech_pvt, int force)
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (switch_core_codec_init(&tech_pvt->read_codec,
|
||||
tech_pvt->iananame,
|
||||
tech_pvt->rm_fmtp,
|
||||
@@ -1576,8 +1577,11 @@ switch_status_t sofia_glue_tech_set_codec(private_object_t *tech_pvt, int force)
|
||||
tech_pvt->write_codec.agreed_pt = tech_pvt->agreed_pt;
|
||||
tech_pvt->read_codec.agreed_pt = tech_pvt->agreed_pt;
|
||||
|
||||
switch_core_session_set_read_codec(tech_pvt->session, &tech_pvt->read_codec);
|
||||
switch_core_session_set_write_codec(tech_pvt->session, &tech_pvt->write_codec);
|
||||
if (force != 2) {
|
||||
switch_core_session_set_read_codec(tech_pvt->session, &tech_pvt->read_codec);
|
||||
switch_core_session_set_write_codec(tech_pvt->session, &tech_pvt->write_codec);
|
||||
}
|
||||
|
||||
tech_pvt->fmtp_out = switch_core_session_strdup(tech_pvt->session, tech_pvt->write_codec.fmtp_out);
|
||||
|
||||
if (switch_rtp_ready(tech_pvt->rtp_session)) {
|
||||
|
||||
Reference in New Issue
Block a user