Re-add 'o' option to MeetMe, reverting rev 62297.
authorRussell Bryant <russell@russellbryant.com>
Wed, 18 Feb 2009 19:12:49 +0000 (19:12 +0000)
committerRussell Bryant <russell@russellbryant.com>
Wed, 18 Feb 2009 19:12:49 +0000 (19:12 +0000)
Enabling this option by default proved to be a bad idea, as the talker detection
is not very reliable.  So, make it optional again, and off by default.

(issue #13801)
Reported by: justdave

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@177101 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_meetme.c

index d4cc236..67ab096 100644 (file)
@@ -502,6 +502,8 @@ enum {
        CONFFLAG_EMPTY = (1 << 18),
        CONFFLAG_EMPTYNOPIN = (1 << 19),
        CONFFLAG_ALWAYSPROMPT = (1 << 20),
        CONFFLAG_EMPTY = (1 << 18),
        CONFFLAG_EMPTYNOPIN = (1 << 19),
        CONFFLAG_ALWAYSPROMPT = (1 << 20),
+       /*! If set, treat talking users as muted users */
+       CONFFLAG_OPTIMIZETALKER = (1 << 21),
        /*! If set, won't speak the extra prompt when the first person 
         *  enters the conference */
        CONFFLAG_NOONLYPERSON = (1 << 22),
        /*! If set, won't speak the extra prompt when the first person 
         *  enters the conference */
        CONFFLAG_NOONLYPERSON = (1 << 22),
@@ -546,6 +548,7 @@ AST_APP_OPTIONS(meetme_opts, BEGIN_OPTIONS
        AST_APP_OPTION('I', CONFFLAG_INTROUSERNOREVIEW ),
        AST_APP_OPTION_ARG('M', CONFFLAG_MOH, OPT_ARG_MOH_CLASS ),
        AST_APP_OPTION('m', CONFFLAG_STARTMUTED ),
        AST_APP_OPTION('I', CONFFLAG_INTROUSERNOREVIEW ),
        AST_APP_OPTION_ARG('M', CONFFLAG_MOH, OPT_ARG_MOH_CLASS ),
        AST_APP_OPTION('m', CONFFLAG_STARTMUTED ),
+       AST_APP_OPTION('o', CONFFLAG_OPTIMIZETALKER ),
        AST_APP_OPTION('P', CONFFLAG_ALWAYSPROMPT ),
        AST_APP_OPTION_ARG('p', CONFFLAG_KEYEXIT, OPT_ARG_EXITKEYS ),
        AST_APP_OPTION('q', CONFFLAG_QUIET ),
        AST_APP_OPTION('P', CONFFLAG_ALWAYSPROMPT ),
        AST_APP_OPTION_ARG('p', CONFFLAG_KEYEXIT, OPT_ARG_EXITKEYS ),
        AST_APP_OPTION('q', CONFFLAG_QUIET ),
@@ -2481,7 +2484,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
                        x = 1;
                        ast_channel_setoption(chan, AST_OPTION_TONE_VERIFY, &x, sizeof(char), 0);
                }       
                        x = 1;
                        ast_channel_setoption(chan, AST_OPTION_TONE_VERIFY, &x, sizeof(char), 0);
                }       
-               if (!(confflags & CONFFLAG_MONITOR) && !(dsp = ast_dsp_new())) {
+               if ((confflags & CONFFLAG_OPTIMIZETALKER) && !(confflags & CONFFLAG_MONITOR) && !(dsp = ast_dsp_new())) {
                        ast_log(LOG_WARNING, "Unable to allocate DSP!\n");
                        res = -1;
                }
                        ast_log(LOG_WARNING, "Unable to allocate DSP!\n");
                        res = -1;
                }
@@ -2852,7 +2855,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
                                                ast_frame_adjust_volume(f, user->talk.actual);
                                        }
 
                                                ast_frame_adjust_volume(f, user->talk.actual);
                                        }
 
-                                       if (!(confflags & CONFFLAG_MONITOR)) {
+                                       if ((confflags & CONFFLAG_OPTIMIZETALKER) && !(confflags & CONFFLAG_MONITOR)) {
                                                int totalsilence;
 
                                                if (user->talking == -1) {
                                                int totalsilence;
 
                                                if (user->talking == -1) {
@@ -2897,7 +2900,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
                                                   don't want to block, but we do want to at least *try*
                                                   to write out all the samples.
                                                 */
                                                   don't want to block, but we do want to at least *try*
                                                   to write out all the samples.
                                                 */
-                                               if (user->talking) {
+                                               if (user->talking && !(confflags & CONFFLAG_OPTIMIZETALKER)) {
                                                        careful_write(fd, f->data.ptr, f->datalen, 0);
                                                }
                                        }
                                                        careful_write(fd, f->data.ptr, f->datalen, 0);
                                                }
                                        }
@@ -3163,10 +3166,11 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c
                                        fr.samples = res / 2;
                                        fr.data.ptr = buf;
                                        fr.offset = AST_FRIENDLY_OFFSET;
                                        fr.samples = res / 2;
                                        fr.data.ptr = buf;
                                        fr.offset = AST_FRIENDLY_OFFSET;
-                                       if (!user->listen.actual && 
-                                               ((confflags & CONFFLAG_MONITOR) || 
+                                       if (!user->listen.actual &&
+                                               ((confflags & CONFFLAG_MONITOR) ||
                                                 (user->adminflags & (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED)) ||
                                                 (user->adminflags & (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED)) ||
-                                                (!user->talking)) ) {
+                                                (!user->talking && (confflags & CONFFLAG_OPTIMIZETALKER))
+                                                )) {
                                                int idx;
                                                for (idx = 0; idx < AST_FRAME_BITS; idx++) {
                                                        if (chan->rawwriteformat & (1 << idx)) {
                                                int idx;
                                                for (idx = 0; idx < AST_FRAME_BITS; idx++) {
                                                        if (chan->rawwriteformat & (1 << idx)) {