AirPlay progress with synchro

This commit is contained in:
philippe44
2019-08-18 17:38:48 -07:00
parent 0f6e240cc6
commit 876720f9e2
8 changed files with 108 additions and 216 deletions

View File

@@ -53,7 +53,6 @@ typedef struct raop_ctx_s {
int sock; // socket of the above
struct in_addr peer; // IP of the iDevice (airplay sender)
bool running;
bool drift;
#ifdef WIN32
pthread_t thread, search_thread;
#else
@@ -141,8 +140,7 @@ struct raop_ctx_s *raop_create(struct in_addr host, char *name,
#ifdef WIN32
ctx->svr = glmDNSServer;
#endif
ctx->host = host;
#endif
ctx->host = host;
ctx->sock = socket(AF_INET, SOCK_STREAM, 0);
ctx->cmd_cb = cmd_cb;
@@ -464,9 +462,8 @@ static bool handle_rtsp(raop_ctx_t *ctx, int sock)
}
if ((p = strcasestr(body, "fmtp")) != NULL) {
p = strextract(p, ":", "\r\n");
ctx->rtsp.fmtp = strdup(p);
NFREE(p);
p = strextract(p, ":", "\r\n");
ctx->rtsp.fmtp = strdup(p);
NFREE(p);
}
@@ -493,10 +490,9 @@ static bool handle_rtsp(raop_ctx_t *ctx, int sock)
ctx->rtp = rtp.ctx;
if (cport * tport * rtp.cport * rtp.tport * rtp.aport && rtp.ctx) {
char *transport;
asprintf(&transport, "RTP/AVP/UDP;unicast;mode=record;control_port=%u;timing_port=%u;server_port=%u", rtp.cport, rtp.tport, rtp.aport);
LOG_DEBUG("[%p]: audio=(%hu:%hu), timing=(%hu:%hu), control=(%hu:%hu)", ctx, 0, rtp.aport, tport, rtp.tport, cport, rtp.cport);
kd_add(resp, "Transport", transport);
char *transport;
asprintf(&transport, "RTP/AVP/UDP;unicast;mode=record;control_port=%u;timing_port=%u;server_port=%u", rtp.cport, rtp.tport, rtp.aport);
LOG_DEBUG("[%p]: audio=(%hu:%hu), timing=(%hu:%hu), control=(%hu:%hu)", ctx, 0, rtp.aport, tport, rtp.tport, cport, rtp.cport);
kd_add(resp, "Transport", transport);
kd_add(resp, "Session", "DEADBEEF");
free(transport);
@@ -537,7 +533,7 @@ static bool handle_rtsp(raop_ctx_t *ctx, int sock)
if (ctx->rtp && rtp_flush(ctx->rtp, seqno, rtptime))
ctx->cmd_cb(RAOP_FLUSH, NULL);
} else if (!strcmp(method, "TEARDOWN")) {
} else if (!strcmp(method, "TEARDOWN")) {
rtp_end(ctx->rtp);
@@ -546,7 +542,7 @@ static bool handle_rtsp(raop_ctx_t *ctx, int sock)
/*
// need to make sure no search is on-going and reclaim pthread memory
if (ctx->active_remote.handle) close_mDNS(ctx->active_remote.handle);
pthread_join(ctx->search_thread, NULL);
pthread_join(ctx->search_thread, NULL);
memset(&ctx->active_remote, 0, sizeof(ctx->active_remote));
*/