Changeset 452 for pjproject/trunk/pjsip-apps/src/samples/streamutil.c
- Timestamp:
- May 17, 2006 5:17:39 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/samples/streamutil.c
r448 r452 111 111 { 112 112 pjmedia_stream_info info; 113 pjmedia_transport *transport; 113 114 pj_status_t status; 114 115 … … 130 131 131 132 132 /* Create RTP socket */ 133 status = pj_sock_socket(PJ_AF_INET, PJ_SOCK_DGRAM, 0, 134 &info.sock_info.rtp_sock); 135 PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); 136 137 138 /* Bind RTP socket to local port */ 139 info.sock_info.rtp_addr_name.sin_family = PJ_AF_INET; 140 info.sock_info.rtp_addr_name.sin_port = pj_htons(local_port); 141 142 status = pj_sock_bind(info.sock_info.rtp_sock, 143 &info.sock_info.rtp_addr_name, 144 sizeof(pj_sockaddr_in)); 145 if (status != PJ_SUCCESS) { 146 app_perror(THIS_FILE, "Unable to bind RTP socket", status); 147 pj_sock_close(info.sock_info.rtp_sock); 133 /* Create media transport */ 134 status = pjmedia_transport_udp_create(med_endpt, NULL, local_port, 135 &transport); 136 if (status != PJ_SUCCESS) 148 137 return status; 149 }150 151 152 /* Create RTCP socket */153 status = pj_sock_socket(PJ_AF_INET, PJ_SOCK_DGRAM, 0,154 &info.sock_info.rtcp_sock);155 PJ_ASSERT_RETURN(status == PJ_SUCCESS, status);156 157 158 /* Bind RTP socket to local port + 1 */159 ++local_port;160 info.sock_info.rtcp_addr_name.sin_family = PJ_AF_INET;161 info.sock_info.rtcp_addr_name.sin_port = pj_htons(local_port);162 163 status = pj_sock_bind(info.sock_info.rtcp_sock,164 &info.sock_info.rtcp_addr_name,165 sizeof(pj_sockaddr_in));166 if (status != PJ_SUCCESS) {167 app_perror(THIS_FILE, "Unable to bind RTCP socket", status);168 pj_sock_close(info.sock_info.rtp_sock);169 pj_sock_close(info.sock_info.rtcp_sock);170 return status;171 }172 138 173 139 … … 176 142 */ 177 143 178 status = pjmedia_stream_create( med_endpt, pool, &info, NULL, p_stream); 144 status = pjmedia_stream_create( med_endpt, pool, &info, 145 transport, NULL, p_stream); 179 146 180 147 if (status != PJ_SUCCESS) { 181 148 app_perror(THIS_FILE, "Error creating stream", status); 182 pj_sock_close(info.sock_info.rtp_sock); 183 pj_sock_close(info.sock_info.rtcp_sock); 149 pjmedia_transport_udp_close(transport); 184 150 return status; 185 151 } … … 212 178 pjmedia_port *stream_port; 213 179 char tmp[10]; 214 pj_status_t status; 180 pj_status_t status; 215 181 216 182 … … 514 480 /* Destroy stream */ 515 481 if (stream) { 482 pjmedia_transport *tp; 483 484 tp = pjmedia_stream_get_transport(stream); 516 485 pjmedia_stream_destroy(stream); 486 pjmedia_transport_udp_close(tp); 517 487 } 518 488
Note: See TracChangeset
for help on using the changeset viewer.