uint32_t cur_frames = 0;
switch_media_handle_t *smh;
switch_rtp_engine_t *v_engine = NULL;
- int sync_audio = 0, sync_video = 0;
+ int sync_audio = 0;
const char *var;
if (!fps) return;
+ sync_audio = 1;
if (!frames) {
- sync_audio = 1;
-
if (cur_frames && min_frames && cur_frames >= min_frames) {
frames = cur_frames;
+ } else if (min_frames) {
+ frames = min_frames;
} else {
- frames = fps / 15;
- if (frames < 1) frames = 1;
+ frames = 0;
+ sync_audio = 0;
}
}
- if (!jb_sync_msec) {
+ if (!jb_sync_msec && frames) {
jb_sync_msec = (double)(1000 / fps) * frames;
}
- if (frames != cur_frames && frames > min_frames) {
- switch_rtp_set_video_buffer_size(v_engine->rtp_session, frames, 0);
- sync_audio = 1;
- sync_video = 1;
- }
-
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session),
- SWITCH_LOG_DEBUG1, "%s %s \"%s\" Sync A/V JB to %dms %u VFrames FPS %u a:%s v:%s sync_ms:%d\n",
+ SWITCH_LOG_DEBUG1, "%s %s \"%s\" Sync A/V JB to %dms %u VFrames, FPS %u a:%s sync_ms:%d\n",
switch_core_session_get_uuid(session),
switch_channel_get_name(session->channel),
switch_channel_get_variable_dup(session->channel, "caller_id_name", SWITCH_FALSE, -1),
- jb_sync_msec, frames, video_globals.fps, sync_audio ? "yes" : "no", sync_video ? "yes" : "no", jb_sync_msec);
+ jb_sync_msec, frames, video_globals.fps, sync_audio ? "yes" : "no", jb_sync_msec);
if (sync_audio) {
check_jb(session, NULL, jb_sync_msec, 0, SWITCH_TRUE);
switch_core_session_request_video_refresh(jb->session);
}
}
-
+
jb_debug(jb, 2, "%s", "RESET BUFFER\n");
+ switch_mutex_lock(jb->mutex);
+ hide_nodes(jb);
+ switch_mutex_unlock(jb->mutex);
+
jb->drop_flag = 0;
jb->last_target_seq = 0;
jb->target_seq = 0;
jb->period_miss_inc = 0;
jb->target_ts = 0;
jb->last_target_ts = 0;
-
- switch_mutex_lock(jb->mutex);
- hide_nodes(jb);
- switch_mutex_unlock(jb->mutex);
}
SWITCH_DECLARE(switch_status_t) switch_jb_peek_frame(switch_jb_t *jb, uint32_t ts, uint16_t seq, int peek, switch_frame_t *frame)
if (!jb->read_init) jb->read_init = 1;
} else {
if (jb->type == SJB_VIDEO) {
- switch_jb_reset(jb);
+ //switch_jb_reset(jb);
switch(status) {
case SWITCH_STATUS_RESTART: