summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiong Sauw Ming <ming@teluu.com>2014-09-09 04:10:59 +0000
committerLiong Sauw Ming <ming@teluu.com>2014-09-09 04:10:59 +0000
commit6e4021b4bb8ff06b0821519da73e59163d49c7dd (patch)
tree2b50d890a715563fe9ffe57481e0357018656614
parent78dde9dab5ca35529bca5766ec9a9df17d957a24 (diff)
Fixed #1784: Remove the usage of nested structs/unions in PJSUA2 (unsupported by SWIG C++)
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4918 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjsip/include/pjsua2/call.hpp37
-rw-r--r--pjsip/include/pjsua2/siptypes.hpp92
-rw-r--r--pjsip/src/pjsua2/call.cpp4
3 files changed, 74 insertions, 59 deletions
diff --git a/pjsip/include/pjsua2/call.hpp b/pjsip/include/pjsua2/call.hpp
index 16001e0e..e6e680a0 100644
--- a/pjsip/include/pjsua2/call.hpp
+++ b/pjsip/include/pjsua2/call.hpp
@@ -101,10 +101,9 @@ struct RtcpStreamStat
MathStat lossPeriodUsec; /**< Loss period statistics */
- struct {
- unsigned burst; /**< Burst/sequential packet lost detected */
- unsigned random; /**< Random packet lost detected. */
- } lossType; /**< Types of loss detected. */
+ /**< Types of loss detected. */
+ unsigned burst; /**< Burst/sequential packet lost detected */
+ unsigned random; /**< Random packet lost detected. */
MathStat jitterUsec; /**< Jitter statistics */
@@ -237,6 +236,23 @@ struct MediaFmtChangedEvent
};
/**
+ * Media event data.
+ */
+typedef union MediaEventData {
+ /**
+ * Media format changed event data.
+ */
+ MediaFmtChangedEvent fmtChanged;
+
+ /**
+ * Pointer to storage to user event data, if it's outside
+ * this struct
+ */
+ GenericData ptr;
+
+} MediaEventData;
+
+/**
* This structure describes a media event. It corresponds to the
* pjmedia_event structure.
*/
@@ -251,18 +267,7 @@ struct MediaEvent
* Additional data/parameters about the event. The type of data
* will be specific to the event type being reported.
*/
- union {
- /**
- * Media format changed event data.
- */
- MediaFmtChangedEvent fmtChanged;
-
- /**
- * Pointer to storage to user event data, if it's outside
- * this struct
- */
- GenericData ptr;
- } data;
+ MediaEventData data;
/**
* Pointer to original pjmedia_event. Only valid when the struct
diff --git a/pjsip/include/pjsua2/siptypes.hpp b/pjsip/include/pjsua2/siptypes.hpp
index a5e7550f..8e0428b9 100644
--- a/pjsip/include/pjsua2/siptypes.hpp
+++ b/pjsip/include/pjsua2/siptypes.hpp
@@ -524,18 +524,23 @@ struct TimerEvent
};
/**
+ * This structure describes transaction state event source.
+ */
+struct TsxStateEventSrc
+{
+ SipRxData rdata; /**< The incoming message. */
+ SipTxData tdata; /**< The outgoing message. */
+ TimerEntry timer; /**< The timer. */
+ pj_status_t status; /**< Transport error status. */
+ GenericData data; /**< Generic data. */
+};
+
+/**
* This structure describes transaction state changed event.
*/
struct TsxStateEvent
{
- struct
- {
- SipRxData rdata; /**< The incoming message. */
- SipTxData tdata; /**< The outgoing message. */
- TimerEntry timer; /**< The timer. */
- pj_status_t status; /**< Transport error status. */
- GenericData data; /**< Generic data. */
- } src; /**< Event source. */
+ TsxStateEventSrc src; /**< Event source. */
SipTransaction tsx; /**< The transaction. */
pjsip_tsx_state_e prevState; /**< Previous state. */
pjsip_event_id_e type; /**< Type of event source:
@@ -584,6 +589,43 @@ struct UserEvent
};
/**
+ * The event body.
+ */
+struct SipEventBody
+{
+ /**
+ * Timer event.
+ */
+ TimerEvent timer;
+
+ /**
+ * Transaction state has changed event.
+ */
+ TsxStateEvent tsxState;
+
+ /**
+ * Message transmission event.
+ */
+ TxMsgEvent txMsg;
+
+ /**
+ * Transmission error event.
+ */
+ TxErrorEvent txError;
+
+ /**
+ * Message arrival event.
+ */
+ RxMsgEvent rxMsg;
+
+ /**
+ * User event.
+ */
+ UserEvent user;
+
+};
+
+/**
* This structure describe event descriptor to fully identify a SIP event. It
* corresponds to the pjsip_event structure in PJSIP library.
*/
@@ -597,39 +639,7 @@ struct SipEvent
/**
* The event body, which fields depends on the event type.
*/
- struct
- {
- /**
- * Timer event.
- */
- TimerEvent timer;
-
- /**
- * Transaction state has changed event.
- */
- TsxStateEvent tsxState;
-
- /**
- * Message transmission event.
- */
- TxMsgEvent txMsg;
-
- /**
- * Transmission error event.
- */
- TxErrorEvent txError;
-
- /**
- * Message arrival event.
- */
- RxMsgEvent rxMsg;
-
- /**
- * User event.
- */
- UserEvent user;
-
- } body;
+ SipEventBody body;
/**
* Pointer to its original pjsip_event. Only valid when the struct is
diff --git a/pjsip/src/pjsua2/call.cpp b/pjsip/src/pjsua2/call.cpp
index 1e4e72f3..afc4d3d9 100644
--- a/pjsip/src/pjsua2/call.cpp
+++ b/pjsip/src/pjsua2/call.cpp
@@ -56,8 +56,8 @@ void RtcpStreamStat::fromPj(const pjmedia_rtcp_stream_stat &prm)
this->reorder = prm.loss;
this->dup = prm.dup;
this->lossPeriodUsec.fromPj(prm.loss_period);
- this->lossType.burst = prm.loss_type.burst;
- this->lossType.random = prm.loss_type.random;
+ this->burst = prm.loss_type.burst;
+ this->random = prm.loss_type.random;
this->jitterUsec.fromPj(prm.jitter);
}