提交 c7ca09b9 authored 作者: Raul Fragoso's avatar Raul Fragoso

More flag checks

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk/contrib@14046 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 e619919f
...@@ -166,6 +166,8 @@ static void printChannels(switch_stream_handle_t* stream, unsigned int device, ...@@ -166,6 +166,8 @@ static void printChannels(switch_stream_handle_t* stream, unsigned int device,
*/ */
static switch_status_t tech_init(KhompPvt *tech_pvt, switch_core_session_t *session) static switch_status_t tech_init(KhompPvt *tech_pvt, switch_core_session_t *session)
{ {
tech_pvt->flags = 0;
tech_pvt->_read_frame.data = tech_pvt->_databuf; tech_pvt->_read_frame.data = tech_pvt->_databuf;
tech_pvt->_read_frame.buflen = sizeof(tech_pvt->_databuf); tech_pvt->_read_frame.buflen = sizeof(tech_pvt->_databuf);
......
...@@ -241,6 +241,9 @@ bool KhompPvt::obtain_tx(void) ...@@ -241,6 +241,9 @@ bool KhompPvt::obtain_tx(void)
bool KhompPvt::start_stream(void) bool KhompPvt::start_stream(void)
{ {
if(switch_test_flag(this, TFLAG_STREAM))
return true;
try try
{ {
Globals::_k3lapi.mixer(_KDeviceId, _KChannelId, 0, kmsPlay, _KChannelId); Globals::_k3lapi.mixer(_KDeviceId, _KChannelId, 0, kmsPlay, _KChannelId);
...@@ -258,6 +261,9 @@ bool KhompPvt::start_stream(void) ...@@ -258,6 +261,9 @@ bool KhompPvt::start_stream(void)
bool KhompPvt::stop_stream(void) bool KhompPvt::stop_stream(void)
{ {
if(!switch_test_flag(this, TFLAG_STREAM))
return true;
try try
{ {
Globals::_k3lapi.mixer(_KDeviceId, _KChannelId, 0, kmsGenerator, kmtSilence); Globals::_k3lapi.mixer(_KDeviceId, _KChannelId, 0, kmsGenerator, kmtSilence);
...@@ -275,6 +281,9 @@ bool KhompPvt::stop_stream(void) ...@@ -275,6 +281,9 @@ bool KhompPvt::stop_stream(void)
bool KhompPvt::start_listen(bool conn_rx) bool KhompPvt::start_listen(bool conn_rx)
{ {
if(switch_test_flag(this, TFLAG_LISTEN))
return true;
const size_t buffer_size = KHOMP_PACKET_SIZE; const size_t buffer_size = KHOMP_PACKET_SIZE;
if (conn_rx) if (conn_rx)
...@@ -299,6 +308,9 @@ bool KhompPvt::start_listen(bool conn_rx) ...@@ -299,6 +308,9 @@ bool KhompPvt::start_listen(bool conn_rx)
bool KhompPvt::stop_listen(void) bool KhompPvt::stop_listen(void)
{ {
if(!switch_test_flag(this, TFLAG_LISTEN))
return true;
try try
{ {
Globals::_k3lapi.command(_KDeviceId, _KChannelId, CM_STOP_LISTEN); Globals::_k3lapi.command(_KDeviceId, _KChannelId, CM_STOP_LISTEN);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论