| 2624 | } |
| 2625 | |
| 2626 | void rtpstream_audioecho_thread(void* param) |
| 2627 | { |
| 2628 | int exit_code = 0; |
| 2629 | #ifdef USE_TLS |
| 2630 | my_unique_ptr<unsigned char[]> msg { |
| 2631 | reinterpret_cast<unsigned char*>(malloc(media_bufsize)) }; |
| 2632 | ssize_t nr; |
| 2633 | ssize_t ns; |
| 2634 | sipp_socklen_t len; |
| 2635 | struct sockaddr_storage remote_rtp_addr; |
| 2636 | sigset_t mask; |
| 2637 | int rc = 0; |
| 2638 | struct timespec tspec; |
| 2639 | int sock = 0; |
| 2640 | int flags; |
| 2641 | std::vector<unsigned char> rtp_header; |
| 2642 | std::vector<unsigned char> payload_data; |
| 2643 | std::vector<unsigned char> audio_packet_in; |
| 2644 | std::vector<unsigned char> audio_packet_out; |
| 2645 | unsigned short seq_num = 0; |
| 2646 | unsigned short host_flags = 0; |
| 2647 | unsigned short host_seqnum = 0; |
| 2648 | unsigned int host_timestamp = 0; |
| 2649 | unsigned int host_ssrc = 0; |
| 2650 | bool abnormal_termination = false; |
| 2651 | quit_audioecho_thread = false; |
| 2652 | ParamPass p; |
| 2653 | |
| 2654 | tspec.tv_sec = 0; |
| 2655 | tspec.tv_nsec = 10000000; /* 10ms */ |
| 2656 | |
| 2657 | p.p = param; |
| 2658 | |
| 2659 | if (param != nullptr) |
| 2660 | { |
| 2661 | sock = p.i; |
| 2662 | } |
| 2663 | |
| 2664 | if ((flags = fcntl(sock, F_GETFL, 0)) < 0) |
| 2665 | { |
| 2666 | pthread_mutex_lock(&debugremutexaudio); |
| 2667 | if (debugrefileaudio != nullptr) |
| 2668 | { |
| 2669 | fprintf(debugrefileaudio, "rtp_audioecho_thread(): fcntl() GETFL UNBLOCK failed...\n"); |
| 2670 | } |
| 2671 | pthread_mutex_unlock(&debugremutexaudio); |
| 2672 | pthread_exit((void*) 1); |
| 2673 | } |
| 2674 | |
| 2675 | if (fcntl(sock, F_SETFL, flags | O_NONBLOCK) < 0) |
| 2676 | { |
| 2677 | pthread_mutex_lock(&debugremutexaudio); |
| 2678 | if (debugrefileaudio != nullptr) |
| 2679 | { |
| 2680 | fprintf(debugrefileaudio, "rtp_audioecho_thread(): fcntl() SETFL UNBLOCK failed...\n"); |
| 2681 | } |
| 2682 | pthread_mutex_unlock(&debugremutexaudio); |
| 2683 | pthread_exit((void*) 2); |
nothing calls this directly
no test coverage detected