]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[core, mod_opus] bring more fmtp params to core (offer/answer).
authorDragos Oancea <dragos@signalwire.com>
Thu, 11 May 2023 00:55:11 +0000 (03:55 +0300)
committerDragos Oancea <dragos@signalwire.com>
Thu, 15 Jun 2023 13:26:17 +0000 (16:26 +0300)
src/include/switch_module_interfaces.h
src/mod/codecs/mod_opus/mod_opus.c
src/switch_core_media.c

index 7c54ed67df1082244895713f8592328980b0dec5..ddaaf120a1be8c82bb6bc6f44c5892291d604630 100644 (file)
@@ -676,8 +676,14 @@ struct switch_codec_fmtp {
        int bits_per_second;
        /*! number of microseconds of media in one packet (ptime * 1000) */
        int microseconds_per_packet;
-       /*! stereo  */
-       int stereo;
+       /*! maximum ptime in ms */
+       int max_ptime;
+       /*! minimum ptime in ms */
+       int min_ptime;
+       /*! stereo, typically bidirectional */
+       int stereo; 
+       /* sender properties (stereo) */
+       int sprop_stereo;
        /*! private data for the codec module to store handle specific info */
        void *private_info;
 
index 1ab7d9fba1ba9215f09a64fcf38d2445d2b4eea2..ce364cc3eff8903121353d7613ea6d03f195bebe 100644 (file)
@@ -273,10 +273,12 @@ static switch_status_t switch_opus_fmtp_parse(const char *fmtp, switch_codec_fmt
 
                                        if (!strcasecmp(data, "maxptime")) {
                                                codec_settings->maxptime = atoi(arg);
+                                               codec_fmtp->max_ptime = codec_settings->maxptime;
                                        }
 
                                        if (!strcasecmp(data, "minptime")) {
                                                codec_settings->minptime = atoi(arg);
+                                               codec_fmtp->min_ptime = codec_settings->minptime;
                                        }
 
                                        if (!strcasecmp(data, "ptime")) {
@@ -291,6 +293,7 @@ static switch_status_t switch_opus_fmtp_parse(const char *fmtp, switch_codec_fmt
 
                                        if (!strcasecmp(data, "sprop-stereo")) {
                                                codec_settings->sprop_stereo = atoi(arg);
+                                               codec_fmtp->sprop_stereo = codec_settings->sprop_stereo;
                                        }
 
                                        if (!strcasecmp(data, "maxaveragebitrate")) {
index 8ed496bda7687cfdb8cf4b24040f5ce389e85c12..60cc3d531c27322d04367850f19c6e0ab3ecc8d0 100644 (file)
@@ -5497,6 +5497,10 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                                } else if (!strcasecmp(map->rm_encoding, "opus")) {
                                                        map_channels = 1;
                                                }
+
+                                               if (codec_fmtp.max_ptime) {
+                                                       maxptime = codec_fmtp.max_ptime;
+                                               }
                                        }
                                }