stop removing the play lock at the end of a play session. That's the job of the rtsp thread.
This commit is contained in:
@@ -1717,7 +1717,7 @@ void player_thread_cleanup_handler(void *arg) {
|
||||
terminate_decoders(conn);
|
||||
|
||||
// reset_anchor_info(conn);
|
||||
release_play_lock(conn);
|
||||
// release_play_lock(conn);
|
||||
conn->rtp_running = 0;
|
||||
pthread_setcancelstate(oldState, NULL);
|
||||
debug(2, "Connection %d: player terminated.", conn->connection_number);
|
||||
|
||||
@@ -1879,6 +1879,7 @@ void handle_get(__attribute((unused)) rtsp_conn_info *conn, __attribute((unused)
|
||||
req->contentlength);
|
||||
resp->respcode = 500;
|
||||
}
|
||||
|
||||
void handle_post(__attribute((unused)) rtsp_conn_info *conn,
|
||||
__attribute((unused)) rtsp_message *req,
|
||||
__attribute((unused)) rtsp_message *resp) {
|
||||
@@ -2480,6 +2481,9 @@ void teardown_phase_two(rtsp_conn_info *conn) {
|
||||
debug(2, "Connection %d: TEARDOWN mdns_update on %s.", conn->connection_number,
|
||||
get_category_string(conn->airplay_stream_category));
|
||||
mdns_update(NULL, secondary_txt_records);
|
||||
debug(1, "Connection %d: TEARDOWN (AP2) release play lock on %s.", conn->connection_number,
|
||||
get_category_string(conn->airplay_stream_category));
|
||||
release_play_lock(conn);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2533,6 +2537,9 @@ void handle_teardown(rtsp_conn_info *conn, __attribute__((unused)) rtsp_message
|
||||
"TEARDOWN: synchronously terminating the player thread of RTSP conversation thread %d (2).",
|
||||
conn->connection_number);
|
||||
player_stop(conn);
|
||||
release_play_lock(conn);
|
||||
debug(1, "TEARDOWN: release play lock on RTSP conversation thread %d.",
|
||||
conn->connection_number);
|
||||
activity_monitor_signify_activity(0); // inactive, and should be after command_stop()
|
||||
debug(3, "TEARDOWN: successful termination of playing thread of RTSP conversation thread %d.",
|
||||
conn->connection_number);
|
||||
@@ -2800,6 +2807,8 @@ void handle_setup_2(rtsp_conn_info *conn, rtsp_message *req, rtsp_message *resp)
|
||||
debug(2, "Connection %d: SETUP mdns_update on %s.", conn->connection_number,
|
||||
get_category_string(conn->airplay_stream_category));
|
||||
mdns_update(NULL, secondary_txt_records);
|
||||
|
||||
|
||||
|
||||
resp->respcode = 200;
|
||||
} else {
|
||||
@@ -2862,6 +2871,9 @@ void handle_setup_2(rtsp_conn_info *conn, rtsp_message *req, rtsp_message *resp)
|
||||
debug(2, "Connection %d: SETUP on %s. A \"streams\" array has been found",
|
||||
conn->connection_number, get_category_string(conn->airplay_stream_category));
|
||||
if (conn->airplay_stream_category == ptp_stream) {
|
||||
debug(1, "Connection %d: SETUP get_play_lock.",
|
||||
conn->connection_number);
|
||||
get_play_lock(conn);
|
||||
// get stream[0]
|
||||
plist_t stream0 = plist_array_get_item(streams, 0);
|
||||
|
||||
@@ -2939,7 +2951,7 @@ void handle_setup_2(rtsp_conn_info *conn, rtsp_message *req, rtsp_message *resp)
|
||||
case 96: {
|
||||
debug(1, "Connection %d. Realtime Audio Stream Detected.", conn->connection_number);
|
||||
debug_log_rtsp_message(2, "Realtime Audio Stream SETUP incoming message", req);
|
||||
get_play_lock(conn);
|
||||
// get_play_lock(conn);
|
||||
conn->airplay_stream_type = realtime_stream;
|
||||
// bind a new UDP port and get a socket
|
||||
conn->local_realtime_audio_port = 0; // any port
|
||||
@@ -2999,7 +3011,7 @@ void handle_setup_2(rtsp_conn_info *conn, rtsp_message *req, rtsp_message *resp)
|
||||
debug(1, "SETUP on Connection %d. Buffered Audio Stream Detected.",
|
||||
conn->connection_number);
|
||||
debug_log_rtsp_message(2, "Buffered Audio Stream SETUP incoming message", req);
|
||||
get_play_lock(conn);
|
||||
// get_play_lock(conn);
|
||||
conn->airplay_stream_type = buffered_stream;
|
||||
// get needed stuff
|
||||
|
||||
@@ -3229,7 +3241,7 @@ void handle_set_parameter_parameter(rtsp_conn_info *conn, rtsp_message *req,
|
||||
|
||||
if (!strncmp(cp, "volume: ", strlen("volume: "))) {
|
||||
float volume = atof(cp + strlen("volume: "));
|
||||
debug(2, "Connection %d: request to set AirPlay Volume to: %f.", conn->connection_number,
|
||||
debug(1, "Connection %d: request to set AirPlay Volume to: %f.", conn->connection_number,
|
||||
volume);
|
||||
// if we are playing, go ahead and change the volume
|
||||
if (try_to_hold_play_lock(conn) == 0) {
|
||||
@@ -3969,7 +3981,7 @@ static void handle_get_parameter(__attribute__((unused)) rtsp_conn_info *conn, r
|
||||
|
||||
if ((req->content) && (req->contentlength == strlen("volume\r\n")) &&
|
||||
strstr(req->content, "volume") == req->content) {
|
||||
debug(2, "Connection %d: Current volume (%.6f) requested", conn->connection_number,
|
||||
debug(1, "Connection %d: Current volume (%.6f) requested", conn->connection_number,
|
||||
config.airplay_volume);
|
||||
char *p = malloc(128); // will be automatically deallocated with the response is deleted
|
||||
if (p) {
|
||||
@@ -4078,6 +4090,7 @@ static void handle_set_parameter(rtsp_conn_info *conn, rtsp_message *req, rtsp_m
|
||||
|
||||
static void handle_announce(rtsp_conn_info *conn, rtsp_message *req, rtsp_message *resp) {
|
||||
debug(3, "Connection %d: ANNOUNCE", conn->connection_number);
|
||||
debug(1, "Connection %d: ANNOUNCE get_play_lock()", conn->connection_number);
|
||||
int get_play_status = get_play_lock(conn);
|
||||
if (get_play_status != -1) {
|
||||
debug(3, "Connection %d: ANNOUNCE has acquired play lock.", conn->connection_number);
|
||||
|
||||
Reference in New Issue
Block a user