]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-10050: [core] chromakey
authorAnthony Minessale <anthm@freeswitch.org>
Fri, 3 Mar 2017 23:33:33 +0000 (17:33 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Fri, 3 Mar 2017 23:33:33 +0000 (17:33 -0600)
src/switch_core_video.c

index 003e4a91b561f9e221cc381c0092bfc3b8639327..a467e76e30e0fc760aba94df358a45b8cb8e87b4 100644 (file)
@@ -901,6 +901,7 @@ struct switch_chromakey_s {
        
        switch_rgb_color_t auto_color;
        int no_cache;
+       int frames_read;
 };
 
 SWITCH_DECLARE(switch_shade_t) switch_chromakey_str2shade(switch_chromakey_t *ck, const char *shade_name)
@@ -1122,6 +1123,12 @@ SWITCH_DECLARE(void) switch_chromakey_process(switch_chromakey_t *ck, switch_ima
        cache_img = ck->cache_img;
        ck->cache_img = NULL;
 
+       ck->frames_read++;
+
+       if ((ck->frames_read % 300) == 0) {
+               ck->no_cache = 2;
+       }
+
        if (cache_img && (cache_img->d_w != img->d_w || cache_img->d_h != img->d_h)) {
                switch_img_free(&cache_img);
        }