Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
41a7d1cf
提交
41a7d1cf
authored
6月 30, 2014
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
some refactoring to make new stereo stuff more stable
上级
591ea9e9
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
45 行增加
和
16 行删除
+45
-16
mod_conference.c
src/mod/applications/mod_conference/mod_conference.c
+45
-16
没有找到文件。
src/mod/applications/mod_conference/mod_conference.c
浏览文件 @
41a7d1cf
...
@@ -731,6 +731,11 @@ static void gen_arc(conference_obj_t *conference, switch_stream_handle_t *stream
...
@@ -731,6 +731,11 @@ static void gen_arc(conference_obj_t *conference, switch_stream_handle_t *stream
static
void
process_al
(
al_handle_t
*
al
,
void
*
data
,
switch_size_t
datalen
,
int
rate
)
static
void
process_al
(
al_handle_t
*
al
,
void
*
data
,
switch_size_t
datalen
,
int
rate
)
{
{
if
(
rate
!=
48000
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Only 48khz is supported.
\n
"
);
return
;
}
if
(
!
al
->
device
)
{
if
(
!
al
->
device
)
{
ALCint
contextAttr
[]
=
{
ALCint
contextAttr
[]
=
{
ALC_FORMAT_CHANNELS_SOFT
,
ALC_STEREO_SOFT
,
ALC_FORMAT_CHANNELS_SOFT
,
ALC_STEREO_SOFT
,
...
@@ -740,11 +745,11 @@ static void process_al(al_handle_t *al, void *data, switch_size_t datalen, int r
...
@@ -740,11 +745,11 @@ static void process_al(al_handle_t *al, void *data, switch_size_t datalen, int r
0
0
};
};
switch_mutex_lock
(
globals
.
setup_mutex
);
if
((
al
->
device
=
alcLoopbackOpenDeviceSOFT
(
NULL
)))
{
if
((
al
->
device
=
alcLoopbackOpenDeviceSOFT
(
NULL
)))
{
static
const
ALshort
silence
[
16
]
=
{
0
};
static
const
ALshort
silence
[
16
]
=
{
0
};
float
orient
[
6
]
=
{
/*fwd:*/
0
.,
0
.,
-
1
.,
/*up:*/
0
.,
1
.,
0
.
};
float
orient
[
6
]
=
{
/*fwd:*/
0
.,
0
.,
-
1
.,
/*up:*/
0
.,
1
.,
0
.
};
al
->
context
=
alcCreateContext
(
al
->
device
,
contextAttr
);
al
->
context
=
alcCreateContext
(
al
->
device
,
contextAttr
);
alcSetThreadContext
(
al
->
context
);
alcSetThreadContext
(
al
->
context
);
...
@@ -765,12 +770,13 @@ static void process_al(al_handle_t *al, void *data, switch_size_t datalen, int r
...
@@ -765,12 +770,13 @@ static void process_al(al_handle_t *al, void *data, switch_size_t datalen, int r
alSourceQueueBuffers
(
al
->
source
,
2
,
al
->
buffer_in
);
alSourceQueueBuffers
(
al
->
source
,
2
,
al
->
buffer_in
);
alSourcePlay
(
al
->
source
);
alSourcePlay
(
al
->
source
);
}
}
switch_mutex_unlock
(
globals
.
setup_mutex
);
}
}
if
(
al
->
device
)
{
if
(
al
->
device
)
{
ALint
processed
=
0
,
state
=
0
;
ALint
processed
=
0
,
state
=
0
;
alcSetThreadContext
(
al
->
context
);
//
alcSetThreadContext(al->context);
alGetSourcei
(
al
->
source
,
AL_SOURCE_STATE
,
&
state
);
alGetSourcei
(
al
->
source
,
AL_SOURCE_STATE
,
&
state
);
alGetSourcei
(
al
->
source
,
AL_BUFFERS_PROCESSED
,
&
processed
);
alGetSourcei
(
al
->
source
,
AL_BUFFERS_PROCESSED
,
&
processed
);
...
@@ -2452,11 +2458,30 @@ static void conference_set_floor_holder(conference_obj_t *conference, conference
...
@@ -2452,11 +2458,30 @@ static void conference_set_floor_holder(conference_obj_t *conference, conference
#ifdef OPENAL_POSITIONING
#ifdef OPENAL_POSITIONING
static
void
close_al
(
al_handle_t
*
al
)
static
void
close_al
(
al_handle_t
*
al
)
{
{
alDeleteSources
(
1
,
&
al
->
source
);
if
(
!
al
)
return
;
alDeleteBuffers
(
2
,
al
->
buffer_in
);
alcDestroyContext
(
al
->
context
);
switch_mutex_lock
(
globals
.
setup_mutex
);
alcCloseDevice
(
al
->
device
);
if
(
al
->
source
)
{
al
->
device
=
NULL
;
alDeleteSources
(
1
,
&
al
->
source
);
al
->
source
=
0
;
}
if
(
al
->
buffer_in
[
0
])
{
alDeleteBuffers
(
2
,
al
->
buffer_in
);
al
->
buffer_in
[
0
]
=
0
;
al
->
buffer_in
[
1
]
=
0
;
}
if
(
al
->
context
)
{
alcDestroyContext
(
al
->
context
);
al
->
context
=
0
;
}
if
(
al
->
device
)
{
alcCloseDevice
(
al
->
device
);
al
->
device
=
NULL
;
}
switch_mutex_unlock
(
globals
.
setup_mutex
);
}
}
#endif
#endif
...
@@ -4024,7 +4049,7 @@ static void member_check_channels(switch_frame_t *frame, conference_member_t *me
...
@@ -4024,7 +4049,7 @@ static void member_check_channels(switch_frame_t *frame, conference_member_t *me
if
(
member
->
conference
->
channels
!=
member
->
read_impl
.
number_of_channels
||
switch_test_flag
(
member
,
MFLAG_POSITIONAL
))
{
if
(
member
->
conference
->
channels
!=
member
->
read_impl
.
number_of_channels
||
switch_test_flag
(
member
,
MFLAG_POSITIONAL
))
{
uint32_t
rlen
;
uint32_t
rlen
;
int
from
,
to
;
int
from
,
to
;
if
(
in
)
{
if
(
in
)
{
to
=
member
->
conference
->
channels
;
to
=
member
->
conference
->
channels
;
from
=
member
->
read_impl
.
number_of_channels
;
from
=
member
->
read_impl
.
number_of_channels
;
...
@@ -4034,15 +4059,15 @@ static void member_check_channels(switch_frame_t *frame, conference_member_t *me
...
@@ -4034,15 +4059,15 @@ static void member_check_channels(switch_frame_t *frame, conference_member_t *me
}
}
rlen
=
frame
->
datalen
/
2
/
from
;
rlen
=
frame
->
datalen
/
2
/
from
;
if
(
((
from
==
1
&&
to
==
2
)
||
(
from
==
2
&&
to
==
2
&&
in
))
&&
switch_test_flag
(
member
,
MFLAG_POSITIONAL
))
{
if
(
in
&&
frame
->
rate
==
48000
&&
((
from
==
1
&&
to
==
2
)
||
(
from
==
2
&&
to
==
2
))
&&
switch_test_flag
(
member
,
MFLAG_POSITIONAL
))
{
if
(
from
==
2
&&
to
==
2
)
{
if
(
from
==
2
&&
to
==
2
)
{
switch_mux_channels
((
int16_t
*
)
frame
->
data
,
rlen
,
2
,
1
);
switch_mux_channels
((
int16_t
*
)
frame
->
data
,
rlen
,
2
,
1
);
frame
->
datalen
/=
2
;
frame
->
datalen
/=
2
;
rlen
=
frame
->
datalen
/
2
;
rlen
=
frame
->
datalen
/
2
;
}
}
process_al
(
member
->
al
,
frame
->
data
,
frame
->
datalen
,
member
->
read_impl
.
actual_samples_per_second
);
process_al
(
member
->
al
,
frame
->
data
,
frame
->
datalen
,
frame
->
rate
);
}
else
{
}
else
{
switch_mux_channels
((
int16_t
*
)
frame
->
data
,
rlen
,
from
,
to
);
switch_mux_channels
((
int16_t
*
)
frame
->
data
,
rlen
,
from
,
to
);
}
}
...
@@ -4064,6 +4089,7 @@ static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, v
...
@@ -4064,6 +4089,7 @@ static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, v
uint32_t
hangover
=
40
,
hangunder
=
5
,
hangover_hits
=
0
,
hangunder_hits
=
0
,
diff_level
=
400
;
uint32_t
hangover
=
40
,
hangunder
=
5
,
hangover_hits
=
0
,
hangunder_hits
=
0
,
diff_level
=
400
;
switch_core_session_t
*
session
=
member
->
session
;
switch_core_session_t
*
session
=
member
->
session
;
uint32_t
flush_len
,
loops
=
0
;
uint32_t
flush_len
,
loops
=
0
;
switch_frame_t
tmp_frame
=
{
0
};
if
(
switch_core_session_read_lock
(
session
)
!=
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_core_session_read_lock
(
session
)
!=
SWITCH_STATUS_SUCCESS
)
{
goto
end
;
goto
end
;
...
@@ -4102,8 +4128,6 @@ static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, v
...
@@ -4102,8 +4128,6 @@ static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, v
break
;
break
;
}
}
member_check_channels
(
read_frame
,
member
,
SWITCH_TRUE
);
if
(
switch_channel_test_flag
(
channel
,
CF_VIDEO
)
&&
!
switch_test_flag
(
member
,
MFLAG_ACK_VIDEO
))
{
if
(
switch_channel_test_flag
(
channel
,
CF_VIDEO
)
&&
!
switch_test_flag
(
member
,
MFLAG_ACK_VIDEO
))
{
switch_set_flag_locked
(
member
,
MFLAG_ACK_VIDEO
);
switch_set_flag_locked
(
member
,
MFLAG_ACK_VIDEO
);
switch_channel_clear_flag
(
channel
,
CF_VIDEO_ECHO
);
switch_channel_clear_flag
(
channel
,
CF_VIDEO_ECHO
);
...
@@ -4219,7 +4243,7 @@ static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, v
...
@@ -4219,7 +4243,7 @@ static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, v
switch_test_flag
(
member
,
MFLAG_CAN_SPEAK
)
&&
switch_test_flag
(
member
,
MFLAG_CAN_SPEAK
)
&&
noise_gate_check
(
member
)
noise_gate_check
(
member
)
)
{
)
{
int
last_shift
=
abs
(
member
->
last_score
-
member
->
score
);
int
last_shift
=
abs
(
(
int
)(
member
->
last_score
-
member
->
score
)
);
if
(
member
->
score
&&
member
->
last_score
&&
last_shift
>
900
)
{
if
(
member
->
score
&&
member
->
last_score
&&
last_shift
>
900
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG7
,
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG7
,
...
@@ -4365,6 +4389,11 @@ static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, v
...
@@ -4365,6 +4389,11 @@ static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, v
datalen
=
read_frame
->
datalen
;
datalen
=
read_frame
->
datalen
;
}
}
tmp_frame
.
data
=
data
;
tmp_frame
.
datalen
=
datalen
;
tmp_frame
.
rate
=
member
->
conference
->
rate
;
member_check_channels
(
&
tmp_frame
,
member
,
SWITCH_TRUE
);
if
(
datalen
)
{
if
(
datalen
)
{
switch_size_t
ok
=
1
;
switch_size_t
ok
=
1
;
...
@@ -4375,7 +4404,7 @@ static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, v
...
@@ -4375,7 +4404,7 @@ static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, v
switch_buffer_zero
(
member
->
audio_buffer
);
switch_buffer_zero
(
member
->
audio_buffer
);
switch_channel_audio_sync
(
channel
);
switch_channel_audio_sync
(
channel
);
}
}
ok
=
switch_buffer_write
(
member
->
audio_buffer
,
data
,
datalen
);
ok
=
switch_buffer_write
(
member
->
audio_buffer
,
tmp_frame
.
data
,
tmp_frame
.
datalen
);
switch_mutex_unlock
(
member
->
audio_in_mutex
);
switch_mutex_unlock
(
member
->
audio_in_mutex
);
if
(
!
ok
)
{
if
(
!
ok
)
{
switch_mutex_unlock
(
member
->
read_mutex
);
switch_mutex_unlock
(
member
->
read_mutex
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论