FS-7513: only use timer when needed

This commit is contained in:
Anthony Minessale 2015-02-11 21:52:15 -06:00 committed by Michael Jerris
parent 0ca774e4cf
commit b2fa835a0a
1 changed files with 10 additions and 4 deletions

View File

@ -1384,7 +1384,9 @@ static void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread
init_canvas(conference, vlayout);
switch_core_timer_init(&timer, "soft", 1, 90, conference->pool);
if (switch_test_flag(conference, CFLAG_MINIMIZE_VIDEO_ENCODING)) {
switch_core_timer_init(&timer, "soft", 1, 90, conference->pool);
}
switch_mutex_lock(conference->canvas->cond_mutex);
@ -1568,11 +1570,10 @@ static void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread
need_keyframe = SWITCH_TRUE;
last_key_time = now;
}
switch_core_timer_sync(&timer);
if (switch_test_flag(conference, CFLAG_MINIMIZE_VIDEO_ENCODING)) {
switch_core_timer_sync(&timer);
for (i = 0; write_codecs[i] && switch_core_codec_ready(&write_codecs[i]->codec) && i < MAX_MUX_CODECS; i++) {
write_codecs[i]->frame.img = conference->canvas->img;
write_canvas_image_to_codec_group(conference, write_codecs[i], i, timer.samplecount, need_refresh, need_keyframe);
@ -1634,6 +1635,11 @@ static void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread
switch_core_codec_destroy(&write_codecs[i]->codec);
}
if (switch_test_flag(conference, CFLAG_MINIMIZE_VIDEO_ENCODING)) {
switch_core_timer_destroy(&timer);
}
destroy_canvas(&conference->canvas);
return NULL;