more video fixes

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15553 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2009-11-19 18:22:05 +00:00
parent 85ac951200
commit 4f15b245f7
2 changed files with 26 additions and 5 deletions

View File

@ -48,13 +48,13 @@ static void *SWITCH_THREAD_FUNC video_bridge_thread(switch_thread_t *thread, voi
{
struct vid_helper *vh = obj;
switch_channel_t *channel = switch_core_session_get_channel(vh->session_a);
switch_channel_t *b_channel = switch_core_session_get_channel(vh->session_b);
switch_status_t status;
switch_frame_t *read_frame;
vh->up = 1;
while (switch_channel_ready(channel) && vh->up == 1) {
while (switch_channel_ready(channel) && switch_channel_ready(b_channel) && vh->up == 1) {
status = switch_core_session_read_video_frame(vh->session_a, &read_frame, SWITCH_IO_FLAG_NONE, 0);
if (!SWITCH_READ_ACCEPTABLE(status)) {
break;
}
@ -67,8 +67,10 @@ static void *SWITCH_THREAD_FUNC video_bridge_thread(switch_thread_t *thread, voi
}
switch_core_session_kill_channel(vh->session_b, SWITCH_SIG_BREAK);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s video thread ended.\n", switch_channel_get_name(channel));
vh->up = 0;
return NULL;
}
@ -472,6 +474,18 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
end_of_bridge_loop:
#ifdef SWITCH_VIDEO_IN_THREADS
if (vid_thread) {
vh.up = -1;
switch_channel_set_flag(chan_a, CF_NOT_READY);
switch_channel_set_flag(chan_b, CF_NOT_READY);
switch_core_session_kill_channel(session_a, SWITCH_SIG_BREAK);
switch_core_session_kill_channel(session_b, SWITCH_SIG_BREAK);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Ending video thread.\n");
}
#endif
if (silence_val) {
switch_core_codec_destroy(&silence_codec);
}
@ -530,11 +544,15 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
#ifdef SWITCH_VIDEO_IN_THREADS
if (vid_thread) {
switch_status_t st;
vh.up = -1;
switch_core_session_kill_channel(session_a, SWITCH_SIG_BREAK);
switch_core_session_kill_channel(session_b, SWITCH_SIG_BREAK);
if (vh.up) {
switch_core_session_kill_channel(session_a, SWITCH_SIG_BREAK);
switch_core_session_kill_channel(session_b, SWITCH_SIG_BREAK);
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Ending video thread.\n");
switch_thread_join(&st, vid_thread);
switch_channel_clear_flag(chan_a, CF_NOT_READY);
switch_channel_clear_flag(chan_b, CF_NOT_READY);
}
#endif

View File

@ -1861,6 +1861,9 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
poll_loop = 1;
rtp_session->missed_count += (poll_sec * 1000 ) / (rtp_session->ms_per_packet ? rtp_session->ms_per_packet : 20 / 1000);
bytes = 0;
if (rtp_session->dtmf_data.out_digit_dur == 0 || switch_test_flag(rtp_session, SWITCH_RTP_FLAG_VIDEO)) {
return_cng_frame();
}
}
if (bytes < 0) {