- Timestamp:
- Jan 17, 2008 5:29:36 PM (17 years ago)
- Location:
- pjproject/branches/users/nanang
- Files:
-
- 6 added
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/users/nanang/pjmedia/build/pjmedia.vcproj
r1664 r1698 44 44 Optimization="2" 45 45 InlineFunctionExpansion="1" 46 AdditionalIncludeDirectories="../include ,../../pjlib/include,../../pjlib-util/include,../../pjnath/include,../../third_party/portaudio/include,../../third_party/speex/include,../.."46 AdditionalIncludeDirectories="../include;../../pjlib/include;"../../pjlib-util/include";../../pjnath/include;../../third_party/portaudio/include;../../third_party/speex/include;../../third_party/build/srtp;../../third_party/srtp/include;../../third_party/srtp/crypto/include;../.." 47 47 PreprocessorDefinitions="NDEBUG;WIN32;_LIB;PJ_WIN32=1;PJ_M_I386=1" 48 48 StringPooling="true" … … 120 120 Name="VCCLCompilerTool" 121 121 Optimization="0" 122 AdditionalIncludeDirectories="../include ,../../pjlib/include,../../pjlib-util/include,../../pjnath/include,../../third_party/portaudio/include,../../third_party/speex/include,../.."122 AdditionalIncludeDirectories="../include;../../pjlib/include;"../../pjlib-util/include";../../pjnath/include;../../third_party/portaudio/include;../../third_party/speex/include;../../third_party/build/srtp;../../third_party/srtp/include;../../third_party/srtp/crypto/include;../.." 123 123 PreprocessorDefinitions="_DEBUG;WIN32;_LIB;PJ_WIN32=1;PJ_M_I386=1" 124 124 MinimalRebuild="true" … … 967 967 </File> 968 968 <File 969 RelativePath="..\src\pjmedia\transport_srtp.c" 970 > 971 </File> 972 <File 969 973 RelativePath="..\src\pjmedia\transport_udp.c" 970 974 > … … 1218 1222 </File> 1219 1223 <File 1224 RelativePath="..\include\pjmedia\transport_srtp.h" 1225 > 1226 </File> 1227 <File 1220 1228 RelativePath="..\include\pjmedia\transport_udp.h" 1221 1229 > -
pjproject/branches/users/nanang/pjmedia/include/pjmedia.h
r1177 r1698 55 55 #include <pjmedia/transport.h> 56 56 #include <pjmedia/transport_ice.h> 57 #include <pjmedia/transport_srtp.h> 57 58 #include <pjmedia/transport_udp.h> 58 59 #include <pjmedia/wav_playlist.h> -
pjproject/branches/users/nanang/pjmedia/include/pjmedia/transport.h
r1098 r1698 172 172 */ 173 173 typedef struct pjmedia_transport pjmedia_transport; 174 typedef struct pjmedia_sdp_session pjmedia_sdp_session; 174 175 175 176 … … 243 244 const void *pkt, 244 245 pj_size_t size); 246 247 /** 248 * This function is called by application to generate the SDP parts 249 * related to transport type, e.g: ICE, SRTP. 250 * 251 * Application should call #pjmedia_transport_media_create() instead of 252 * calling this function directly. 253 */ 254 pj_status_t (*media_create)(pjmedia_transport *tp, 255 pj_pool_t *pool, 256 pjmedia_sdp_session *sdp_local, 257 const pjmedia_sdp_session *sdp_remote); 258 259 /** 260 * This function is called by application to start the transport 261 * based on SDP negotiation result. 262 * 263 * Application should call #pjmedia_transport_media_start() instead of 264 * calling this function directly. 265 */ 266 pj_status_t (*media_start) (pjmedia_transport *tp, 267 pj_pool_t *pool, 268 pjmedia_sdp_session *sdp_local, 269 const pjmedia_sdp_session *sdp_remote, 270 unsigned media_index); 271 272 /** 273 * This function is called by application to stop the transport. 274 * 275 * Application should call #pjmedia_transport_media_stop() instead of 276 * calling this function directly. 277 */ 278 pj_status_t (*media_stop) (pjmedia_transport *tp); 279 280 /** 281 * This function can be called to simulate packet lost. 282 * 283 * Application should call #pjmedia_transport_simulate_lost() instead of 284 * calling this function directly. 285 */ 286 pj_status_t (*simulate_lost)(pjmedia_transport *tp, 287 pjmedia_dir dir, 288 unsigned pct_lost); 245 289 246 290 /** … … 411 455 412 456 /** 457 * Generate local SDP parts that are related to the specified media transport. 458 * Remote SDP might be needed as reference when application is in deciding 459 * side of negotiation (callee side), otherwise it should be NULL. 460 * This is just a simple wrapper which calls <tt>media_create()</tt> member 461 * of the transport. 462 * 463 * @param tp The media transport. 464 * @param pool The memory pool. 465 * @param sdp_local Local SDP. 466 * @param sdp_remote Remote SDP. 467 * 468 * @return PJ_SUCCESS on success, or the appropriate error code. 469 */ 470 PJ_INLINE(pj_status_t) pjmedia_transport_media_create(pjmedia_transport *tp, 471 pj_pool_t *pool, 472 pjmedia_sdp_session *sdp_local, 473 const pjmedia_sdp_session *sdp_remote) 474 { 475 return (*tp->op->media_create)(tp, pool, sdp_local, sdp_remote); 476 } 477 478 /** 479 * Start the transport with regards to SDP negotiation result. 480 * This is just a simple wrapper which calls <tt>media_start()</tt> member 481 * of the transport. 482 * 483 * @param tp The media transport. 484 * @param pool The memory pool. 485 * @param sdp_local Local SDP. 486 * @param sdp_remote Remote SDP. 487 * @param media_index Media index to start. 488 * 489 * @return PJ_SUCCESS on success, or the appropriate error code. 490 */ 491 PJ_INLINE(pj_status_t) pjmedia_transport_media_start(pjmedia_transport *tp, 492 pj_pool_t *pool, 493 pjmedia_sdp_session *sdp_local, 494 const pjmedia_sdp_session *sdp_remote, 495 unsigned media_index) 496 { 497 return (*tp->op->media_start)(tp, pool, sdp_local, sdp_remote, media_index); 498 } 499 500 501 /** 502 * Stop the transport. 503 * This is just a simple wrapper which calls <tt>media_stop()</tt> member 504 * of the transport. 505 * 506 * @param tp The media transport. 507 * 508 * @return PJ_SUCCESS on success, or the appropriate error code. 509 */ 510 PJ_INLINE(pj_status_t) pjmedia_transport_media_stop(pjmedia_transport *tp) 511 { 512 return (*tp->op->media_stop)(tp); 513 } 514 515 /** 413 516 * Close media transport. This is just a simple wrapper which calls 414 517 * <tt>destroy()</tt> member of the transport. This function will free … … 427 530 } 428 531 532 /** 533 * Simulate packet lost in the specified direction (for testing purposes). 534 * When enabled, the transport will randomly drop packets to the specified 535 * direction. 536 * 537 * @param tp The media transport. 538 * @param dir Media direction to which packets will be randomly dropped. 539 * @param pct_lost Percent lost (0-100). Set to zero to disable packet 540 * lost simulation. 541 * 542 * @return PJ_SUCCESS on success. 543 */ 544 PJ_INLINE(pj_status_t) pjmedia_transport_simulate_lost(pjmedia_transport *tp, 545 pjmedia_dir dir, 546 unsigned pct_lost) 547 { 548 return (*tp->op->simulate_lost)(tp, dir, pct_lost); 549 } 550 429 551 430 552 PJ_END_DECL -
pjproject/branches/users/nanang/pjmedia/include/pjmedia/transport_ice.h
r1436 r1698 17 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 18 */ 19 #ifndef __ pjmedia_ice_H__20 #define __ pjmedia_ice_H__19 #ifndef __PJMEDIA_TRANSPORT_ICE_H__ 20 #define __PJMEDIA_TRANSPORT_ICE_H__ 21 21 22 22 … … 75 75 const pjmedia_ice_cb *cb, 76 76 pjmedia_transport **p_tp); 77 78 /**79 * Destroy the media transport.80 *81 * @param tp The media transport.82 *83 * @return PJ_SUCCESS.84 */85 PJ_DECL(pj_status_t) pjmedia_ice_destroy(pjmedia_transport *tp);86 77 87 78 … … 170 161 const pj_str_t *local_passwd); 171 162 172 /**173 * Modify the SDP to add ICE specific SDP attributes before sending174 * the SDP to remote host.175 *176 * @param tp The media transport.177 * @param pool Pool to allocate memory for the SDP elements.178 * @param sdp The SDP descriptor to be modified.179 *180 * @return PJ_SUCCESS, or the appropriate error code.181 */182 PJ_DECL(pj_status_t) pjmedia_ice_modify_sdp(pjmedia_transport *tp,183 pj_pool_t *pool,184 pjmedia_sdp_session *sdp);185 186 /**187 * Start ICE connectivity checks.188 *189 * This function will pair the local and remote candidates to create190 * check list. Once the check list is created and sorted based on the191 * priority, ICE periodic checks will be started. This function will192 * return immediately, and application will be notified about the193 * connectivity check status in the callback.194 *195 * @param tp The media transport.196 * @param pool Memory pool to parse the SDP.197 * @param rem_sdp The SDP received from remote agent.198 * @param media_index The media index (in SDP) to process.199 *200 * @return PJ_SUCCESS, or the appropriate error code.201 */202 PJ_DECL(pj_status_t) pjmedia_ice_start_ice(pjmedia_transport *tp,203 pj_pool_t *pool,204 const pjmedia_sdp_session *rem_sdp,205 unsigned media_index);206 207 /**208 * Stop the ICE session (typically when the call is terminated). Application209 * may restart the ICE session again by calling #pjmedia_ice_init_ice(),210 * for example to use this media transport for the next call.211 *212 * @param tp The media transport.213 *214 * @return PJ_SUCCESS, or the appropriate error code.215 */216 PJ_DECL(pj_status_t) pjmedia_ice_stop_ice(pjmedia_transport *tp);217 218 219 /**220 * Simulate packet lost in the specified direction (for testing purposes).221 * When enabled, the transport will randomly drop packets to the specified222 * direction.223 *224 * @param tp The ICE media transport.225 * @param dir Media direction to which packets will be randomly dropped.226 * @param pct_lost Percent lost (0-100). Set to zero to disable packet227 * lost simulation.228 *229 * @return PJ_SUCCESS on success.230 */231 PJ_DECL(pj_status_t) pjmedia_ice_simulate_lost(pjmedia_transport *tp,232 pjmedia_dir dir,233 unsigned pct_lost);234 235 236 237 163 238 164 PJ_END_DECL … … 244 170 245 171 246 #endif /* __ pjmedia_ice_H__ */172 #endif /* __PJMEDIA_TRANSPORT_ICE_H__ */ 247 173 248 174 -
pjproject/branches/users/nanang/pjmedia/include/pjmedia/transport_udp.h
r1615 r1698 54 54 PJMEDIA_UDP_NO_SRC_ADDR_CHECKING = 1 55 55 }; 56 57 58 /**59 * UDP transport info.60 */61 typedef struct pjmedia_transport_udp_info62 {63 /**64 * Media socket info.65 */66 pjmedia_sock_info skinfo;67 68 } pjmedia_transport_udp_info;69 56 70 57 … … 138 125 pjmedia_transport **p_tp); 139 126 140 /**141 * Get media socket info from the specified UDP transport.142 *143 * @param tp The UDP transport interface.144 * @param info Media socket info to be initialized.145 *146 * @return PJ_SUCCESS on success.147 */148 PJ_DECL(pj_status_t)149 pjmedia_transport_udp_get_info( pjmedia_transport *tp,150 pjmedia_transport_udp_info *info);151 152 127 153 128 /** … … 170 145 171 146 172 /**173 * Simulate packet lost in the specified direction (for testing purposes).174 * When enabled, the transport will randomly drop packets to the specified175 * direction.176 *177 * @param tp The UDP media transport.178 * @param dir Media direction to which packets will be randomly dropped.179 * @param pct_lost Percent lost (0-100). Set to zero to disable packet180 * lost simulation.181 *182 * @return PJ_SUCCESS on success.183 */184 PJ_DECL(pj_status_t) pjmedia_transport_udp_simulate_lost(pjmedia_transport *tp,185 pjmedia_dir dir,186 unsigned pct_lost);187 188 189 190 /**191 * Close UDP transport. Application can also use the "destroy" member of192 * media transport interface to close the UDP transport.193 *194 * @param tp The UDP media transport.195 *196 * @return PJ_SUCCESS on success.197 */198 PJ_DECL(pj_status_t) pjmedia_transport_udp_close(pjmedia_transport *tp);199 200 201 202 147 PJ_END_DECL 203 148 -
pjproject/branches/users/nanang/pjmedia/src/pjmedia/transport_ice.c
r1656 r1698 52 52 * These are media transport operations. 53 53 */ 54 static pj_status_t tp_get_info(pjmedia_transport *tp, 55 pjmedia_sock_info *info); 56 static pj_status_t tp_attach( pjmedia_transport *tp, 57 void *stream, 58 const pj_sockaddr_t *rem_addr, 59 const pj_sockaddr_t *rem_rtcp, 60 unsigned addr_len, 61 void (*rtp_cb)(void*, 62 const void*, 63 pj_ssize_t), 64 void (*rtcp_cb)(void*, 65 const void*, 66 pj_ssize_t)); 67 static void tp_detach( pjmedia_transport *tp, 68 void *strm); 69 static pj_status_t tp_send_rtp( pjmedia_transport *tp, 70 const void *pkt, 71 pj_size_t size); 72 static pj_status_t tp_send_rtcp( pjmedia_transport *tp, 73 const void *pkt, 74 pj_size_t size); 54 static pj_status_t transport_get_info (pjmedia_transport *tp, 55 pjmedia_sock_info *info); 56 static pj_status_t transport_attach (pjmedia_transport *tp, 57 void *user_data, 58 const pj_sockaddr_t *rem_addr, 59 const pj_sockaddr_t *rem_rtcp, 60 unsigned addr_len, 61 void (*rtp_cb)(void*, 62 const void*, 63 pj_ssize_t), 64 void (*rtcp_cb)(void*, 65 const void*, 66 pj_ssize_t)); 67 static void transport_detach (pjmedia_transport *tp, 68 void *strm); 69 static pj_status_t transport_send_rtp( pjmedia_transport *tp, 70 const void *pkt, 71 pj_size_t size); 72 static pj_status_t transport_send_rtcp(pjmedia_transport *tp, 73 const void *pkt, 74 pj_size_t size); 75 static pj_status_t transport_media_create(pjmedia_transport *tp, 76 pj_pool_t *pool, 77 pjmedia_sdp_session *sdp_local, 78 const pjmedia_sdp_session *sdp_remote); 79 static pj_status_t transport_media_start (pjmedia_transport *tp, 80 pj_pool_t *pool, 81 pjmedia_sdp_session *sdp_local, 82 const pjmedia_sdp_session *sdp_remote, 83 unsigned media_index); 84 static pj_status_t transport_media_stop(pjmedia_transport *tp); 85 static pj_status_t transport_simulate_lost(pjmedia_transport *tp, 86 pjmedia_dir dir, 87 unsigned pct_lost); 88 static pj_status_t transport_destroy (pjmedia_transport *tp); 75 89 76 90 /* … … 85 99 86 100 87 static pjmedia_transport_op tp_ice_op = 88 { 89 &tp_get_info, 90 &tp_attach, 91 &tp_detach, 92 &tp_send_rtp, 93 &tp_send_rtcp, 94 &pjmedia_ice_destroy 101 static pjmedia_transport_op transport_ice_op = 102 { 103 &transport_get_info, 104 &transport_attach, 105 &transport_detach, 106 &transport_send_rtp, 107 &transport_send_rtcp, 108 &transport_media_create, 109 &transport_media_start, 110 &transport_media_stop, 111 &transport_simulate_lost, 112 &transport_destroy 95 113 }; 96 114 … … 133 151 tp_ice->ice_st = ice_st; 134 152 pj_ansi_strcpy(tp_ice->base.name, ice_st->obj_name); 135 tp_ice->base.op = &t p_ice_op;153 tp_ice->base.op = &transport_ice_op; 136 154 tp_ice->base.type = PJMEDIA_TRANSPORT_TYPE_ICE; 137 155 … … 144 162 if (p_tp) 145 163 *p_tp = &tp_ice->base; 146 147 return PJ_SUCCESS;148 }149 150 151 /*152 * Destroy ICE media transport.153 */154 PJ_DEF(pj_status_t) pjmedia_ice_destroy(pjmedia_transport *tp)155 {156 struct transport_ice *tp_ice = (struct transport_ice*)tp;157 158 if (tp_ice->ice_st) {159 pj_ice_strans_destroy(tp_ice->ice_st);160 /*Must not touch tp_ice after ice_st is destroyed!161 (it has the pool)162 tp_ice->ice_st = NULL;163 */164 }165 164 166 165 return PJ_SUCCESS; … … 231 230 comp, PJ_EINVAL); 232 231 233 pj_memcpy(comp, tp_ice->ice_st->comp[comp_id-1], sizeof(pj_ice_strans_comp)); 232 pj_memcpy(comp, tp_ice->ice_st->comp[comp_id-1], 233 sizeof(pj_ice_strans_comp)); 234 234 return PJ_SUCCESS; 235 235 } … … 247 247 { 248 248 struct transport_ice *tp_ice = (struct transport_ice*)tp; 249 return pj_ice_strans_init_ice(tp_ice->ice_st, role, local_ufrag, local_passwd); 249 return pj_ice_strans_init_ice(tp_ice->ice_st, role, local_ufrag, 250 local_passwd); 250 251 } 251 252 … … 255 256 * This will add ICE attributes to the SDP. 256 257 */ 257 PJ_DEF(pj_status_t) pjmedia_ice_modify_sdp(pjmedia_transport *tp, 258 pj_pool_t *pool, 259 pjmedia_sdp_session *sdp) 258 static pj_status_t transport_media_create(pjmedia_transport *tp, 259 pj_pool_t *pool, 260 pjmedia_sdp_session *sdp_local, 261 const pjmedia_sdp_session *sdp_remote) 260 262 { 261 263 struct transport_ice *tp_ice = (struct transport_ice*)tp; … … 265 267 unsigned i, cand_cnt; 266 268 269 PJ_UNUSED_ARG(sdp_remote); 270 267 271 buffer = (char*) pj_pool_alloc(pool, MAXLEN); 268 272 … … 270 274 attr = pjmedia_sdp_attr_create(pool, "ice-ufrag", 271 275 &tp_ice->ice_st->ice->rx_ufrag); 272 sdp ->attr[sdp->attr_count++] = attr;276 sdp_local->attr[sdp_local->attr_count++] = attr; 273 277 274 278 /* Create ice-pwd attribute */ 275 279 attr = pjmedia_sdp_attr_create(pool, "ice-pwd", 276 280 &tp_ice->ice_st->ice->rx_pass); 277 sdp ->attr[sdp->attr_count++] = attr;281 sdp_local->attr[sdp_local->attr_count++] = attr; 278 282 279 283 /* Add all candidates (to media level) */ … … 330 334 value = pj_str(buffer); 331 335 attr = pjmedia_sdp_attr_create(pool, "candidate", &value); 332 sdp ->media[0]->attr[sdp->media[0]->attr_count++] = attr;336 sdp_local->media[0]->attr[sdp_local->media[0]->attr_count++] = attr; 333 337 } 334 338 … … 457 461 PJ_LOG(4,(tp_ice->ice_st->obj_name, 458 462 "Disabling local ICE, reason=%s", reason)); 459 pjmedia_ice_stop_ice(&tp_ice->base);463 transport_media_stop(&tp_ice->base); 460 464 } 461 465 … … 464 468 * Start ICE checks when both offer and answer are available. 465 469 */ 466 PJ_DEF(pj_status_t) pjmedia_ice_start_ice(pjmedia_transport *tp, 467 pj_pool_t *pool, 468 const pjmedia_sdp_session *rem_sdp, 469 unsigned media_index) 470 static pj_status_t transport_media_start(pjmedia_transport *tp, 471 pj_pool_t *pool, 472 pjmedia_sdp_session *sdp_local, 473 const pjmedia_sdp_session *sdp_remote, 474 unsigned media_index) 470 475 { 471 476 struct transport_ice *tp_ice = (struct transport_ice*)tp; … … 482 487 pj_status_t status; 483 488 484 PJ_ASSERT_RETURN(tp && pool && rem_sdp, PJ_EINVAL); 485 PJ_ASSERT_RETURN(media_index < rem_sdp->media_count, PJ_EINVAL); 486 487 sdp_med = rem_sdp->media[media_index]; 489 PJ_UNUSED_ARG(sdp_local); 490 491 PJ_ASSERT_RETURN(tp && pool && sdp_remote, PJ_EINVAL); 492 PJ_ASSERT_RETURN(media_index < sdp_remote->media_count, PJ_EINVAL); 493 494 sdp_med = sdp_remote->media[media_index]; 488 495 489 496 /* Get the SDP connection for the media stream. … … 493 500 conn = sdp_med->conn; 494 501 if (conn == NULL) 495 conn = rem_sdp->conn;502 conn = sdp_remote->conn; 496 503 497 504 if (conn == NULL) { … … 508 515 if (attr == NULL) { 509 516 /* Find ice-ufrag attribute in session descriptor */ 510 attr = pjmedia_sdp_attr_find2( rem_sdp->attr_count, rem_sdp->attr,517 attr = pjmedia_sdp_attr_find2(sdp_remote->attr_count, sdp_remote->attr, 511 518 "ice-ufrag", NULL); 512 519 if (attr == NULL) { … … 522 529 if (attr == NULL) { 523 530 /* Find ice-pwd attribute in session descriptor */ 524 attr = pjmedia_sdp_attr_find2( rem_sdp->attr_count, rem_sdp->attr,531 attr = pjmedia_sdp_attr_find2(sdp_remote->attr_count, sdp_remote->attr, 525 532 "ice-pwd", NULL); 526 533 if (attr == NULL) { … … 609 616 610 617 611 PJ_DEF(pj_status_t) pjmedia_ice_stop_ice(pjmedia_transport *tp)618 static pj_status_t transport_media_stop(pjmedia_transport *tp) 612 619 { 613 620 struct transport_ice *tp_ice = (struct transport_ice*)tp; … … 616 623 617 624 618 static pj_status_t t p_get_info(pjmedia_transport *tp,619 625 static pj_status_t transport_get_info(pjmedia_transport *tp, 626 pjmedia_sock_info *info) 620 627 { 621 628 struct transport_ice *tp_ice = (struct transport_ice*)tp; … … 649 656 650 657 651 static pj_status_t t p_attach(pjmedia_transport *tp,652 void *stream,653 const pj_sockaddr_t *rem_addr,654 const pj_sockaddr_t *rem_rtcp,655 unsigned addr_len,656 void (*rtp_cb)(void*,657 const void*,658 pj_ssize_t),659 void (*rtcp_cb)(void*,660 const void*,661 pj_ssize_t))658 static pj_status_t transport_attach (pjmedia_transport *tp, 659 void *stream, 660 const pj_sockaddr_t *rem_addr, 661 const pj_sockaddr_t *rem_rtcp, 662 unsigned addr_len, 663 void (*rtp_cb)(void*, 664 const void*, 665 pj_ssize_t), 666 void (*rtcp_cb)(void*, 667 const void*, 668 pj_ssize_t)) 662 669 { 663 670 struct transport_ice *tp_ice = (struct transport_ice*)tp; … … 674 681 675 682 676 static void t p_detach(pjmedia_transport *tp,677 683 static void transport_detach(pjmedia_transport *tp, 684 void *strm) 678 685 { 679 686 struct transport_ice *tp_ice = (struct transport_ice*)tp; … … 687 694 688 695 689 static pj_status_t t p_send_rtp(pjmedia_transport *tp,690 691 696 static pj_status_t transport_send_rtp(pjmedia_transport *tp, 697 const void *pkt, 698 pj_size_t size) 692 699 { 693 700 struct transport_ice *tp_ice = (struct transport_ice*)tp; … … 709 716 710 717 711 static pj_status_t t p_send_rtcp(pjmedia_transport *tp,712 713 718 static pj_status_t transport_send_rtcp(pjmedia_transport *tp, 719 const void *pkt, 720 pj_size_t size) 714 721 { 715 722 struct transport_ice *tp_ice = (struct transport_ice*)tp; … … 799 806 800 807 /* Simulate lost */ 801 PJ_DEF(pj_status_t) pjmedia_ice_simulate_lost(pjmedia_transport *tp,802 803 808 static pj_status_t transport_simulate_lost(pjmedia_transport *tp, 809 pjmedia_dir dir, 810 unsigned pct_lost) 804 811 { 805 812 struct transport_ice *ice = (struct transport_ice*) tp; … … 816 823 } 817 824 825 826 /* 827 * Destroy ICE media transport. 828 */ 829 static pj_status_t transport_destroy(pjmedia_transport *tp) 830 { 831 struct transport_ice *tp_ice = (struct transport_ice*)tp; 832 833 if (tp_ice->ice_st) { 834 pj_ice_strans_destroy(tp_ice->ice_st); 835 /*Must not touch tp_ice after ice_st is destroyed! 836 (it has the pool) 837 tp_ice->ice_st = NULL; 838 */ 839 } 840 841 return PJ_SUCCESS; 842 } 843 -
pjproject/branches/users/nanang/pjmedia/src/pjmedia/transport_udp.c
r1630 r1698 95 95 pj_ssize_t bytes_read); 96 96 97 static pj_status_t transport_get_info(pjmedia_transport *tp, 98 pjmedia_sock_info *info); 99 static pj_status_t transport_attach( pjmedia_transport *tp, 97 /* 98 * These are media transport operations. 99 */ 100 static pj_status_t transport_get_info (pjmedia_transport *tp, 101 pjmedia_sock_info *info); 102 static pj_status_t transport_attach (pjmedia_transport *tp, 100 103 void *user_data, 101 104 const pj_sockaddr_t *rem_addr, … … 108 111 const void*, 109 112 pj_ssize_t)); 110 static void transport_detach (pjmedia_transport *tp,113 static void transport_detach (pjmedia_transport *tp, 111 114 void *strm); 112 115 static pj_status_t transport_send_rtp( pjmedia_transport *tp, … … 116 119 const void *pkt, 117 120 pj_size_t size); 121 static pj_status_t transport_media_create(pjmedia_transport *tp, 122 pj_pool_t *pool, 123 pjmedia_sdp_session *sdp_local, 124 const pjmedia_sdp_session *sdp_remote); 125 static pj_status_t transport_media_start (pjmedia_transport *tp, 126 pj_pool_t *pool, 127 pjmedia_sdp_session *sdp_local, 128 const pjmedia_sdp_session *sdp_remote, 129 unsigned media_index); 130 static pj_status_t transport_media_stop(pjmedia_transport *tp); 131 static pj_status_t transport_simulate_lost(pjmedia_transport *tp, 132 pjmedia_dir dir, 133 unsigned pct_lost); 134 static pj_status_t transport_destroy (pjmedia_transport *tp); 118 135 119 136 … … 125 142 &transport_send_rtp, 126 143 &transport_send_rtcp, 127 &pjmedia_transport_udp_close 144 &transport_media_create, 145 &transport_media_start, 146 &transport_media_stop, 147 &transport_simulate_lost, 148 &transport_destroy 128 149 }; 129 150 … … 342 363 343 364 on_error: 344 pjmedia_transport_udp_close(&tp->base);365 transport_destroy(&tp->base); 345 366 return status; 346 }347 348 349 /*350 * Get media socket info.351 */352 PJ_DEF(pj_status_t) pjmedia_transport_udp_get_info( pjmedia_transport *tp,353 pjmedia_transport_udp_info *inf)354 {355 return transport_get_info(tp, &inf->skinfo);356 367 } 357 368 … … 360 371 * Close UDP transport. 361 372 */ 362 PJ_DEF(pj_status_t) pjmedia_transport_udp_close(pjmedia_transport *tp)373 static pj_status_t transport_destroy(pjmedia_transport *tp) 363 374 { 364 375 struct transport_udp *udp = (struct transport_udp*) tp; … … 727 738 728 739 729 PJ_DEF(pj_status_t) pjmedia_transport_udp_simulate_lost(pjmedia_transport *tp, 730 pjmedia_dir dir, 731 unsigned pct_lost) 740 static pj_status_t transport_media_create(pjmedia_transport *tp, 741 pj_pool_t *pool, 742 pjmedia_sdp_session *sdp_local, 743 const pjmedia_sdp_session *sdp_remote) 744 { 745 PJ_UNUSED_ARG(tp); 746 PJ_UNUSED_ARG(pool); 747 PJ_UNUSED_ARG(sdp_local); 748 PJ_UNUSED_ARG(sdp_remote); 749 750 return PJ_SUCCESS; 751 } 752 753 static pj_status_t transport_media_start(pjmedia_transport *tp, 754 pj_pool_t *pool, 755 pjmedia_sdp_session *sdp_local, 756 const pjmedia_sdp_session *sdp_remote, 757 unsigned media_index) 758 { 759 PJ_UNUSED_ARG(tp); 760 PJ_UNUSED_ARG(pool); 761 PJ_UNUSED_ARG(sdp_local); 762 PJ_UNUSED_ARG(sdp_remote); 763 PJ_UNUSED_ARG(media_index); 764 765 return PJ_SUCCESS; 766 } 767 768 static pj_status_t transport_media_stop(pjmedia_transport *tp) 769 { 770 PJ_UNUSED_ARG(tp); 771 772 return PJ_SUCCESS; 773 } 774 775 static pj_status_t transport_simulate_lost(pjmedia_transport *tp, 776 pjmedia_dir dir, 777 unsigned pct_lost) 732 778 { 733 779 struct transport_udp *udp = (struct transport_udp*)tp; -
pjproject/branches/users/nanang/pjproject-vs8.sln
r1488 r1698 1 1 2 2 Microsoft Visual Studio Solution File, Format Version 9.00 3 # Visual C++ Express20053 # Visual Studio 2005 4 4 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pjlib", "pjlib\build\pjlib.vcproj", "{DA0E03ED-53A7-4050-8A85-90541C5509F8}" 5 5 EndProject … … 13 13 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pjlib_util_test", "pjlib-util\build\pjlib_util_test.vcproj", "{ED02BE13-8297-4770-8097-27DC2CCABF9A}" 14 14 ProjectSection(ProjectDependencies) = postProject 15 { DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8}16 { FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693}15 {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} 16 {DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8} 17 17 EndProjectSection 18 18 EndProject … … 29 29 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pjsua", "pjsip-apps\build\pjsua.vcproj", "{8310649E-A25E-4AF0-91E8-9E3CC659BB89}" 30 30 ProjectSection(ProjectDependencies) = postProject 31 {F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858} = {F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858} 31 32 {2BB84911-C1B4-4747-B93D-36AA82CC5031} = {2BB84911-C1B4-4747-B93D-36AA82CC5031} 32 33 {4BF51C21-5A30-423B-82FE-1ED410E5769D} = {4BF51C21-5A30-423B-82FE-1ED410E5769D} 34 {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4} = {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4} 35 {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} 36 {6794B975-4E84-4F49-B2DC-C31F2224E03E} = {6794B975-4E84-4F49-B2DC-C31F2224E03E} 37 {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} = {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} 38 {3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA} = {3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA} 39 {4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9} = {4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9} 40 {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} = {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} 41 {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} = {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} 42 {B8719FD5-E8A6-4A36-943C-891D07F5DD21} = {B8719FD5-E8A6-4A36-943C-891D07F5DD21} 43 {DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8} 44 {B5FE16F8-3EDB-4110-BD80-B4238CC01E8D} = {B5FE16F8-3EDB-4110-BD80-B4238CC01E8D} 45 {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} = {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} 33 46 {E53AA5FF-B737-40AA-BD13-387EFA99023D} = {E53AA5FF-B737-40AA-BD13-387EFA99023D} 34 {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} = {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} 47 EndProjectSection 48 EndProject 49 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pjsua_lib", "pjsip\build\pjsua_lib.vcproj", "{9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37}" 50 EndProject 51 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample_debug", "pjsip-apps\build\sample_debug.vcproj", "{A0F1AA62-0F6F-420D-B09A-AC04B6862821}" 52 ProjectSection(ProjectDependencies) = postProject 53 {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4} = {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4} 54 {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} 55 {6794B975-4E84-4F49-B2DC-C31F2224E03E} = {6794B975-4E84-4F49-B2DC-C31F2224E03E} 56 {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} = {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} 57 {3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA} = {3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA} 58 {4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9} = {4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9} 59 {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} = {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} 60 {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} = {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} 61 {B8719FD5-E8A6-4A36-943C-891D07F5DD21} = {B8719FD5-E8A6-4A36-943C-891D07F5DD21} 62 {DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8} 35 63 {B5FE16F8-3EDB-4110-BD80-B4238CC01E8D} = {B5FE16F8-3EDB-4110-BD80-B4238CC01E8D} 36 {DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8} 37 {B8719FD5-E8A6-4A36-943C-891D07F5DD21} = {B8719FD5-E8A6-4A36-943C-891D07F5DD21} 38 {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} = {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} 39 {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} = {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} 40 {4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9} = {4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9} 41 {3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA} = {3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA} 42 {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} = {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} 43 {6794B975-4E84-4F49-B2DC-C31F2224E03E} = {6794B975-4E84-4F49-B2DC-C31F2224E03E} 44 {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} 45 {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4} = {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4} 46 EndProjectSection 47 EndProject 48 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pjsua_lib", "pjsip\build\pjsua_lib.vcproj", "{9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37}" 49 EndProject 50 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample_debug", "pjsip-apps\build\sample_debug.vcproj", "{A0F1AA62-0F6F-420D-B09A-AC04B6862821}" 51 ProjectSection(ProjectDependencies) = postProject 64 {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} = {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} 52 65 {E53AA5FF-B737-40AA-BD13-387EFA99023D} = {E53AA5FF-B737-40AA-BD13-387EFA99023D} 53 {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} = {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} 54 {B5FE16F8-3EDB-4110-BD80-B4238CC01E8D} = {B5FE16F8-3EDB-4110-BD80-B4238CC01E8D} 55 {DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8} 56 {B8719FD5-E8A6-4A36-943C-891D07F5DD21} = {B8719FD5-E8A6-4A36-943C-891D07F5DD21} 57 {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} = {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} 58 {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} = {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} 59 {4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9} = {4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9} 60 {3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA} = {3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA} 61 {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} = {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} 62 {6794B975-4E84-4F49-B2DC-C31F2224E03E} = {6794B975-4E84-4F49-B2DC-C31F2224E03E} 63 {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} 64 {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4} = {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4} 65 {2BB84911-C1B4-4747-B93D-36AA82CC5031} = {2BB84911-C1B4-4747-B93D-36AA82CC5031} 66 {2BB84911-C1B4-4747-B93D-36AA82CC5031} = {2BB84911-C1B4-4747-B93D-36AA82CC5031} 67 {F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858} = {F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858} 66 68 EndProjectSection 67 69 EndProject 68 70 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "samples", "pjsip-apps\build\samples.vcproj", "{E378A1FC-0C9C-4462-860F-7E60BC1BF84E}" 69 71 ProjectSection(ProjectDependencies) = postProject 70 { 9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} = {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37}71 { DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8}72 { B8719FD5-E8A6-4A36-943C-891D07F5DD21} = {B8719FD5-E8A6-4A36-943C-891D07F5DD21}73 { 4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} = {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0}74 { 855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} = {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B}75 { 7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} = {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65}76 { FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693}77 { 2BB84911-C1B4-4747-B93D-36AA82CC5031} = {2BB84911-C1B4-4747-B93D-36AA82CC5031}72 {2BB84911-C1B4-4747-B93D-36AA82CC5031} = {2BB84911-C1B4-4747-B93D-36AA82CC5031} 73 {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} 74 {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} = {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} 75 {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} = {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} 76 {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} = {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} 77 {B8719FD5-E8A6-4A36-943C-891D07F5DD21} = {B8719FD5-E8A6-4A36-943C-891D07F5DD21} 78 {DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8} 79 {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} = {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} 78 80 EndProjectSection 79 81 EndProject 80 82 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_pjsip", "pjsip\build\test_pjsip.vcproj", "{B3F7D4E9-702F-4EB4-ADA8-098D0A83D770}" 81 83 ProjectSection(ProjectDependencies) = postProject 82 { 9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} = {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37}83 { DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8}84 { B8719FD5-E8A6-4A36-943C-891D07F5DD21} = {B8719FD5-E8A6-4A36-943C-891D07F5DD21}85 { 4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} = {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0}86 { 855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} = {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B}87 { 7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} = {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65}88 { FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693}89 { 2BB84911-C1B4-4747-B93D-36AA82CC5031} = {2BB84911-C1B4-4747-B93D-36AA82CC5031}84 {2BB84911-C1B4-4747-B93D-36AA82CC5031} = {2BB84911-C1B4-4747-B93D-36AA82CC5031} 85 {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693} 86 {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} = {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} 87 {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} = {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} 88 {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} = {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} 89 {B8719FD5-E8A6-4A36-943C-891D07F5DD21} = {B8719FD5-E8A6-4A36-943C-891D07F5DD21} 90 {DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8} 91 {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} = {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} 90 92 EndProjectSection 91 93 EndProject … … 105 107 EndProject 106 108 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmilenage", "third_party\build\milenage\libmilenage.vcproj", "{4BF51C21-5A30-423B-82FE-1ED410E5769D}" 109 EndProject 110 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libsrtp", "third_party\build\srtp\libsrtp.vcproj", "{F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858}" 107 111 EndProject 108 112 Global … … 200 204 {4BF51C21-5A30-423B-82FE-1ED410E5769D}.Release|Win32.ActiveCfg = Release|Win32 201 205 {4BF51C21-5A30-423B-82FE-1ED410E5769D}.Release|Win32.Build.0 = Release|Win32 206 {F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858}.Debug|Win32.ActiveCfg = Debug|Win32 207 {F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858}.Debug|Win32.Build.0 = Debug|Win32 208 {F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858}.Release|Win32.ActiveCfg = Release|Win32 209 {F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858}.Release|Win32.Build.0 = Release|Win32 202 210 EndGlobalSection 203 211 GlobalSection(SolutionProperties) = preSolution -
pjproject/branches/users/nanang/pjsip-apps/build/Samples-vc.mak
r1681 r1698 24 24 RESAMPLE_LIB = ..\..\third_party\lib\libresample-$(TARGET)$(LIBEXT) 25 25 SPEEX_LIB = ..\..\third_party\lib\libspeex-$(TARGET)$(LIBEXT) 26 SRTP_LIB = ..\..\third_party\lib\libsrtp-$(TARGET)$(LIBEXT) 26 27 27 28 THIRD_PARTY_LIBS = $(GSM_LIB) $(ILBC_LIB) $(PORTAUDIO_LIB) $(RESAMPLE_LIB) \ 28 $(SPEEX_LIB) 29 $(SPEEX_LIB) $(SRTP_LIB) 29 30 30 31 LIBS = $(PJSUA_LIB_LIB) $(PJSIP_UA_LIB) $(PJSIP_SIMPLE_LIB) \ -
pjproject/branches/users/nanang/pjsip-apps/src/pjsua/pjsua_app.c
r1626 r1698 166 166 puts ("Media Options:"); 167 167 puts (" --use-ice Enable ICE (default:no)"); 168 puts (" --use-srtp Enable SRTP (default:no)"); 168 169 puts (" --add-codec=name Manually add codec (default is to enable all)"); 169 170 puts (" --dis-codec=name Disable codec (can be specified multiple times)"); … … 383 384 OPT_ADD_BUDDY, OPT_OFFER_X_MS_MSG, OPT_NO_PRESENCE, 384 385 OPT_AUTO_ANSWER, OPT_AUTO_HANGUP, OPT_AUTO_PLAY, OPT_AUTO_LOOP, 385 OPT_AUTO_CONF, OPT_CLOCK_RATE, OPT_USE_ICE, 386 OPT_AUTO_CONF, OPT_CLOCK_RATE, OPT_USE_ICE, OPT_USE_SRTP, 386 387 OPT_PLAY_FILE, OPT_PLAY_TONE, OPT_RTP_PORT, OPT_ADD_CODEC, 387 388 OPT_ILBC_MODE, OPT_REC_FILE, OPT_AUTO_REC, … … 442 443 { "rtp-port", 1, 0, OPT_RTP_PORT}, 443 444 { "use-ice", 0, 0, OPT_USE_ICE}, 445 { "use-srtp", 0, 0, OPT_USE_SRTP}, 444 446 { "add-codec", 1, 0, OPT_ADD_CODEC}, 445 447 { "dis-codec", 1, 0, OPT_DIS_CODEC}, … … 797 799 break; 798 800 801 case OPT_USE_SRTP: 802 cfg->media_cfg.enable_srtp = PJ_TRUE; 803 break; 804 799 805 case OPT_RTP_PORT: 800 806 cfg->rtp_cfg.port = my_atoi(pj_optarg); -
pjproject/branches/users/nanang/pjsip-apps/src/samples/simpleua.c
r1530 r1698 286 286 * the SDP). 287 287 */ 288 { 289 pjmedia_transport_udp_info udp_info; 290 291 pjmedia_transport_udp_get_info(g_med_transport, &udp_info); 292 pj_memcpy(&g_med_skinfo, &udp_info.skinfo, 293 sizeof(pjmedia_sock_info)); 294 } 288 pjmedia_transport_get_info(g_med_transport, &g_med_skinfo); 295 289 296 290 -
pjproject/branches/users/nanang/pjsip-apps/src/samples/siprtp.c
r1670 r1698 1006 1006 pjmedia_sdp_media *m; 1007 1007 pjmedia_sdp_attr *attr; 1008 pjmedia_ transport_udp_info tpinfo;1008 pjmedia_sock_info tpinfo; 1009 1009 struct media_stream *audio = &call->media[0]; 1010 1010 … … 1013 1013 1014 1014 /* Get transport info */ 1015 pjmedia_transport_ udp_get_info(audio->transport, &tpinfo);1015 pjmedia_transport_get_info(audio->transport, &tpinfo); 1016 1016 1017 1017 /* Create and initialize basic SDP session */ … … 1047 1047 /* Standard media info: */ 1048 1048 m->desc.media = pj_str("audio"); 1049 m->desc.port = pj_ntohs(tpinfo. skinfo.rtp_addr_name.ipv4.sin_port);1049 m->desc.port = pj_ntohs(tpinfo.rtp_addr_name.ipv4.sin_port); 1050 1050 m->desc.port_count = 1; 1051 1051 m->desc.transport = pj_str("RTP/AVP"); -
pjproject/branches/users/nanang/pjsip-apps/src/samples/streamutil.c
r1666 r1698 56 56 " --send-only Set stream direction to send only \n" 57 57 " --recv-only Set stream direction to recv only (default) \n" 58 " --use-srtp[=NAME] Enable SRTP with crypto suite NAME \n" 59 " e.g: AES_CM_128_HMAC_SHA1_80 (default), \n" 60 " AES_CM_128_HMAC_SHA1_32 \n" 61 " Use this option along with the TX & RX keys, \n" 62 " formated of 60 hex digits (e.g: E148DA..) \n" 63 " --srtp-tx-key SRTP key for transmiting \n" 64 " --srtp-rx-key SRTP key for receiving \n" 58 65 "\n" 59 66 ; … … 65 72 #include <pjmedia.h> 66 73 #include <pjmedia-codec.h> 74 #include <pjmedia/transport_srtp.h> 67 75 68 76 #include <stdlib.h> /* atoi() */ … … 79 87 static void print_stream_stat(pjmedia_stream *stream); 80 88 89 /* Prototype for LIBSRTP utility in file datatypes.c */ 90 int hex_string_to_octet_string(char *raw, char *hex, int len); 81 91 82 92 /* … … 123 133 pj_uint16_t local_port, 124 134 const pj_sockaddr_in *rem_addr, 135 pj_bool_t use_srtp, 136 const pj_str_t *crypto_suite, 137 const pj_str_t *srtp_tx_key, 138 const pj_str_t *srtp_rx_key, 125 139 pjmedia_stream **p_stream ) 126 140 { 127 141 pjmedia_stream_info info; 128 pjmedia_transport *transport; 142 pjmedia_transport *transport = NULL; 143 pjmedia_transport *srtp_tp = NULL; 129 144 pj_status_t status; 130 145 … … 159 174 return status; 160 175 176 /* Check if SRTP enabled */ 177 if (use_srtp) { 178 pjmedia_srtp_stream_policy tx_plc, rx_plc; 179 180 status = pjmedia_transport_srtp_create(med_endpt, transport, 181 PJMEDIA_SRTP_AUTO_CLOSE_UNDERLYING_TRANSPORT, 182 &srtp_tp); 183 if (status != PJ_SUCCESS) 184 return status; 185 186 pj_bzero(&tx_plc, sizeof(pjmedia_srtp_stream_policy)); 187 pj_bzero(&rx_plc, sizeof(pjmedia_srtp_stream_policy)); 188 189 tx_plc.key = *srtp_tx_key; 190 tx_plc.crypto_suite = *crypto_suite; 191 rx_plc.key = *srtp_rx_key; 192 rx_plc.crypto_suite = *crypto_suite; 193 194 status = pjmedia_transport_srtp_init_session(srtp_tp, &tx_plc, &rx_plc); 195 if (status != PJ_SUCCESS) 196 return status; 197 } 161 198 162 199 /* Now that the stream info is initialized, we can create the … … 165 202 166 203 status = pjmedia_stream_create( med_endpt, pool, &info, 167 transport, NULL, p_stream); 204 (use_srtp?srtp_tp:transport), 205 NULL, p_stream); 168 206 169 207 if (status != PJ_SUCCESS) { 170 208 app_perror(THIS_FILE, "Error creating stream", status); 171 pjmedia_transport_ udp_close(transport);209 pjmedia_transport_close(transport); 172 210 return status; 173 211 } … … 202 240 pj_status_t status; 203 241 242 /* SRTP variables */ 243 pj_bool_t use_srtp = PJ_FALSE; 244 char tmp_tx_key[64]; 245 char tmp_rx_key[64]; 246 pj_str_t srtp_tx_key = {NULL, 0}; 247 pj_str_t srtp_rx_key = {NULL, 0}; 248 pj_str_t srtp_crypto_suite = {NULL, 0}; 249 int tmp_key_len; 204 250 205 251 /* Default values */ … … 221 267 OPT_SEND_ONLY = 's', 222 268 OPT_RECV_ONLY = 'i', 269 OPT_USE_SRTP = 'S', 270 OPT_SRTP_TX_KEY = 'x', 271 OPT_SRTP_RX_KEY = 'y', 223 272 OPT_HELP = 'h', 224 273 }; … … 233 282 { "send-only", 0, 0, OPT_SEND_ONLY }, 234 283 { "recv-only", 0, 0, OPT_RECV_ONLY }, 284 { "use-srtp", 2, 0, OPT_USE_SRTP }, 285 { "srtp-tx-key", 1, 0, OPT_SRTP_TX_KEY }, 286 { "srtp-rx-key", 1, 0, OPT_SRTP_RX_KEY }, 235 287 { "help", 0, 0, OPT_HELP }, 236 288 { NULL, 0, 0, 0 }, … … 299 351 break; 300 352 353 case OPT_USE_SRTP: 354 use_srtp = PJ_TRUE; 355 if (pj_optarg) { 356 pj_strset(&srtp_crypto_suite, pj_optarg, strlen(pj_optarg)); 357 } else { 358 srtp_crypto_suite = pj_str("AES_CM_128_HMAC_SHA1_80"); 359 } 360 break; 361 362 case OPT_SRTP_TX_KEY: 363 tmp_key_len = hex_string_to_octet_string(tmp_tx_key, pj_optarg, strlen(pj_optarg)); 364 pj_strset(&srtp_tx_key, tmp_tx_key, tmp_key_len/2); 365 break; 366 367 case OPT_SRTP_RX_KEY: 368 tmp_key_len = hex_string_to_octet_string(tmp_rx_key, pj_optarg, strlen(pj_optarg)); 369 pj_strset(&srtp_rx_key, tmp_rx_key, tmp_key_len/2); 370 break; 371 301 372 case OPT_HELP: 302 373 usage(); … … 324 395 } 325 396 397 if (use_srtp) { 398 if (((dir & PJMEDIA_DIR_ENCODING) && !srtp_tx_key.slen) || 399 ((dir & PJMEDIA_DIR_DECODING) && !srtp_rx_key.slen)) 400 { 401 printf("Error: Key for each SRTP stream direction must be set\n"); 402 return 1; 403 } 404 } 326 405 327 406 /* Must create a pool factory before we can allocate any memory. */ … … 369 448 /* Create stream based on program arguments */ 370 449 status = create_stream(pool, med_endpt, codec_info, dir, local_port, 371 &remote_addr, &stream); 450 &remote_addr, 451 use_srtp, &srtp_crypto_suite, 452 &srtp_tx_key, &srtp_rx_key, 453 &stream); 372 454 if (status != PJ_SUCCESS) 373 455 goto on_exit; … … 538 620 tp = pjmedia_stream_get_transport(stream); 539 621 pjmedia_stream_destroy(stream); 540 pjmedia_transport_udp_close(tp); 622 623 pjmedia_transport_close(tp); 541 624 } 542 625 -
pjproject/branches/users/nanang/pjsip/include/pjsip-ua/sip_inv.h
r1598 r1698 395 395 * (this is useful e.g. when application wants to send 396 396 * the response statelessly). 397 * 398 * @see pjsip_inv_verify_request2() 397 399 */ 398 400 PJ_DECL(pj_status_t) pjsip_inv_verify_request( pjsip_rx_data *rdata, … … 403 405 pjsip_tx_data **tdata); 404 406 407 /** 408 * Variant of #pjsip_inv_verify_request() which allows application to specify 409 * the parsed SDP in the \a offer argument. This is useful to avoid having to 410 * re-parse the SDP in the incoming request. 411 * 412 * @see pjsip_inv_verify_request() 413 */ 414 PJ_DECL(pj_status_t) pjsip_inv_verify_request2( pjsip_rx_data *rdata, 415 unsigned *options, 416 const pjmedia_sdp_session *offer, 417 const pjmedia_sdp_session *answer, 418 pjsip_dialog *dlg, 419 pjsip_endpoint *endpt, 420 pjsip_tx_data **tdata); 405 421 406 422 /** -
pjproject/branches/users/nanang/pjsip/include/pjsua-lib/pjsua.h
r1675 r1698 3769 3769 */ 3770 3770 pj_bool_t enable_relay; 3771 3772 /** 3773 * Enable SRTP 3774 */ 3775 pj_bool_t enable_srtp; 3771 3776 }; 3772 3777 -
pjproject/branches/users/nanang/pjsip/include/pjsua-lib/pjsua_internal.h
r1591 r1698 316 316 pj_status_t pjsua_media_channel_create_sdp(pjsua_call_id call_id, 317 317 pj_pool_t *pool, 318 const pjmedia_sdp_session *rem_sdp, 318 319 pjmedia_sdp_session **p_sdp); 319 320 pj_status_t pjsua_media_channel_update(pjsua_call_id call_id, 320 constpjmedia_sdp_session *local_sdp,321 pjmedia_sdp_session *local_sdp, 321 322 const pjmedia_sdp_session *remote_sdp); 322 323 pj_status_t pjsua_media_channel_deinit(pjsua_call_id call_id); -
pjproject/branches/users/nanang/pjsip/src/pjsip-ua/sip_inv.c
r1598 r1698 677 677 * Verify incoming INVITE request. 678 678 */ 679 PJ_DEF(pj_status_t) pjsip_inv_verify_request(pjsip_rx_data *rdata, 680 unsigned *options, 681 const pjmedia_sdp_session *l_sdp, 682 pjsip_dialog *dlg, 683 pjsip_endpoint *endpt, 684 pjsip_tx_data **p_tdata) 679 PJ_DEF(pj_status_t) pjsip_inv_verify_request2(pjsip_rx_data *rdata, 680 unsigned *options, 681 const pjmedia_sdp_session *r_sdp, 682 const pjmedia_sdp_session *l_sdp, 683 pjsip_dialog *dlg, 684 pjsip_endpoint *endpt, 685 pjsip_tx_data **p_tdata) 685 686 { 686 687 pjsip_msg *msg; … … 723 724 pj_list_init(&res_hdr_list); 724 725 725 /* Check the request body, see if it' inv something that we support726 * (i.e. SDP).726 /* Check the request body, see if it's something that we support, 727 * only when the body hasn't been parsed before. 727 728 */ 728 if ( msg->body) {729 if (r_sdp==NULL && msg->body) { 729 730 pjsip_msg_body *body = msg->body; 730 731 pj_str_t str_application = {"application", 11}; … … 778 779 } 779 780 781 r_sdp = sdp; 782 } 783 784 if (r_sdp) { 780 785 /* Negotiate with local SDP */ 781 786 if (l_sdp) { … … 788 793 /* Create SDP negotiator */ 789 794 status = pjmedia_sdp_neg_create_w_remote_offer( 790 rdata->tp_info.pool, l_sdp, sdp, &neg);795 rdata->tp_info.pool, l_sdp, r_sdp, &neg); 791 796 PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); 792 797 … … 1026 1031 1027 1032 return status; 1033 } 1034 1035 1036 /* 1037 * Verify incoming INVITE request. 1038 */ 1039 PJ_DEF(pj_status_t) pjsip_inv_verify_request( pjsip_rx_data *rdata, 1040 unsigned *options, 1041 const pjmedia_sdp_session *l_sdp, 1042 pjsip_dialog *dlg, 1043 pjsip_endpoint *endpt, 1044 pjsip_tx_data **p_tdata) 1045 { 1046 return pjsip_inv_verify_request2(rdata, options, NULL, l_sdp, dlg, 1047 endpt, p_tdata); 1028 1048 } 1029 1049 -
pjproject/branches/users/nanang/pjsip/src/pjsua-lib/pjsua_call.c
r1693 r1698 335 335 offer = NULL; 336 336 #else 337 status = pjsua_media_channel_create_sdp(call->index, dlg->pool, &offer);337 status = pjsua_media_channel_create_sdp(call->index, dlg->pool, NULL, &offer); 338 338 if (status != PJ_SUCCESS) { 339 339 pjsua_perror(THIS_FILE, "pjmedia unable to create SDP", status); … … 482 482 pjsua_call *call; 483 483 int call_id = -1; 484 pjmedia_sdp_session * answer;484 pjmedia_sdp_session *offer, *answer; 485 485 pj_status_t status; 486 486 … … 590 590 } 591 591 592 /* Parse SDP from incoming request */ 593 if (rdata->msg_info.msg->body) { 594 status = pjmedia_sdp_parse(rdata->tp_info.pool, 595 rdata->msg_info.msg->body->data, 596 rdata->msg_info.msg->body->len, &offer); 597 if (status != PJ_SUCCESS) { 598 pjsua_perror(THIS_FILE, "Error parsing SDP in incoming INVITE", status); 599 pjsip_endpt_respond_stateless(pjsua_var.endpt, rdata, 400, NULL, 600 NULL, NULL); 601 pjsua_media_channel_deinit(call->index); 602 PJSUA_UNLOCK(); 603 return PJ_TRUE; 604 } 605 } else { 606 offer = NULL; 607 } 592 608 593 609 /* Get media capability from media endpoint: */ 594 status = pjsua_media_channel_create_sdp(call->index, rdata->tp_info.pool, &answer); 610 status = pjsua_media_channel_create_sdp(call->index, rdata->tp_info.pool, 611 offer, &answer); 595 612 if (status != PJ_SUCCESS) { 596 613 pjsip_endpt_respond_stateless(pjsua_var.endpt, rdata, 500, NULL, … … 613 630 options |= PJSIP_INV_REQUIRE_100REL; 614 631 615 status = pjsip_inv_verify_request (rdata, &options, answer, NULL,616 pjsua_var.endpt, &response);632 status = pjsip_inv_verify_request2(rdata, &options, offer, answer, NULL, 633 pjsua_var.endpt, &response); 617 634 if (status != PJ_SUCCESS) { 618 635 … … 1314 1331 PJ_UNUSED_ARG(unhold); 1315 1332 PJ_TODO(create_active_inactive_sdp_based_on_unhold_arg); 1316 status = pjsua_media_channel_create_sdp(call->index, call->inv->pool, &sdp); 1333 status = pjsua_media_channel_create_sdp(call->index, call->inv->pool, 1334 NULL, &sdp); 1317 1335 if (status != PJ_SUCCESS) { 1318 1336 pjsua_perror(THIS_FILE, "Unable to get SDP from media endpoint", … … 1380 1398 1381 1399 /* Create SDP */ 1382 status = pjsua_media_channel_create_sdp(call->index, call->inv->pool, &sdp); 1400 status = pjsua_media_channel_create_sdp(call->index, call->inv->pool, 1401 NULL, &sdp); 1383 1402 if (status != PJ_SUCCESS) { 1384 1403 pjsua_perror(THIS_FILE, "Unable to get SDP from media endpoint", … … 2321 2340 { 2322 2341 pjsua_call *call; 2323 constpjmedia_sdp_session *local_sdp;2342 pjmedia_sdp_session *local_sdp; 2324 2343 const pjmedia_sdp_session *remote_sdp; 2325 2344 … … 2502 2521 } 2503 2522 2504 status = pjsua_media_channel_create_sdp(call->index, call->inv->pool, &answer); 2523 status = pjsua_media_channel_create_sdp(call->index, call->inv->pool, 2524 offer, &answer); 2505 2525 } 2506 2526 … … 2554 2574 } 2555 2575 2556 status = pjsua_media_channel_create_sdp(call->index, call->inv->pool, offer); 2576 status = pjsua_media_channel_create_sdp(call->index, call->inv->pool, 2577 NULL, offer); 2557 2578 } 2558 2579 -
pjproject/branches/users/nanang/pjsip/src/pjsua-lib/pjsua_media.c
r1655 r1698 535 535 goto on_error; 536 536 } 537 status = pjmedia_transport_udp_attach(pjsua_var.med_endpt, NULL, 538 &skinfo, 0, 539 &pjsua_var.calls[i].med_tp); 537 538 if (pjsua_var.media_cfg.enable_srtp) { 539 pjmedia_transport *tp; 540 unsigned srtp_options = 541 PJMEDIA_SRTP_AUTO_CLOSE_UNDERLYING_TRANSPORT; 542 543 status = pjmedia_transport_udp_attach(pjsua_var.med_endpt, NULL, 544 &skinfo, 0, &tp); 545 status = pjmedia_transport_srtp_create(pjsua_var.med_endpt, tp, 546 srtp_options, 547 &pjsua_var.calls[i].med_tp); 548 } else { 549 status = pjmedia_transport_udp_attach(pjsua_var.med_endpt, NULL, 550 &skinfo, 0, 551 &pjsua_var.calls[i].med_tp); 552 } 540 553 if (status != PJ_SUCCESS) { 541 554 pjsua_perror(THIS_FILE, "Unable to create media transport", … … 544 557 } 545 558 546 pjmedia_transport_ udp_simulate_lost(pjsua_var.calls[i].med_tp,547 548 549 550 pjmedia_transport_ udp_simulate_lost(pjsua_var.calls[i].med_tp,551 552 559 pjmedia_transport_simulate_lost(pjsua_var.calls[i].med_tp, 560 PJMEDIA_DIR_ENCODING, 561 pjsua_var.media_cfg.tx_drop_pct); 562 563 pjmedia_transport_simulate_lost(pjsua_var.calls[i].med_tp, 564 PJMEDIA_DIR_DECODING, 565 pjsua_var.media_cfg.rx_drop_pct); 553 566 554 567 } … … 646 659 } 647 660 648 pjmedia_ ice_simulate_lost(pjsua_var.calls[i].med_tp,649 PJMEDIA_DIR_ENCODING,650 pjsua_var.media_cfg.tx_drop_pct);651 652 pjmedia_ ice_simulate_lost(pjsua_var.calls[i].med_tp,653 PJMEDIA_DIR_DECODING,654 pjsua_var.media_cfg.rx_drop_pct);661 pjmedia_transport_simulate_lost(pjsua_var.calls[i].med_tp, 662 PJMEDIA_DIR_ENCODING, 663 pjsua_var.media_cfg.tx_drop_pct); 664 665 pjmedia_transport_simulate_lost(pjsua_var.calls[i].med_tp, 666 PJMEDIA_DIR_DECODING, 667 pjsua_var.media_cfg.rx_drop_pct); 655 668 656 669 status = pjmedia_ice_start_init(pjsua_var.calls[i].med_tp, 0, &addr, … … 757 770 758 771 /* Restart ICE */ 759 pjmedia_ ice_stop_ice(call->med_tp);772 pjmedia_transport_media_stop(call->med_tp); 760 773 761 774 status = pjmedia_ice_init_ice(call->med_tp, ice_role, NULL, NULL); … … 769 782 pj_status_t pjsua_media_channel_create_sdp(pjsua_call_id call_id, 770 783 pj_pool_t *pool, 784 const pjmedia_sdp_session *rem_sdp, 771 785 pjmedia_sdp_session **p_sdp) 772 786 { … … 816 830 } 817 831 818 if (pjsua_var.media_cfg.enable_ice) { 819 status = pjmedia_ice_modify_sdp(call->med_tp, pool, sdp); 832 //if (pjsua_var.media_cfg.enable_ice) { 833 //status = pjmedia_transport_media_create(call->med_tp, pool, sdp, NULL); 834 status = pjmedia_transport_media_create(call->med_tp, pool, 835 sdp, rem_sdp); 820 836 if (status != PJ_SUCCESS) 821 837 goto on_error; 822 }838 //} 823 839 824 840 *p_sdp = sdp; … … 859 875 stop_media_session(call_id); 860 876 861 if (pjsua_var.media_cfg.enable_ice) {862 pjmedia_ ice_stop_ice(call->med_tp);863 }877 //if (pjsua_var.media_cfg.enable_ice) { 878 pjmedia_transport_media_stop(call->med_tp); 879 //} 864 880 865 881 return PJ_SUCCESS; … … 885 901 886 902 pj_status_t pjsua_media_channel_update(pjsua_call_id call_id, 887 constpjmedia_sdp_session *local_sdp,903 pjmedia_sdp_session *local_sdp, 888 904 const pjmedia_sdp_session *remote_sdp) 889 905 { … … 947 963 948 964 /* Shutdown ICE session */ 949 if (pjsua_var.media_cfg.enable_ice) {950 pjmedia_ ice_stop_ice(call->med_tp);951 }965 //if (pjsua_var.media_cfg.enable_ice) { 966 pjmedia_transport_media_stop(call->med_tp); 967 //} 952 968 953 969 /* No need because we need keepalive? */ … … 955 971 } else { 956 972 /* Start ICE */ 957 if (pjsua_var.media_cfg.enable_ice) { 958 status = pjmedia_ice_start_ice(call->med_tp, call->inv->pool, 959 remote_sdp, 0); 973 //if (pjsua_var.media_cfg.enable_ice) { 974 status = pjmedia_transport_media_start(call->med_tp, 975 call->inv->pool, 976 local_sdp, remote_sdp, 0); 960 977 if (status != PJ_SUCCESS) 961 978 return status; 962 }979 //} 963 980 964 981 /* Override ptime, if this option is specified. */
Note: See TracChangeset
for help on using the changeset viewer.