Skip to content

Commit

Permalink
Working for Realtime Audio Streams
Browse files Browse the repository at this point in the history
  • Loading branch information
mikebrady committed Apr 30, 2021
1 parent 390eeae commit 91b85a0
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 22 deletions.
10 changes: 6 additions & 4 deletions dacp.c
Original file line number Diff line number Diff line change
Expand Up @@ -415,10 +415,12 @@ void set_dacp_server_information(rtsp_conn_info *conn) {
// This is different to other AirPlay clients
// which return immediately with a 403 code if there are no changes.
dacp_server.always_use_revision_number_1 = 0;
char *p = strstr(conn->UserAgent, "forked-daapd");
if ((p != 0) &&
(p == conn->UserAgent)) { // must exist and be at the start of the UserAgent string
dacp_server.always_use_revision_number_1 = 1;
if (conn->UserAgent != NULL) {
char *p = strstr(conn->UserAgent, "forked-daapd");
if ((p != 0) &&
(p == conn->UserAgent)) { // must exist and be at the start of the UserAgent string
dacp_server.always_use_revision_number_1 = 1;
}
}

metadata_hub_modify_prolog();
Expand Down
49 changes: 33 additions & 16 deletions rtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1007,21 +1007,13 @@ void reset_ntp_anchor_info(rtsp_conn_info *conn) {
debug_mutex_unlock(&conn->reference_time_mutex, 3);
}

void reset_anchor_info(rtsp_conn_info *conn) {
reset_ntp_anchor_info(conn);
}

int have_ntp_timestamp_timing_information(rtsp_conn_info *conn) {
if (conn->anchor_rtptime == 0)
return 0;
else
return 1;
}

int have_timestamp_timing_information(rtsp_conn_info *conn) {
return have_ntp_timestamp_timing_information(conn);
}

// set this to zero to use the rates supplied by the sources, which might not always be completely
// right...
const int use_nominal_rate = 0; // specify whether to use the nominal input rate, usually 44100 fps
Expand Down Expand Up @@ -1196,14 +1188,6 @@ void rtp_request_resend(seq_t first, uint32_t count, rtsp_conn_info *conn) {
}
}

int frame_to_local_time(uint32_t timestamp, uint64_t *time, rtsp_conn_info *conn) {
return frame_to_ntp_local_time(timestamp, time, conn);
}

int local_time_to_frame(uint64_t time, uint32_t *frame, rtsp_conn_info *conn) {
return local_ntp_time_to_frame(time, frame, conn);
}

#ifdef CONFIG_AIRPLAY_2

void set_ptp_anchor_info(rtsp_conn_info *conn, uint64_t clock_id, uint32_t rtptime,
Expand Down Expand Up @@ -2360,5 +2344,38 @@ void *rtp_buffered_audio_processor(void *arg) {
pthread_cleanup_pop(1); // do the cleanup.
pthread_exit(NULL);
}
int frame_to_local_time(uint32_t timestamp, uint64_t *time, rtsp_conn_info *conn) {
return frame_to_ptp_local_time(timestamp, time, conn);
}

int local_time_to_frame(uint64_t time, uint32_t *frame, rtsp_conn_info *conn) {
return local_ptp_time_to_frame(time, frame, conn);
}

void reset_anchor_info(rtsp_conn_info *conn) {
reset_ptp_anchor_info(conn);
}

int have_timestamp_timing_information(rtsp_conn_info *conn) {
return have_ptp_timing_information(conn);
}

#else
int frame_to_local_time(uint32_t timestamp, uint64_t *time, rtsp_conn_info *conn) {
return frame_to_ntp_local_time(timestamp, time, conn);
}

int local_time_to_frame(uint64_t time, uint32_t *frame, rtsp_conn_info *conn) {
return local_ntp_time_to_frame(time, frame, conn);
}

void reset_anchor_info(rtsp_conn_info *conn) {
reset_ntp_anchor_info(conn);
}

int have_timestamp_timing_information(rtsp_conn_info *conn) {
return have_ntp_timestamp_timing_information(conn);
}
#endif


4 changes: 2 additions & 2 deletions rtsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2016,10 +2016,10 @@ void handle_post(rtsp_conn_info *conn, rtsp_message *req, rtsp_message *resp) {
} else if (strcmp(req->path, "/fp-setup") == 0) {
handle_fp_setup(conn, req, resp);
} else {
debug(2, "Connection %d: POST %s Content-Length %d", conn->connection_number, req->path,
debug(3, "Connection %d: POST %s Content-Length %d", conn->connection_number, req->path,
req->contentlength);
debug_log_rtsp_message(2, "POST request", req);
debug(2, "Unhandled POST, path \"%s\".", req->path);
debug(3, "Unhandled POST, path \"%s\".", req->path);
}
}

Expand Down

0 comments on commit 91b85a0

Please sign in to comment.