Use shutdown() before close() and separate out the cancel requests for the timing, control and audio threads, see if we can see anything.

This commit is contained in:
Mike Brady
2018-06-03 19:59:24 +01:00
parent 200be48e87
commit 6eab2d1617
2 changed files with 17 additions and 3 deletions
+8 -3
View File
@@ -2335,14 +2335,19 @@ static void *player_thread_func(void *arg) {
config.output->stop();
debug(2, "Cancelling timing, control and audio threads...");
debug(2, "Cancel timing thread.");
pthread_cancel(rtp_timing_thread);
pthread_cancel(rtp_control_thread);
pthread_cancel(rtp_audio_thread);
debug(2, "Joining terminated threads.");
debug(2, "Join timing thread.");
pthread_join(rtp_timing_thread, NULL);
debug(2, "Timing thread terminated.");
debug(2, "Cancel control thread.");
pthread_cancel(rtp_control_thread);
debug(2, "Join control thread.");
pthread_join(rtp_control_thread, NULL);
debug(2, "Control thread terminated.");
debug(2, "Cancel audio thread.");
pthread_cancel(rtp_audio_thread);
debug(2, "Join audio thread.");
pthread_join(rtp_audio_thread, NULL);
debug(2, "Audio thread terminated.");
clear_reference_timestamp(conn);
+9
View File
@@ -68,6 +68,9 @@ void rtp_terminate(rtsp_conn_info *conn) {
void rtp_audio_receiver_cleanup_handler(void *arg) {
debug(3, "Audio Receiver Cleanup.");
rtsp_conn_info *conn = (rtsp_conn_info *)arg;
debug(1,"shutdown audio socket.");
shutdown(conn->audio_socket,SHUT_RDWR);
debug(1,"close audio socket.");
close(conn->audio_socket);
debug(3, "Audio Receiver Cleanup Successful.");
}
@@ -188,6 +191,9 @@ void *rtp_audio_receiver(void *arg) {
void rtp_control_handler_cleanup_handler(void *arg) {
debug(3, "Control Receiver Cleanup.");
rtsp_conn_info *conn = (rtsp_conn_info *)arg;
debug(1,"shutdown control socket.");
shutdown(conn->control_socket,SHUT_RDWR);
debug(1,"close control socket.");
close(conn->control_socket);
debug(3, "Control Receiver Cleanup Successful.");
}
@@ -471,6 +477,9 @@ void rtp_timing_receiver_cleanup_handler(void *arg) {
rtsp_conn_info *conn = (rtsp_conn_info *)arg;
pthread_cancel(conn->timer_requester);
pthread_join(conn->timer_requester, NULL);
debug(1,"shutdown timing socket.");
shutdown(conn->timing_socket,SHUT_RDWR);
debug(1,"close timing socket.");
close(conn->timing_socket);
debug(3, "Timing Receiver Cleanup Successful.");
}