Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
5e2d7dfc
提交
5e2d7dfc
authored
3月 08, 2007
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
git-svn-id:
http://svn.freeswitch.org/svn/freeswitch/trunk@4477
d0543943-73ff-0310-b7d9-9358b9ac24b2
上级
b67b980a
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
35 行增加
和
22 行删除
+35
-22
mod_portaudio.c
src/mod/endpoints/mod_portaudio/mod_portaudio.c
+21
-11
switch_rtp.c
src/switch_rtp.c
+14
-11
没有找到文件。
src/mod/endpoints/mod_portaudio/mod_portaudio.c
浏览文件 @
5e2d7dfc
...
...
@@ -120,6 +120,7 @@ static struct {
private_t
*
call_list
;
int
ring_interval
;
GFLAGS
flags
;
switch_timer_t
timer
;
}
globals
;
...
...
@@ -186,6 +187,7 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
last
=
switch_time_now
()
-
waitsec
;
if
((
val
=
switch_channel_get_variable
(
channel
,
"pa_hold_file"
)))
{
hold_file
=
val
;
}
else
{
...
...
@@ -594,17 +596,6 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
goto
cng
;
}
if
(
switch_core_timer_init
(
&
tech_pvt
->
timer
,
globals
.
timer_name
,
codec_ms
,
globals
.
read_codec
.
implementation
->
samples_per_frame
,
switch_core_session_get_pool
(
tech_pvt
->
session
))
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"setup timer failed!
\n
"
);
switch_core_file_close
(
&
tech_pvt
->
fh
);
switch_core_codec_destroy
(
&
tech_pvt
->
write_codec
);
goto
cng
;
}
tech_pvt
->
hfh
=
&
tech_pvt
->
fh
;
tech_pvt
->
hold_frame
.
data
=
tech_pvt
->
holdbuf
;
tech_pvt
->
hold_frame
.
buflen
=
sizeof
(
tech_pvt
->
holdbuf
);
...
...
@@ -639,6 +630,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
tech_pvt
->
hold_frame
.
datalen
=
(
uint32_t
)(
olen
*
sizeof
(
int16_t
));
tech_pvt
->
hold_frame
.
samples
=
(
uint32_t
)
olen
;
tech_pvt
->
hold_frame
.
timestamp
=
tech_pvt
->
timer
.
samplecount
;
*
frame
=
&
tech_pvt
->
hold_frame
;
}
...
...
@@ -651,6 +643,9 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
if
((
samples
=
ReadAudioStream
(
globals
.
audio_stream
,
globals
.
read_frame
.
data
,
globals
.
read_codec
.
implementation
->
samples_per_frame
))
!=
0
)
{
globals
.
read_frame
.
datalen
=
samples
*
2
;
globals
.
read_frame
.
samples
=
samples
;
switch_core_timer_check
(
&
globals
.
timer
);
globals
.
read_frame
.
timestamp
=
globals
.
timer
.
samplecount
;
*
frame
=
&
globals
.
read_frame
;
if
(
!
switch_test_flag
((
&
globals
),
GFLAG_MOUTH
))
{
...
...
@@ -1312,6 +1307,21 @@ static switch_status_t engage_device(int sample_rate, int codec_ms)
return
SWITCH_STATUS_FALSE
;
}
}
if
(
switch_core_timer_init
(
&
globals
.
timer
,
globals
.
timer_name
,
codec_ms
,
globals
.
read_codec
.
implementation
->
samples_per_frame
,
module_pool
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"setup timer failed!
\n
"
);
switch_core_codec_destroy
(
&
globals
.
read_codec
);
switch_core_codec_destroy
(
&
globals
.
write_codec
);
return
SWITCH_STATUS_FALSE
;
}
globals
.
read_frame
.
rate
=
sample_rate
;
globals
.
read_frame
.
codec
=
&
globals
.
read_codec
;
...
...
src/switch_rtp.c
浏览文件 @
5e2d7dfc
...
...
@@ -1293,6 +1293,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session, void *data, uint32_t data
}
}
rtp_session
->
last_write_ts
=
ntohl
(
send_msg
->
header
.
ts
);
rtp_session
->
last_write_ssrc
=
ntohl
(
send_msg
->
header
.
ssrc
);
rtp_session
->
last_write_seq
=
ntohs
((
u_short
)
send_msg
->
header
.
seq
);
...
...
@@ -1384,15 +1385,16 @@ SWITCH_DECLARE(int) switch_rtp_write(switch_rtp_t *rtp_session, void *data, uint
}
if
(
!
ts
&&
rtp_session
->
timer
.
timer_interface
)
{
rtp_session
->
ts
=
rtp_session
->
timer
.
samplecount
;
uint32_t
sc
=
rtp_session
->
timer
.
samplecount
;
if
(
rtp_session
->
last_write_ts
==
sc
)
{
rtp_session
->
ts
=
sc
+
rtp_session
->
packet_size
;
}
else
{
rtp_session
->
ts
=
sc
;
}
}
else
{
rtp_session
->
ts
=
ts
;
}
if
(
rtp_session
->
ts
<=
rtp_session
->
last_write_ts
)
{
rtp_session
->
ts
+=
rtp_session
->
packet_size
;
}
if
(
rtp_session
->
ts
>
rtp_session
->
last_write_ts
+
rtp_session
->
packet_size
||
rtp_session
->
ts
==
rtp_session
->
packet_size
)
{
mark
++
;
}
...
...
@@ -1449,19 +1451,20 @@ SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp_t *rtp_session, switch_fra
if
(
frame
->
timestamp
)
{
rtp_session
->
ts
=
(
uint32_t
)
frame
->
timestamp
;
}
else
if
(
!
ts
&&
rtp_session
->
timer
.
timer_interface
)
{
rtp_session
->
ts
=
rtp_session
->
timer
.
samplecount
;
uint32_t
sc
=
rtp_session
->
timer
.
samplecount
;
if
(
rtp_session
->
last_write_ts
==
sc
)
{
rtp_session
->
ts
=
sc
+
rtp_session
->
packet_size
;
}
else
{
rtp_session
->
ts
=
sc
;
}
}
else
{
rtp_session
->
ts
=
ts
;
}
if
(
rtp_session
->
ts
>
rtp_session
->
last_write_ts
+
rtp_session
->
packet_size
||
rtp_session
->
ts
==
rtp_session
->
packet_size
)
{
mark
++
;
}
if
(
rtp_session
->
ts
<=
rtp_session
->
last_write_ts
)
{
rtp_session
->
ts
+=
rtp_session
->
packet_size
;
}
rtp_session
->
seq
=
ntohs
(
rtp_session
->
seq
)
+
1
;
rtp_session
->
seq
=
htons
(
rtp_session
->
seq
);
rtp_session
->
send_msg
.
header
.
seq
=
rtp_session
->
seq
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论