Changeset 5897
- Timestamp:
- Oct 16, 2018 12:03:21 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia/transport_adapter_sample.c
r5478 r5897 97 97 void *pkt, 98 98 pj_ssize_t); 99 void (*stream_rtp_cb2)(pjmedia_tp_cb_param *param); 99 100 void (*stream_rtcp_cb)(void *user_data, 100 101 void *pkt, … … 161 162 * receives RTP packet. 162 163 */ 163 static void transport_rtp_cb(void *user_data, void *pkt, pj_ssize_t size) 164 { 165 struct tp_adapter *adapter = (struct tp_adapter*)user_data; 166 167 pj_assert(adapter->stream_rtp_cb != NULL); 164 static void transport_rtp_cb2(pjmedia_tp_cb_param *param) 165 { 166 struct tp_adapter *adapter = (struct tp_adapter*)param->user_data; 167 168 pj_assert(adapter->stream_rtp_cb != NULL || 169 adapter->stream_rtp_cb2 != NULL); 168 170 169 171 /* Call stream's callback */ 170 adapter->stream_rtp_cb(adapter->stream_user_data, pkt, size); 172 if (adapter->stream_rtp_cb2) { 173 pjmedia_tp_cb_param cbparam; 174 175 pj_memcpy(&cbparam, param, sizeof(cbparam)); 176 cbparam.user_data = adapter->stream_user_data; 177 adapter->stream_rtp_cb2(&cbparam); 178 } else { 179 adapter->stream_rtp_cb(adapter->stream_user_data, param->pkt, 180 param->size); 181 } 171 182 } 172 183 … … 200 211 pj_assert(adapter->stream_user_data == NULL); 201 212 adapter->stream_user_data = att_param->user_data; 202 adapter->stream_rtp_cb = att_param->rtp_cb; 213 if (att_param->rtp_cb) { 214 adapter->stream_rtp_cb = att_param->rtp_cb; 215 } else { 216 adapter->stream_rtp_cb2 = att_param->rtp_cb2; 217 } 203 218 adapter->stream_rtcp_cb = att_param->rtcp_cb; 204 219 adapter->stream_ref = att_param->stream; 205 220 206 att_param->rtp_cb = &transport_rtp_cb;221 att_param->rtp_cb2 = &transport_rtp_cb2; 207 222 att_param->rtcp_cb = &transport_rtcp_cb; 208 223 att_param->user_data = adapter; … … 212 227 adapter->stream_user_data = NULL; 213 228 adapter->stream_rtp_cb = NULL; 229 adapter->stream_rtp_cb2 = NULL; 214 230 adapter->stream_rtcp_cb = NULL; 215 231 adapter->stream_ref = NULL;
Note: See TracChangeset
for help on using the changeset viewer.