Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
a0b009e3
提交
a0b009e3
authored
10月 12, 2015
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-8338 #resolve [Ringback does not work correctly on stereo channels]
上级
dc8f2b20
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
34 行增加
和
10 行删除
+34
-10
switch_ivr_originate.c
src/switch_ivr_originate.c
+32
-8
switch_pcm.c
src/switch_pcm.c
+2
-2
没有找到文件。
src/switch_ivr_originate.c
浏览文件 @
a0b009e3
...
...
@@ -817,6 +817,9 @@ struct ringback {
switch_file_handle_t
*
fh
;
int
silence
;
uint8_t
asis
;
int
channels
;
void
*
mux_buf
;
int
mux_buflen
;
};
typedef
struct
ringback
ringback_t
;
...
...
@@ -825,12 +828,29 @@ static int teletone_handler(teletone_generation_session_t *ts, teletone_tone_map
{
ringback_t
*
tto
=
ts
->
user_data
;
int
wrote
;
void
*
buf
;
int
buflen
;
if
(
!
tto
)
{
return
-
1
;
}
wrote
=
teletone_mux_tones
(
ts
,
map
);
switch_buffer_write
(
tto
->
audio_buffer
,
ts
->
buffer
,
wrote
*
2
);
if
(
tto
->
channels
!=
1
)
{
if
(
tto
->
mux_buflen
<
wrote
*
2
*
tto
->
channels
)
{
tto
->
mux_buflen
=
wrote
*
2
*
tto
->
channels
;
tto
->
mux_buf
=
realloc
(
tto
->
mux_buf
,
tto
->
mux_buflen
);
}
memcpy
(
tto
->
mux_buf
,
ts
->
buffer
,
wrote
*
2
);
switch_mux_channels
((
int16_t
*
)
tto
->
mux_buf
,
wrote
,
1
,
tto
->
channels
);
buf
=
tto
->
mux_buf
;
buflen
=
wrote
*
2
*
tto
->
channels
;
}
else
{
buf
=
ts
->
buffer
;
buflen
=
wrote
*
2
;
}
switch_buffer_write
(
tto
->
audio_buffer
,
buf
,
buflen
);
return
0
;
}
...
...
@@ -926,7 +946,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_answer(switch_core_session_t
NULL
,
read_codec
->
implementation
->
actual_samples_per_second
,
read_codec
->
implementation
->
microseconds_per_packet
/
1000
,
1
,
SWITCH_CODEC_FLAG_ENCODE
|
SWITCH_CODEC_FLAG_DECODE
,
NULL
,
read_codec
->
implementation
->
number_of_channels
,
SWITCH_CODEC_FLAG_ENCODE
|
SWITCH_CODEC_FLAG_DECODE
,
NULL
,
switch_core_session_get_pool
(
session
))
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_ERROR
,
"Codec Error!
\n
"
);
if
(
caller_channel
)
{
...
...
@@ -994,6 +1014,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_answer(switch_core_session_t
teletone_init_session
(
&
ringback
.
ts
,
0
,
teletone_handler
,
&
ringback
);
ringback
.
ts
.
rate
=
read_codec
->
implementation
->
actual_samples_per_second
;
ringback
.
channels
=
read_codec
->
implementation
->
number_of_channels
;
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_DEBUG
,
"Play Ringback Tone [%s]
\n
"
,
ringback_data
);
if
(
teletone_run
(
&
ringback
.
ts
,
ringback_data
))
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_ERROR
,
"Error Playing Tone
\n
"
);
...
...
@@ -1107,6 +1128,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_answer(switch_core_session_t
ringback
.
fh
=
NULL
;
}
else
if
(
ringback
.
audio_buffer
)
{
teletone_destroy_session
(
&
ringback
.
ts
);
switch_safe_free
(
ringback
.
mux_buf
);
switch_buffer_destroy
(
&
ringback
.
audio_buffer
);
}
...
...
@@ -1238,22 +1260,22 @@ static switch_status_t setup_ringback(originate_global_t *oglobals, originate_st
}
else
{
switch_core_session_get_read_impl
(
oglobals
->
session
,
&
peer_read_impl
);
}
if
(
switch_core_codec_init
(
write_codec
,
"L16"
,
NULL
,
NULL
,
peer_read_impl
.
actual_samples_per_second
,
peer_read_impl
.
microseconds_per_packet
/
1000
,
1
,
SWITCH_CODEC_FLAG_ENCODE
|
SWITCH_CODEC_FLAG_DECODE
,
NULL
,
peer_read_impl
.
number_of_channels
,
SWITCH_CODEC_FLAG_ENCODE
|
SWITCH_CODEC_FLAG_DECODE
,
NULL
,
switch_core_session_get_pool
(
oglobals
->
session
))
==
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
oglobals
->
session
),
SWITCH_LOG_DEBUG
,
"Raw Codec Activation Success L16@%uhz
1
channel %dms
\n
"
,
peer_read_impl
.
actual_samples_per_second
,
peer_read_impl
.
microseconds_per_packet
/
1000
);
"Raw Codec Activation Success L16@%uhz
%d
channel %dms
\n
"
,
peer_read_impl
.
actual_samples_per_second
,
peer_read_impl
.
number_of_channels
,
peer_read_impl
.
microseconds_per_packet
/
1000
);
write_frame
->
codec
=
write_codec
;
write_frame
->
datalen
=
read_codec
->
implementation
->
decoded_bytes_per_packet
;
write_frame
->
datalen
=
peer_read_impl
.
decoded_bytes_per_packet
;
write_frame
->
samples
=
write_frame
->
datalen
/
2
;
memset
(
write_frame
->
data
,
255
,
write_frame
->
datalen
);
switch_core_session_set_read_codec
(
oglobals
->
session
,
write_codec
);
...
...
@@ -1317,6 +1339,7 @@ static switch_status_t setup_ringback(originate_global_t *oglobals, originate_st
teletone_init_session
(
&
ringback
->
ts
,
0
,
teletone_handler
,
ringback
);
ringback
->
ts
.
rate
=
read_codec
->
implementation
->
actual_samples_per_second
;
ringback
->
channels
=
read_codec
->
implementation
->
number_of_channels
;
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
oglobals
->
session
),
SWITCH_LOG_DEBUG
,
"Play Ringback Tone [%s]
\n
"
,
ringback_data
);
/* ringback->ts.debug = 1;
ringback->ts.debug_stream = switch_core_get_console(); */
...
...
@@ -1782,7 +1805,7 @@ static void *SWITCH_THREAD_FUNC early_thread_run(switch_thread_t *thread, void *
NULL
,
read_impl
.
actual_samples_per_second
,
read_impl
.
microseconds_per_packet
/
1000
,
1
,
SWITCH_CODEC_FLAG_ENCODE
|
SWITCH_CODEC_FLAG_DECODE
,
NULL
,
read_impl
.
number_of_channels
,
SWITCH_CODEC_FLAG_ENCODE
|
SWITCH_CODEC_FLAG_DECODE
,
NULL
,
switch_core_session_get_pool
(
session
))
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_SESSION_LOG
(
session
),
SWITCH_LOG_ERROR
,
"Codec Error!
\n
"
);
}
...
...
@@ -3772,6 +3795,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
ringback
.
fh
=
NULL
;
}
else
if
(
ringback
.
audio_buffer
)
{
teletone_destroy_session
(
&
ringback
.
ts
);
switch_safe_free
(
ringback
.
mux_buf
);
switch_buffer_destroy
(
&
ringback
.
audio_buffer
);
}
...
...
src/switch_pcm.c
浏览文件 @
a0b009e3
...
...
@@ -574,7 +574,7 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load)
48000
,
/* actual samples transferred per second */
768000
*
2
,
/* bits transferred per second */
ms_per_frame
,
/* number of microseconds per frame */
samples_per_frame
*
2
,
/* number of samples per frame */
samples_per_frame
,
/* number of samples per frame */
bytes_per_frame
*
2
,
/* number of bytes per frame decompressed */
bytes_per_frame
*
2
,
/* number of bytes per frame compressed */
2
,
/* number of channels represented */
...
...
@@ -764,7 +764,7 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load)
48000
,
/* actual samples transferred per second */
768000
*
2
,
/* bits transferred per second */
ms_per_frame
,
/* number of microseconds per frame */
samples_per_frame
*
2
,
/* number of samples per frame */
samples_per_frame
,
/* number of samples per frame */
bytes_per_frame
*
2
,
/* number of bytes per frame decompressed */
bytes_per_frame
*
2
,
/* number of bytes per frame compressed */
2
,
/* number of channels represented */
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论