]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-3069 --resolve
authorMarc Olivier Chouinard <mochouinard@moctel.com>
Thu, 15 Dec 2011 02:19:15 +0000 (21:19 -0500)
committerMarc Olivier Chouinard <mochouinard@moctel.com>
Thu, 15 Dec 2011 02:19:15 +0000 (21:19 -0500)
src/include/switch_types.h
src/switch_core_media_bug.c
src/switch_ivr_async.c

index 2ab4c07984cb824b42f8ed285152f67b8fba3ced..62af4f9aaf1aa0a4746801c095a186a2fca664f5 100644 (file)
@@ -1402,6 +1402,9 @@ SMBF_READ_REPLACE - Replace the Read Stream
 SMBF_STEREO - Record in stereo
 SMBF_ANSWER_RECORD_REQ - Don't record until the channel is answered
 SMBF_THREAD_LOCK - Only let the same thread who created the bug remove it.
+SMBF_PRUNE - 
+SMBF_NO_PAUSE - 
+SMBF_STEREO_SWAP - Record in stereo: Write Stream - left channel, Read Stream - right channel
 </pre>
 */
 typedef enum {
@@ -1415,7 +1418,8 @@ typedef enum {
        SMBF_ANSWER_REQ = (1 << 6),
        SMBF_THREAD_LOCK = (1 << 7),
        SMBF_PRUNE = (1 << 8),
-       SMBF_NO_PAUSE = (1 << 9)
+       SMBF_NO_PAUSE = (1 << 9),
+       SMBF_STEREO_SWAP = (1 << 10)
 } switch_media_bug_flag_enum_t;
 typedef uint32_t switch_media_bug_flag_t;
 
index 2c33ca2707c8c5ee3ace9fa326409d159a2218c3..7e75ae9e962fc7dea834d082f7c1f93c82e6326b 100644 (file)
@@ -207,14 +207,27 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b
        }
 
        if (switch_test_flag(bug, SMBF_STEREO)) {
+               int16_t *left, *right;
+               size_t left_len, right_len;
+               if (switch_test_flag(bug, SMBF_STEREO_SWAP)) {
+                       left = dp; /* write stream */
+                       left_len = wlen;
+                       right = fp; /* read stream */
+                       right_len = rlen;
+               } else {
+                       left = fp; /* read stream */
+                       left_len = rlen;
+                       right = dp; /* write stream */
+                       right_len = wlen;
+               }
                for (x = 0; x < blen; x++) {
-                       if (x < rlen) {
-                               *(tp++) = *(fp + x);
+                       if (x < left_len) {
+                               *(tp++) = *(left + x);
                        } else {
                                *(tp++) = 0;
                        }
-                       if (x < wlen) {
-                               *(tp++) = *(dp + x);
+                       if (x < right_len) {
+                               *(tp++) = *(right + x);
                        } else {
                                *(tp++) = 0;
                        }
index 0ecc89c16621245f4a69de873c96c2b352a8a087..ec3d1fa4eed0a4aa50147c32a2edb07c0b4b0eee 100644 (file)
@@ -1589,6 +1589,13 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t
 
        if ((p = switch_channel_get_variable(channel, "RECORD_STEREO")) && switch_true(p)) {
                flags |= SMBF_STEREO;
+               flags &= ~SMBF_STEREO_SWAP;
+               channels = 2;
+       }
+
+       if ((p = switch_channel_get_variable(channel, "RECORD_STEREO_SWAP")) && switch_true(p)) {
+               flags |= SMBF_STEREO;
+               flags |= SMBF_STEREO_SWAP;
                channels = 2;
        }