Changeset 5676
- Timestamp:
- Oct 24, 2017 7:31:39 AM (7 years ago)
- Location:
- pjproject/trunk/pjsip
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h
r5675 r5676 488 488 489 489 490 /** 491 * Structure to be passed to on stream created callback. 492 * See #on_stream_created2(). 493 */ 494 typedef struct pjsua_on_stream_created_param 495 { 496 /** 497 * The media stream, read-only. 498 */ 499 pjmedia_stream *stream; 500 501 /** 502 * Stream index in the media session, read-only. 503 */ 504 unsigned stream_idx; 505 506 /** 507 * Specify if PJSUA should take ownership of the port returned in 508 * the port parameter below. If set to PJ_TRUE, 509 * pjmedia_port_destroy() will be called on the port when it is 510 * no longer needed. 511 * 512 * Default: PJ_FALSE 513 */ 514 pj_bool_t destroy_port; 515 516 /** 517 * On input, it specifies the media port of the stream. Application 518 * may modify this pointer to point to different media port to be 519 * registered to the conference bridge. 520 */ 521 pjmedia_port *port; 522 523 } pjsua_on_stream_created_param; 524 525 490 526 /** 491 527 * Enumeration of media transport state types. … … 822 858 * media port then will be added to the conference bridge instead. 823 859 * 860 * Note: if implemented, #on_stream_created2() callback will be called 861 * instead of this one. 862 * 824 863 * @param call_id Call identification. 825 864 * @param strm Media stream. … … 834 873 unsigned stream_idx, 835 874 pjmedia_port **p_port); 875 876 /** 877 * Notify application when media session is created and before it is 878 * registered to the conference bridge. Application may return different 879 * media port if it has added media processing port to the stream. This 880 * media port then will be added to the conference bridge instead. 881 * 882 * @param call_id Call identification. 883 * @param param The on stream created callback parameter. 884 */ 885 void (*on_stream_created2)(pjsua_call_id call_id, 886 pjsua_on_stream_created_param *param); 836 887 837 888 /** -
pjproject/trunk/pjsip/include/pjsua-lib/pjsua_internal.h
r5649 r5676 52 52 struct { 53 53 pjmedia_stream *stream; /**< The audio stream. */ 54 pjmedia_port *media_port;/**< The media port. */ 55 pj_bool_t destroy_port;/**< Destroy the media port? */ 54 56 int conf_slot; /**< Slot # in conference bridge. */ 55 57 } a; -
pjproject/trunk/pjsip/include/pjsua2/call.hpp
r5645 r5676 692 692 { 693 693 /** 694 * Media stream .694 * Media stream, read-only. 695 695 */ 696 696 MediaStream stream; 697 697 698 698 /** 699 * Stream index in the media session .699 * Stream index in the media session, read-only. 700 700 */ 701 701 unsigned streamIdx; 702 702 703 /** 704 * Specify if PJSUA2 should take ownership of the port returned in 705 * the pPort parameter below. If set to PJ_TRUE, 706 * pjmedia_port_destroy() will be called on the port when it is 707 * no longer needed. 708 * 709 * Default: PJ_FALSE 710 */ 711 bool destroyPort; 712 703 713 /** 704 714 * On input, it specifies the media port of the stream. Application -
pjproject/trunk/pjsip/include/pjsua2/endpoint.hpp
r5672 r5676 1665 1665 pj_pool_t *pool, 1666 1666 const pjmedia_sdp_session *rem_sdp); 1667 static void on_stream_created(pjsua_call_id call_id, 1668 pjmedia_stream *strm, 1669 unsigned stream_idx, 1670 pjmedia_port **p_port); 1667 static void on_stream_created2(pjsua_call_id call_id, 1668 pjsua_on_stream_created_param *param); 1671 1669 static void on_stream_destroyed(pjsua_call_id call_id, 1672 1670 pjmedia_stream *strm, -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_aud.c
r5651 r5676 532 532 } 533 533 534 if (call_med->strm.a.media_port) { 535 if (call_med->strm.a.destroy_port) 536 pjmedia_port_destroy(call_med->strm.a.media_port); 537 call_med->strm.a.media_port = NULL; 538 } 539 534 540 pjmedia_stream_destroy(strm); 535 541 call_med->strm.a.stream = NULL; … … 576 582 { 577 583 pjsua_call *call = call_med->call; 578 pjmedia_port *media_port;579 584 unsigned strm_idx = call_med->idx; 580 585 pj_status_t status = PJ_SUCCESS; … … 646 651 * We need the port interface to add to the conference bridge. 647 652 */ 648 pjmedia_stream_get_port(call_med->strm.a.stream, &media_port); 653 pjmedia_stream_get_port(call_med->strm.a.stream, 654 &call_med->strm.a.media_port); 649 655 650 656 /* Notify application about stream creation. … … 652 658 * media port 653 659 */ 654 if (pjsua_var.ua_cfg.cb.on_stream_created) { 655 pjsua_var.ua_cfg.cb.on_stream_created(call->index, 660 if (pjsua_var.ua_cfg.cb.on_stream_created2) { 661 pjsua_on_stream_created_param prm; 662 663 prm.stream = call_med->strm.a.stream; 664 prm.stream_idx = strm_idx; 665 prm.destroy_port = PJ_FALSE; 666 prm.port = call_med->strm.a.media_port; 667 (*pjsua_var.ua_cfg.cb.on_stream_created2)(call->index, &prm); 668 669 call_med->strm.a.destroy_port = prm.destroy_port; 670 call_med->strm.a.media_port = prm.port; 671 672 } else if (pjsua_var.ua_cfg.cb.on_stream_created) { 673 (*pjsua_var.ua_cfg.cb.on_stream_created)(call->index, 656 674 call_med->strm.a.stream, 657 strm_idx, &media_port); 675 strm_idx, 676 &call_med->strm.a.media_port); 658 677 } 659 678 … … 672 691 port_name = pj_str("call"); 673 692 } 674 status = pjmedia_conf_add_port( 675 676 677 678 679 693 status = pjmedia_conf_add_port(pjsua_var.mconf, 694 call->inv->pool, 695 call_med->strm.a.media_port, 696 &port_name, 697 (unsigned*) 698 &call_med->strm.a.conf_slot); 680 699 if (status != PJ_SUCCESS) { 681 700 goto on_return; -
pjproject/trunk/pjsip/src/pjsua2/endpoint.cpp
r5672 r5676 1071 1071 } 1072 1072 1073 void Endpoint::on_stream_created(pjsua_call_id call_id, 1074 pjmedia_stream *strm, 1075 unsigned stream_idx, 1076 pjmedia_port **p_port) 1073 void Endpoint::on_stream_created2(pjsua_call_id call_id, 1074 pjsua_on_stream_created_param *param) 1077 1075 { 1078 1076 Call *call = Call::lookup(call_id); … … 1082 1080 1083 1081 OnStreamCreatedParam prm; 1084 prm.stream = strm; 1085 prm.streamIdx = stream_idx; 1086 prm.pPort = (void *)*p_port; 1082 prm.stream = param->stream; 1083 prm.streamIdx = param->stream_idx; 1084 prm.destroyPort = param->destroy_port; 1085 prm.pPort = (MediaPort)param->port; 1087 1086 1088 1087 call->onStreamCreated(prm); 1089 1088 1090 if (prm.pPort != (void *)*p_port)1091 *p_port = (pjmedia_port *)prm.pPort;1089 param->destroy_port = prm.destroyPort; 1090 param->port = (pjmedia_port *)prm.pPort; 1092 1091 } 1093 1092 … … 1558 1557 ua_cfg.cb.on_call_media_state = &Endpoint::on_call_media_state; 1559 1558 ua_cfg.cb.on_call_sdp_created = &Endpoint::on_call_sdp_created; 1560 ua_cfg.cb.on_stream_created = &Endpoint::on_stream_created;1559 ua_cfg.cb.on_stream_created2 = &Endpoint::on_stream_created2; 1561 1560 ua_cfg.cb.on_stream_destroyed = &Endpoint::on_stream_destroyed; 1562 1561 ua_cfg.cb.on_dtmf_digit = &Endpoint::on_dtmf_digit;
Note: See TracChangeset
for help on using the changeset viewer.