提交 e39a63d8 authored 作者: Anthony Minessale's avatar Anthony Minessale

changes to put freeswitch in control of lifecycle of some critical objects, -sigh

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11899 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 d47662fc
...@@ -106,6 +106,18 @@ class FSManager : public OpalManager { ...@@ -106,6 +106,18 @@ class FSManager : public OpalManager {
list < FSListener > m_listeners; list < FSListener > m_listeners;
}; };
class FSConnection;
typedef struct {
switch_timer_t read_timer;
switch_codec_t read_codec;
switch_codec_t write_codec;
switch_timer_t vid_read_timer;
switch_codec_t vid_read_codec;
switch_codec_t vid_write_codec;
FSConnection *me;
} opal_private_t;
class FSEndPoint:public OpalLocalEndPoint { class FSEndPoint:public OpalLocalEndPoint {
PCLASSINFO(FSEndPoint, OpalLocalEndPoint); PCLASSINFO(FSEndPoint, OpalLocalEndPoint);
...@@ -117,23 +129,25 @@ class FSEndPoint:public OpalLocalEndPoint { ...@@ -117,23 +129,25 @@ class FSEndPoint:public OpalLocalEndPoint {
}; };
#define DECLARE_CALLBACK0(name) \ #define DECLARE_CALLBACK0(name) \
static switch_status_t name(switch_core_session_t *session) { \ static switch_status_t name(switch_core_session_t *session) { \
FSConnection * conn = (FSConnection *)switch_core_session_get_private(session); \ opal_private_t *tech_pvt = (opal_private_t *) switch_core_session_get_private(session); \
return conn != NULL ? conn->name() : SWITCH_STATUS_FALSE; } \ return tech_pvt && tech_pvt->me != NULL ? tech_pvt->me->name() : SWITCH_STATUS_FALSE; } \
switch_status_t name() switch_status_t name()
#define DECLARE_CALLBACK1(name, type1, name1) \ #define DECLARE_CALLBACK1(name, type1, name1) \
static switch_status_t name(switch_core_session_t *session, type1 name1) { \ static switch_status_t name(switch_core_session_t *session, type1 name1) { \
FSConnection * conn = (FSConnection *)switch_core_session_get_private(session); \ opal_private_t *tech_pvt = (opal_private_t *) switch_core_session_get_private(session); \
return conn != NULL ? conn->name(name1) : SWITCH_STATUS_FALSE; } \ return tech_pvt && tech_pvt->me != NULL ? tech_pvt->me->name(name1) : SWITCH_STATUS_FALSE; } \
switch_status_t name(type1 name1) switch_status_t name(type1 name1)
#define DECLARE_CALLBACK3(name, type1, name1, type2, name2, type3, name3) \ #define DECLARE_CALLBACK3(name, type1, name1, type2, name2, type3, name3) \
static switch_status_t name(switch_core_session_t *session, type1 name1, type2 name2, type3 name3) { \ static switch_status_t name(switch_core_session_t *session, type1 name1, type2 name2, type3 name3) { \
FSConnection * conn = (FSConnection *)switch_core_session_get_private(session); \ opal_private_t *tech_pvt = (opal_private_t *) switch_core_session_get_private(session); \
return conn != NULL ? conn->name(name1, name2, name3) : SWITCH_STATUS_FALSE; } \ return tech_pvt && tech_pvt->me != NULL ? tech_pvt->me->name(name1, name2, name3) : SWITCH_STATUS_FALSE; } \
switch_status_t name(type1 name1, type2 name2, type3 name3) switch_status_t name(type1 name1, type2 name2, type3 name3)
class FSConnection:public OpalLocalConnection { class FSConnection:public OpalLocalConnection {
...@@ -156,7 +170,8 @@ class FSConnection:public OpalLocalConnection { ...@@ -156,7 +170,8 @@ class FSConnection:public OpalLocalConnection {
DECLARE_CALLBACK0(on_init); DECLARE_CALLBACK0(on_init);
DECLARE_CALLBACK0(on_routing); DECLARE_CALLBACK0(on_routing);
DECLARE_CALLBACK0(on_execute); DECLARE_CALLBACK0(on_execute);
DECLARE_CALLBACK0(on_hangup); //DECLARE_CALLBACK0(on_hangup);
DECLARE_CALLBACK0(on_loopback); DECLARE_CALLBACK0(on_loopback);
DECLARE_CALLBACK0(on_transmit); DECLARE_CALLBACK0(on_transmit);
...@@ -206,8 +221,8 @@ class FSMediaStream:public OpalMediaStream { ...@@ -206,8 +221,8 @@ class FSMediaStream:public OpalMediaStream {
private: private:
switch_core_session_t *m_fsSession; switch_core_session_t *m_fsSession;
switch_channel_t *m_fsChannel; switch_channel_t *m_fsChannel;
switch_timer_t m_switchTimer; switch_timer_t *m_switchTimer;
switch_codec_t m_switchCodec; switch_codec_t *m_switchCodec;
switch_frame_t m_readFrame; switch_frame_t m_readFrame;
RTP_DataFrame m_readRTP; RTP_DataFrame m_readRTP;
bool m_callOnStart; bool m_callOnStart;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论