From 7accfd2a692989072818ee0db5578fd5c1ce576d Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 30 Mar 2017 11:20:37 -0500 Subject: [PATCH] FS-10126 make fps on the fly --- .../mod_conference/conference_video.c | 39 ++++++------------- src/switch_core_media.c | 29 ++------------ 2 files changed, 14 insertions(+), 54 deletions(-) diff --git a/src/mod/applications/mod_conference/conference_video.c b/src/mod/applications/mod_conference/conference_video.c index 9209532af2..f7b55588df 100644 --- a/src/mod/applications/mod_conference/conference_video.c +++ b/src/mod/applications/mod_conference/conference_video.c @@ -41,42 +41,25 @@ */ #include -static struct conference_fps FPS_VALS[] = { - {1.0f, 1000, 90}, - {5.0f, 200, 450}, - {10.0f, 100, 900}, - {15.0f, 66, 1364}, - {16.60f, 60, 1500}, - {20.0f, 50, 4500}, - {25.0f, 40, 2250}, - {30.0f, 33, 2700}, - {33.0f, 30, 2790}, - {66.60f, 15, 6000}, - {100.0f, 10, 9000}, - {0,0,0} -}; - - int conference_video_set_fps(conference_obj_t *conference, float fps) { - uint32_t i = 0, j = 0; + uint32_t j = 0; - for (i = 0; FPS_VALS[i].ms; i++) { - if (FPS_VALS[i].fps == fps) { + if (fps > 100) { + return 0; + } - conference->video_fps = FPS_VALS[i]; + conference->video_fps.fps = fps; + conference->video_fps.ms = (int) 1000 / fps; + conference->video_fps.samples = (int) 90000 / conference->video_fps.ms; - for (j = 0; j <= conference->canvas_count; j++) { - if (conference->canvases[j]) { - conference->canvases[j]->video_timer_reset = 1; - } - } - - return 1; + for (j = 0; j <= conference->canvas_count; j++) { + if (conference->canvases[j]) { + conference->canvases[j]->video_timer_reset = 1; } } - return 0; + return 1; } diff --git a/src/switch_core_media.c b/src/switch_core_media.c index e05f3d3682..2f279c6c80 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -6257,35 +6257,12 @@ typedef struct core_fps_s { int samples; } core_fps_t; -static struct core_fps_s FPS_VALS[] = { - {1.0f, 1000, 90}, - {5.0f, 200, 450}, - {10.0f, 100, 900}, - {15.0f, 66, 1364}, - {16.60f, 60, 1500}, - {20.0f, 50, 4500}, - {24.0f, 41, 2160}, - {25.0f, 40, 2250}, - {30.0f, 33, 2700}, - {33.0f, 30, 2790}, - {66.60f, 15, 6000}, - {100.0f, 10, 9000}, - {0,0,0} -}; - - static int video_get_fps(core_fps_t *fpsP, float fps) { - uint32_t i = 0; + fpsP->fps = fps; + fpsP->ms = (int) 1000 / fps; + fpsP->samples = (int) 90000 / fpsP->ms; - for (i = 0; FPS_VALS[i].ms; i++) { - if (FPS_VALS[i].fps == fps) { - *fpsP = FPS_VALS[i]; - return 1; - } - } - - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unknown framerate %f\n", fps); return 0; }