Balking when connecting to HPM.
This commit is contained in:
@@ -99,10 +99,9 @@ void rtp_buffered_audio_cleanup_handler(__attribute__((unused)) void *arg) {
|
||||
}
|
||||
|
||||
void *rtp_buffered_audio_processor(void *arg) {
|
||||
// #include <syscall.h>
|
||||
// debug(1, "rtp_buffered_audio_processor PID %d", syscall(SYS_gettid));
|
||||
rtsp_conn_info *conn = (rtsp_conn_info *)arg;
|
||||
|
||||
#include <syscall.h>
|
||||
debug(1, "Connection %d: rtp_buffered_audio_processor PID %d start", conn->connection_number, syscall(SYS_gettid));
|
||||
conn->incoming_ssrc = 0; // reset
|
||||
conn->resampler_ssrc = 0;
|
||||
|
||||
@@ -126,7 +125,8 @@ void *rtp_buffered_audio_processor(void *arg) {
|
||||
buffered_tcp_desc *buffered_audio = malloc(sizeof(buffered_tcp_desc));
|
||||
if (buffered_audio == NULL)
|
||||
debug(1, "cannot allocate a buffered_tcp_desc!");
|
||||
// initialise the descriptor
|
||||
// initialise the
|
||||
|
||||
memset(buffered_audio, 0, sizeof(buffered_tcp_desc));
|
||||
pthread_cleanup_push(malloc_cleanup, &buffered_audio);
|
||||
|
||||
@@ -314,7 +314,7 @@ void *rtp_buffered_audio_processor(void *arg) {
|
||||
|
||||
if (nread == 0) {
|
||||
// nread is 0 -- the port has been closed
|
||||
debug(1, "buffered audio port closed!");
|
||||
debug(1, "Connection %d: buffered audio port closed!", conn->connection_number);
|
||||
finished = 1;
|
||||
} else if (nread < 0) {
|
||||
char errorstring[1024];
|
||||
@@ -516,7 +516,7 @@ void *rtp_buffered_audio_processor(void *arg) {
|
||||
} else {
|
||||
timestamp_difference = timestamp - expected_timestamp;
|
||||
if (timestamp_difference != 0) {
|
||||
debug(2,
|
||||
debug(1,
|
||||
"Connection %d: "
|
||||
"unexpected timestamp in block %u. Actual: %u, expected: %u "
|
||||
"difference: %d, "
|
||||
@@ -541,7 +541,7 @@ void *rtp_buffered_audio_processor(void *arg) {
|
||||
int32_t abs_timestamp_difference = -timestamp_difference;
|
||||
if ((size_t)abs_timestamp_difference > get_ssrc_block_length(payload_ssrc)) {
|
||||
skip_this_block = 1;
|
||||
debug(2,
|
||||
debug(1,
|
||||
"skipping block %u because it was too far in the past. Timestamp "
|
||||
"difference: %d, length of block: %u.",
|
||||
seq_no, timestamp_difference, get_ssrc_block_length(payload_ssrc));
|
||||
@@ -587,7 +587,7 @@ void *rtp_buffered_audio_processor(void *arg) {
|
||||
}
|
||||
}
|
||||
} while (finished == 0);
|
||||
debug(2, "Buffered Audio Receiver RTP thread \"normal\" exit.");
|
||||
debug(1, "Connection %d: rtp_buffered_audio_processor PID %d exiting", conn->connection_number, syscall(SYS_gettid));
|
||||
pthread_cleanup_pop(1); // buffered_tcp_reader thread creation
|
||||
pthread_cleanup_pop(1); // buffer malloc
|
||||
pthread_cleanup_pop(1); // not_full_cv
|
||||
@@ -596,5 +596,6 @@ void *rtp_buffered_audio_processor(void *arg) {
|
||||
pthread_cleanup_pop(1); // descriptor malloc
|
||||
pthread_cleanup_pop(1); // pthread_t malloc
|
||||
pthread_cleanup_pop(1); // do the cleanup.
|
||||
debug(1, "Connection %d: rtp_buffered_audio_processor PID %d finish", conn->connection_number, syscall(SYS_gettid));
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
|
||||
@@ -3322,12 +3322,14 @@ void player_thread_cleanup_handler(void *arg) {
|
||||
|
||||
} else if (conn->airplay_stream_type == buffered_stream) {
|
||||
|
||||
debug(2,
|
||||
debug(1,
|
||||
"Connection %d: Delete Buffered Audio Stream thread by player_thread_cleanup_handler",
|
||||
conn->connection_number);
|
||||
pthread_cancel(conn->rtp_buffered_audio_thread);
|
||||
pthread_join(conn->rtp_buffered_audio_thread, NULL);
|
||||
|
||||
debug(1,
|
||||
"Connection %d: Deleted Buffered Audio Stream thread by player_thread_cleanup_handler",
|
||||
conn->connection_number);
|
||||
} else {
|
||||
die("Unrecognised Stream Type");
|
||||
}
|
||||
|
||||
@@ -430,10 +430,10 @@ int get_play_lock(rtsp_conn_info *conn, int allow_session_interruption) {
|
||||
|
||||
if (principal_conn->fd > 0) {
|
||||
debug(1,
|
||||
"Connection %d: get_play_lock forced termination. Closing RTSP connection socket %d: "
|
||||
"Connection %d: get_play_lock forced termination in favour of connection %d. Closing RTSP connection socket %d: "
|
||||
"from %s:%u to self at "
|
||||
"%s:%u.",
|
||||
principal_conn->connection_number, principal_conn->fd, principal_conn->client_ip_string,
|
||||
principal_conn->connection_number, conn->connection_number, principal_conn->fd, principal_conn->client_ip_string,
|
||||
principal_conn->client_rtsp_port, principal_conn->self_ip_string,
|
||||
principal_conn->self_rtsp_port);
|
||||
close(principal_conn->fd);
|
||||
@@ -2995,7 +2995,7 @@ void handle_setup_2(rtsp_conn_info *conn, rtsp_message *req, rtsp_message *resp)
|
||||
// debug(1,"initial timing peer command: \"%s\".", timing_list_message);
|
||||
// ptp_send_control_message_string(timing_list_message);
|
||||
set_client_as_ptp_clock(conn);
|
||||
// ptp_send_control_message_string("B"); // signify clock dependability period is
|
||||
ptp_send_control_message_string("B"); // signify clock dependability period is
|
||||
// "B"eginning (or continuing)
|
||||
plist_dict_set_item(timingPeerInfoPlist, "Addresses", addresses);
|
||||
plist_dict_set_item(timingPeerInfoPlist, "ID",
|
||||
@@ -3294,9 +3294,14 @@ void handle_setup_2(rtsp_conn_info *conn, rtsp_message *req, rtsp_message *resp)
|
||||
|
||||
activity_monitor_signify_activity(1);
|
||||
|
||||
debug(1, "Connection %d: create rtp_buffered_audio_thread", conn->connection_number);
|
||||
|
||||
named_pthread_create_with_priority(&conn->rtp_buffered_audio_thread, 2,
|
||||
&rtp_buffered_audio_processor, (void *)conn,
|
||||
"ap2_bat_%d", conn->connection_number);
|
||||
|
||||
|
||||
usleep(1000000);
|
||||
|
||||
plist_dict_set_item(stream0dict, "type", plist_new_uint(103));
|
||||
plist_dict_set_item(stream0dict, "dataPort",
|
||||
|
||||
@@ -92,7 +92,7 @@ ssize_t buffered_read(buffered_tcp_desc *descriptor, void *buf, size_t count,
|
||||
#define STANDARD_PACKET_SIZE 4096
|
||||
|
||||
void buffered_tcp_reader_cleanup_handler(__attribute__((unused)) void *arg) {
|
||||
debug(2, "Buffered TCP Reader Thread Exit via Cleanup.");
|
||||
debug(1, "Buffered TCP Reader Thread Exit via Cleanup.");
|
||||
}
|
||||
|
||||
void *buffered_tcp_reader(void *arg) {
|
||||
|
||||
Reference in New Issue
Block a user