FS-3069 --resolve

This commit is contained in:
Marc Olivier Chouinard 2011-12-14 21:19:15 -05:00
parent 904721e4f4
commit d5042f2c1d
3 changed files with 29 additions and 5 deletions

View 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;

View 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;
}

View 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;
}