]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-10126 make fps on the fly
authorAnthony Minessale <anthm@freeswitch.org>
Thu, 30 Mar 2017 16:20:37 +0000 (11:20 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Thu, 30 Mar 2017 16:20:41 +0000 (11:20 -0500)
src/mod/applications/mod_conference/conference_video.c
src/switch_core_media.c

index 9209532af2db54875854681123b7bb5cb3d16f4c..f7b55588df13c05adc79552231aeb74ed22effe7 100644 (file)
  */
 #include <mod_conference.h>
 
-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;
-
-       for (i = 0; FPS_VALS[i].ms; i++) {
-               if (FPS_VALS[i].fps == fps) {
+       uint32_t j = 0;
 
-                       conference->video_fps = FPS_VALS[i];
+       if (fps > 100) {
+               return 0;
+       }
 
-                       for (j = 0; j <= conference->canvas_count; j++) {
-                               if (conference->canvases[j]) {
-                                       conference->canvases[j]->video_timer_reset = 1;
-                               }
-                       }
+       conference->video_fps.fps = fps;
+       conference->video_fps.ms = (int) 1000 / fps;
+       conference->video_fps.samples = (int) 90000 / conference->video_fps.ms;
 
-                       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;
 }
 
 
index e05f3d3682701acfbdfc2140ec934db92cab1303..2f279c6c800ca2055e250e90bc1827e9548fbf49 100644 (file)
@@ -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;
-
-       for (i = 0; FPS_VALS[i].ms; i++) {
-               if (FPS_VALS[i].fps == fps) {
-                       *fpsP = FPS_VALS[i];
-                       return 1;
-               }
-       }
+       fpsP->fps = fps;
+       fpsP->ms = (int) 1000 / fps;
+       fpsP->samples = (int) 90000 / fpsP->ms;
 
-       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unknown framerate %f\n", fps);
        return 0;
 }