mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-31 22:25:33 -04:00
raop: Do not send audio before RECORD response
This patch prevents audio packets to be sent before the server respond to the RECORD command.
This commit is contained in:
parent
29385da239
commit
604bf450dc
3 changed files with 28 additions and 4 deletions
|
|
@ -310,7 +310,7 @@ static int udp_sink_process_msg(pa_msgobject *o, int code, void *data, int64_t o
|
||||||
pa_log_debug("RAOP: SUSPENDED");
|
pa_log_debug("RAOP: SUSPENDED");
|
||||||
pa_smoother_pause(u->smoother, pa_rtclock_now());
|
pa_smoother_pause(u->smoother, pa_rtclock_now());
|
||||||
|
|
||||||
if (pa_raop_client_udp_can_stream(u->raop)) {
|
if (pa_raop_client_udp_is_alive(u->raop)) {
|
||||||
/* Issue a TEARDOWN if we are still connected. */
|
/* Issue a TEARDOWN if we are still connected. */
|
||||||
pa_raop_client_teardown(u->raop);
|
pa_raop_client_teardown(u->raop);
|
||||||
}
|
}
|
||||||
|
|
@ -756,10 +756,10 @@ static void udp_thread_func(struct userdata *u) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pa_raop_client_udp_can_stream(u->raop))
|
|
||||||
continue;
|
|
||||||
if (u->sink->thread_info.state != PA_SINK_RUNNING)
|
if (u->sink->thread_info.state != PA_SINK_RUNNING)
|
||||||
continue;
|
continue;
|
||||||
|
if (!pa_raop_client_udp_can_stream(u->raop))
|
||||||
|
continue;
|
||||||
|
|
||||||
if (u->encoded_memchunk.length <= 0) {
|
if (u->encoded_memchunk.length <= 0) {
|
||||||
if (u->encoded_memchunk.memblock != NULL)
|
if (u->encoded_memchunk.memblock != NULL)
|
||||||
|
|
|
||||||
|
|
@ -146,6 +146,8 @@ struct pa_raop_client {
|
||||||
|
|
||||||
uint32_t udp_ssrc;
|
uint32_t udp_ssrc;
|
||||||
|
|
||||||
|
bool is_recording;
|
||||||
|
|
||||||
bool udp_first_packet;
|
bool udp_first_packet;
|
||||||
uint32_t udp_sync_interval;
|
uint32_t udp_sync_interval;
|
||||||
uint32_t udp_sync_count;
|
uint32_t udp_sync_count;
|
||||||
|
|
@ -950,6 +952,8 @@ static void udp_rtsp_cb(pa_rtsp_client *rtsp, pa_rtsp_state state, pa_headerlist
|
||||||
|
|
||||||
pa_log_debug("RAOP: RECORD");
|
pa_log_debug("RAOP: RECORD");
|
||||||
|
|
||||||
|
c->is_recording = true;
|
||||||
|
|
||||||
alt = pa_xstrdup(pa_headerlist_gets(headers, "Audio-Latency"));
|
alt = pa_xstrdup(pa_headerlist_gets(headers, "Audio-Latency"));
|
||||||
/* Generate a random synchronization source identifier from this session. */
|
/* Generate a random synchronization source identifier from this session. */
|
||||||
pa_random(&rand, sizeof(rand));
|
pa_random(&rand, sizeof(rand));
|
||||||
|
|
@ -976,6 +980,8 @@ static void udp_rtsp_cb(pa_rtsp_client *rtsp, pa_rtsp_state state, pa_headerlist
|
||||||
case STATE_FLUSH: {
|
case STATE_FLUSH: {
|
||||||
pa_log_debug("RAOP: FLUSHED");
|
pa_log_debug("RAOP: FLUSHED");
|
||||||
|
|
||||||
|
c->is_recording = false;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -984,6 +990,8 @@ static void udp_rtsp_cb(pa_rtsp_client *rtsp, pa_rtsp_state state, pa_headerlist
|
||||||
pa_assert(c->udp_disconnected_callback);
|
pa_assert(c->udp_disconnected_callback);
|
||||||
pa_assert(c->rtsp);
|
pa_assert(c->rtsp);
|
||||||
|
|
||||||
|
c->is_recording = false;
|
||||||
|
|
||||||
pa_rtsp_disconnect(c->rtsp);
|
pa_rtsp_disconnect(c->rtsp);
|
||||||
|
|
||||||
if (c->udp_stream_fd > 0) {
|
if (c->udp_stream_fd > 0) {
|
||||||
|
|
@ -1084,6 +1092,8 @@ pa_raop_client* pa_raop_client_new(pa_core *core, const char *host, pa_raop_prot
|
||||||
else
|
else
|
||||||
c->port = DEFAULT_RAOP_PORT;
|
c->port = DEFAULT_RAOP_PORT;
|
||||||
|
|
||||||
|
c->is_recording = false;
|
||||||
|
|
||||||
c->udp_first_packet = true;
|
c->udp_first_packet = true;
|
||||||
|
|
||||||
ss = core->default_sample_spec;
|
ss = core->default_sample_spec;
|
||||||
|
|
@ -1151,6 +1161,8 @@ int pa_raop_client_connect(pa_raop_client *c) {
|
||||||
else
|
else
|
||||||
pa_rtsp_set_callback(c->rtsp, udp_rtsp_cb, c);
|
pa_rtsp_set_callback(c->rtsp, udp_rtsp_cb, c);
|
||||||
|
|
||||||
|
c->is_recording = false;
|
||||||
|
|
||||||
return pa_rtsp_connect(c->rtsp);
|
return pa_rtsp_connect(c->rtsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1177,7 +1189,7 @@ int pa_raop_client_teardown(pa_raop_client *c) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pa_raop_client_udp_can_stream(pa_raop_client *c) {
|
int pa_raop_client_udp_is_alive(pa_raop_client *c) {
|
||||||
int rv = 0;
|
int rv = 0;
|
||||||
|
|
||||||
pa_assert(c);
|
pa_assert(c);
|
||||||
|
|
@ -1188,6 +1200,17 @@ int pa_raop_client_udp_can_stream(pa_raop_client *c) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int pa_raop_client_udp_can_stream(pa_raop_client *c) {
|
||||||
|
int rv = 0;
|
||||||
|
|
||||||
|
pa_assert(c);
|
||||||
|
|
||||||
|
if (c->is_recording && c->udp_stream_fd > 0)
|
||||||
|
rv = 1;
|
||||||
|
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
int pa_raop_client_udp_handle_timing_packet(pa_raop_client *c, const uint8_t packet[], ssize_t size) {
|
int pa_raop_client_udp_handle_timing_packet(pa_raop_client *c, const uint8_t packet[], ssize_t size) {
|
||||||
const uint32_t * data = NULL;
|
const uint32_t * data = NULL;
|
||||||
uint8_t payload = 0;
|
uint8_t payload = 0;
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ int pa_raop_client_connect(pa_raop_client *c);
|
||||||
int pa_raop_client_flush(pa_raop_client *c);
|
int pa_raop_client_flush(pa_raop_client *c);
|
||||||
int pa_raop_client_teardown(pa_raop_client *c);
|
int pa_raop_client_teardown(pa_raop_client *c);
|
||||||
|
|
||||||
|
int pa_raop_client_udp_is_alive(pa_raop_client *c);
|
||||||
int pa_raop_client_udp_can_stream(pa_raop_client *c);
|
int pa_raop_client_udp_can_stream(pa_raop_client *c);
|
||||||
|
|
||||||
void pa_raop_client_set_encryption(pa_raop_client *c, int encryption);
|
void pa_raop_client_set_encryption(pa_raop_client *c, int encryption);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue