Changeset 5747
- Timestamp:
- Feb 26, 2018 10:14:27 AM (7 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia/transport_udp.c
r5737 r5747 57 57 void *user_data; /**< Only valid when attached */ 58 58 //pj_bool_t attached; /**< Has attachment? */ 59 pj_bool_t started; /**< Has started? */ 59 60 pj_sockaddr rem_rtp_addr; /**< Remote RTP address */ 60 61 unsigned rem_rtp_cnt; /**< How many pkt from this addr. */ … … 282 283 pj_ioqueue_t *ioqueue; 283 284 pj_ioqueue_callback rtp_cb, rtcp_cb; 284 pj_ssize_t size;285 285 unsigned i; 286 286 pj_status_t status; … … 355 355 sizeof(tp->rtp_pending_write[i].op_key)); 356 356 357 #if 0 // See #2097: move read op kick-off to media_start() 357 358 /* Kick of pending RTP read from the ioqueue */ 358 359 tp->rtp_addrlen = sizeof(tp->rtp_src_addr); … … 363 364 if (status != PJ_EPENDING) 364 365 goto on_error; 366 #endif 365 367 366 368 … … 382 384 383 385 386 #if 0 // See #2097: move read op kick-off to media_start() 384 387 /* Kick of pending RTCP read from the ioqueue */ 385 388 size = sizeof(tp->rtcp_pkt); … … 390 393 if (status != PJ_EPENDING) 391 394 goto on_error; 395 #endif 392 396 393 397 tp->ioqueue = ioqueue; … … 571 575 bytes_read = -status; 572 576 573 } while (status != PJ_EPENDING && status != PJ_ECANCELLED); 577 } while (status != PJ_EPENDING && status != PJ_ECANCELLED && 578 udp->started); 574 579 } 575 580 … … 581 586 { 582 587 struct transport_udp *udp; 583 pj_status_t status ;588 pj_status_t status = PJ_SUCCESS; 584 589 585 590 PJ_UNUSED_ARG(op_key); … … 651 656 bytes_read = -status; 652 657 653 } while (status != PJ_EPENDING && status != PJ_ECANCELLED); 658 } while (status != PJ_EPENDING && status != PJ_ECANCELLED && 659 udp->started); 654 660 } 655 661 … … 998 1004 unsigned media_index) 999 1005 { 1000 PJ_ASSERT_RETURN(tp && pool && sdp_local, PJ_EINVAL); 1001 1002 PJ_UNUSED_ARG(tp); 1006 struct transport_udp *udp = (struct transport_udp*)tp; 1007 pj_ssize_t size; 1008 pj_status_t status; 1009 1010 PJ_ASSERT_RETURN(tp, PJ_EINVAL); 1011 1003 1012 PJ_UNUSED_ARG(pool); 1004 1013 PJ_UNUSED_ARG(sdp_local); … … 1006 1015 PJ_UNUSED_ARG(media_index); 1007 1016 1017 /* Just return success if there is already pending read */ 1018 if (udp->started) 1019 return PJ_SUCCESS; 1020 1021 /* Kick off pending RTP read from the ioqueue */ 1022 udp->rtp_addrlen = sizeof(udp->rtp_src_addr); 1023 size = sizeof(udp->rtp_pkt); 1024 status = pj_ioqueue_recvfrom(udp->rtp_key, &udp->rtp_read_op, 1025 udp->rtp_pkt, &size, PJ_IOQUEUE_ALWAYS_ASYNC, 1026 &udp->rtp_src_addr, &udp->rtp_addrlen); 1027 if (status != PJ_EPENDING) 1028 return status; 1029 1030 /* Kick off pending RTCP read from the ioqueue */ 1031 udp->rtcp_addr_len = sizeof(udp->rtcp_src_addr); 1032 size = sizeof(udp->rtcp_pkt); 1033 status = pj_ioqueue_recvfrom(udp->rtcp_key, &udp->rtcp_read_op, 1034 udp->rtcp_pkt, &size, 1035 PJ_IOQUEUE_ALWAYS_ASYNC, 1036 &udp->rtcp_src_addr, &udp->rtcp_addr_len); 1037 if (status != PJ_EPENDING) 1038 return status; 1039 1040 udp->started = PJ_TRUE; 1041 1008 1042 return PJ_SUCCESS; 1009 1043 } … … 1011 1045 static pj_status_t transport_media_stop(pjmedia_transport *tp) 1012 1046 { 1013 PJ_UNUSED_ARG(tp); 1047 struct transport_udp *udp = (struct transport_udp*)tp; 1048 1049 PJ_ASSERT_RETURN(tp, PJ_EINVAL); 1050 1051 /* Just return success if there is no pending read */ 1052 if (!udp->started) 1053 return PJ_SUCCESS; 1054 1055 pj_ioqueue_post_completion(udp->rtp_key, &udp->rtp_read_op, 1056 -PJ_ECANCELLED); 1057 1058 pj_ioqueue_post_completion(udp->rtcp_key, &udp->rtcp_read_op, 1059 -PJ_ECANCELLED); 1060 1061 udp->started = PJ_FALSE; 1014 1062 1015 1063 return PJ_SUCCESS; -
pjproject/trunk/pjsip-apps/src/samples/simpleua.c
r5241 r5747 871 871 } 872 872 873 /* Start the UDP media transport */ 874 pjmedia_transport_media_start(g_med_transport[0], 0, 0, 0, 0); 875 873 876 /* Get the media port interface of the audio stream. 874 877 * Media port interface is basicly a struct containing get_frame() and … … 947 950 } 948 951 952 /* Start the UDP media transport */ 953 pjmedia_transport_media_start(g_med_transport[1], 0, 0, 0, 0); 954 949 955 if (vstream_info.dir & PJMEDIA_DIR_DECODING) { 950 956 status = pjmedia_vid_dev_default_param( -
pjproject/trunk/pjsip-apps/src/samples/siprtp.c
r5535 r5747 1471 1471 } 1472 1472 1473 /* Start media transport */ 1474 pjmedia_transport_media_start(audio->transport, 0, 0, 0, 0); 1475 1473 1476 /* Start media thread. */ 1474 1477 audio->thread_quit_flag = 0; -
pjproject/trunk/pjsip-apps/src/samples/streamutil.c
r5681 r5747 345 345 return status; 346 346 } 347 348 /* Start media transport */ 349 pjmedia_transport_media_start(transport, 0, 0, 0, 0); 347 350 348 351 -
pjproject/trunk/pjsip-apps/src/samples/vid_streamutil.c
r5618 r5747 286 286 } 287 287 288 /* Start media transport */ 289 pjmedia_transport_media_start(transport, 0, 0, 0, 0); 288 290 289 291 return PJ_SUCCESS;
Note: See TracChangeset
for help on using the changeset viewer.