TFLAG_TRANSPORT_ACCEPT = (1 << 22),
TFLAG_READY = (1 << 23),
TFLAG_NAT_MAP = (1 << 24),
- TFLAG_SECURE = (1 << 25)
+ TFLAG_SECURE = (1 << 25),
+ TFLAG_VIDEO_RTP_READY = (1 << 7)
} TFLAGS;
typedef enum {
switch_mutex_t *flag_mutex;
int read_count;
-
+ switch_time_t audio_ready;
};
switch_rtp_destroy(&tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session);
}
-
-
-
-
} else {
if (switch_core_codec_init(&tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec,
tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_name,
tech_pvt->transports[LDL_TPORT_VIDEO_RTP].local_user,
NULL);//tech_pvt->transports[LDL_TPORT_VIDEO_RTP].remote_pass);
switch_channel_set_flag(channel, CF_VIDEO);
+ switch_set_flag(tech_pvt, TFLAG_VIDEO_RTP_READY);
//switch_rtp_set_default_payload(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session, tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_num);
//switch_rtp_set_recv_pt(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session, tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_num);
int r = 0;
if (tech_pvt->transports[LDL_TPORT_RTP].ready) {
- r += activate_audio_rtp(tech_pvt);
+ if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND) || tech_pvt->transports[LDL_TPORT_RTCP].accepted) {
+ r += activate_audio_rtp(tech_pvt);
+ }
}
if (tech_pvt->transports[LDL_TPORT_VIDEO_RTP].ready) {
- r += activate_video_rtp(tech_pvt);
+ if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND) || tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].accepted) {
+ r += activate_video_rtp(tech_pvt);
+ }
}
return r;
if ((tech_pvt->transports[LDL_TPORT_RTP].ready && tech_pvt->transports[LDL_TPORT_RTCP].ready)) {
switch_set_flag_locked(tech_pvt, TFLAG_TRANSPORT);
switch_set_flag_locked(tech_pvt, TFLAG_RTP_READY);
+ tech_pvt->audio_ready = switch_micro_time_now();
}
struct private_object *tech_pvt = NULL;
switch_time_t started;
switch_time_t now;
- unsigned int elapsed;
+ unsigned int elapsed, audio_elapsed;
tech_pvt = switch_core_session_get_private(session);
switch_assert(tech_pvt != NULL);
while (!(switch_test_flag(tech_pvt, TFLAG_CODEC_READY) &&
switch_test_flag(tech_pvt, TFLAG_RTP_READY) &&
+ (switch_test_flag(tech_pvt, TFLAG_OUTBOUND) || switch_test_flag(tech_pvt, TFLAG_VIDEO_RTP_READY)) &&
switch_test_flag(tech_pvt, TFLAG_ANSWER) && switch_test_flag(tech_pvt, TFLAG_TRANSPORT_ACCEPT) && //tech_pvt->read_count &&
tech_pvt->transports[LDL_TPORT_RTP].remote_ip && tech_pvt->transports[LDL_TPORT_RTP].remote_port && switch_test_flag(tech_pvt, TFLAG_TRANSPORT))) {
now = switch_micro_time_now();
elapsed = (unsigned int) ((now - started) / 1000);
+ if (switch_test_flag(tech_pvt, TFLAG_RTP_READY) && !switch_test_flag(tech_pvt, TFLAG_VIDEO_RTP_READY)) {
+ audio_elapsed = (unsigned int) ((now - tech_pvt->audio_ready) / 1000);
+ if (audio_elapsed > 1000) {
+ switch_set_flag(tech_pvt, TFLAG_VIDEO_RTP_READY);
+ }
+ }
+
if (switch_channel_down(channel) || switch_test_flag(tech_pvt, TFLAG_BYE)) {
goto out;
}