]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-7809: mod_opus: added 60 ms ptime for Opus at 8 khz ( opus@8000h@60i )
authorDragos Oancea <droancea@yahoo.com>
Wed, 8 Jul 2015 22:09:48 +0000 (18:09 -0400)
committerDragos Oancea <droancea@yahoo.com>
Thu, 9 Jul 2015 15:53:37 +0000 (11:53 -0400)
src/mod/codecs/mod_opus/mod_opus.c

index 02287e49959bb4c55631be69a2e9078fef22c70b..d82114ec64f07a53a9e9c9080b71bfe1b8b3680f 100644 (file)
@@ -881,7 +881,29 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_opus_load)
                                                                                         switch_opus_decode,    /* function to decode encoded data into raw data */
                                                                                         switch_opus_destroy);  /* deinitalize a codec handle using this implementation */
                codec_interface->implementations->codec_control = switch_opus_control;
-        
+               if (x == 1){ /*20 ms * 3  = 60 ms */
+                       settings.stereo = 0;
+                       dft_fmtp = gen_fmtp(&settings, pool);
+                       switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,    /* enumeration defining the type of the codec */
+                                                                                                116,   /* the IANA code number */
+                                                                                                "opus",/* the IANA code name */
+                                                                                                dft_fmtp,      /* default fmtp to send (can be overridden by the init function) */
+                                                                                                48000, /* samples transferred per second */
+                                                                                                rate,  /* actual samples transferred per second */
+                                                                                                bits,  /* bits transferred per second */
+                                                                                                mss * 3,       /* number of microseconds per frame */
+                                                                                                samples * 3,   /* number of samples per frame */
+                                                                                                bytes * 2 * 3, /* number of bytes per frame decompressed */
+                                                                                                0,     /* number of bytes per frame compressed */
+                                                                                                1,/* number of channels represented */
+                                                                                                1,     /* number of frames per network packet */
+                                                                                                switch_opus_init,      /* function to initialize a codec handle using this implementation */
+                                                                                                switch_opus_encode,    /* function to encode raw data into encoded data */
+                                                                                                switch_opus_decode,    /* function to decode encoded data into raw data */
+                                                                                                switch_opus_destroy);  /* deinitalize a codec handle using this implementation */
+                       codec_interface->implementations->codec_control = switch_opus_control;
+               }
                bytes *= 2;
                samples *= 2;
                mss *= 2;