Stop using the flush and data resumption as proxies for pause and resume. Add (true) pause and resume to buffered audio streams.
This commit is contained in:
+5
-1
@@ -568,6 +568,7 @@ void metadata_hub_process_metadata(uint32_t type, uint32_t code, char *data, uin
|
||||
changed = (metadata_store.active_state != AM_INACTIVE);
|
||||
metadata_store.active_state = AM_INACTIVE;
|
||||
break;
|
||||
case 'pres':
|
||||
case 'pbeg':
|
||||
changed = ((metadata_store.player_state != PS_PLAYING) ||
|
||||
(metadata_store.player_thread_active == 0));
|
||||
@@ -580,15 +581,18 @@ void metadata_hub_process_metadata(uint32_t type, uint32_t code, char *data, uin
|
||||
metadata_store.player_state = PS_STOPPED;
|
||||
metadata_store.player_thread_active = 0;
|
||||
break;
|
||||
case 'pfls':
|
||||
case 'paus':
|
||||
changed = (metadata_store.player_state != PS_PAUSED);
|
||||
metadata_store.player_state = PS_PAUSED;
|
||||
break;
|
||||
/*
|
||||
// not using this anymore.
|
||||
case 'pffr': // this is sent when the first frame has been received
|
||||
case 'prsm':
|
||||
changed = (metadata_store.player_state != PS_PLAYING);
|
||||
metadata_store.player_state = PS_PLAYING;
|
||||
break;
|
||||
*/
|
||||
case 'pvol': {
|
||||
// Note: it's assumed that the config.airplay volume has already been correctly set.
|
||||
// int32_t actual_volume;
|
||||
|
||||
@@ -1157,7 +1157,6 @@ static abuf_t *buffer_get_frame(rtsp_conn_info *conn) {
|
||||
conn->connection_number, conn->first_packet_timestamp, lt * 0.000000001);
|
||||
#ifdef CONFIG_METADATA
|
||||
// say we have started receiving frames here
|
||||
debug(2, "pffr");
|
||||
send_ssnc_metadata(
|
||||
'pffr', NULL, 0,
|
||||
0); // "first frame received", but don't wait if the queue is locked
|
||||
@@ -1303,7 +1302,6 @@ static abuf_t *buffer_get_frame(rtsp_conn_info *conn) {
|
||||
}
|
||||
#ifdef CONFIG_METADATA
|
||||
if (conn->ab_buffering == 0) {
|
||||
debug(2, "prsm");
|
||||
send_ssnc_metadata('prsm', NULL, 0,
|
||||
0); // "resume", but don't wait if the queue is locked
|
||||
}
|
||||
@@ -3388,7 +3386,6 @@ void player_flush(uint32_t timestamp, rtsp_conn_info *conn) {
|
||||
// only send a flush metadata message if the first packet has been seen -- it's a bogus message
|
||||
// otherwise
|
||||
if (conn->first_packet_timestamp) {
|
||||
debug(2, "pfls");
|
||||
char numbuf[32];
|
||||
snprintf(numbuf, sizeof(numbuf), "%u", timestamp);
|
||||
send_ssnc_metadata('pfls', numbuf, strlen(numbuf), 1); // contains cancellation points
|
||||
@@ -3458,7 +3455,6 @@ int player_play(rtsp_conn_info *conn) {
|
||||
debug(1, "Error creating player_thread: %s", strerror(errno));
|
||||
|
||||
#ifdef CONFIG_METADATA
|
||||
debug(2, "pbeg");
|
||||
send_ssnc_metadata('pbeg', NULL, 0, 1); // contains cancellation points
|
||||
#endif
|
||||
return 0;
|
||||
@@ -3484,7 +3480,6 @@ int player_stop(rtsp_conn_info *conn) {
|
||||
free(conn->player_thread);
|
||||
conn->player_thread = NULL;
|
||||
#ifdef CONFIG_METADATA
|
||||
debug(2, "pend");
|
||||
send_ssnc_metadata('pend', NULL, 0, 1); // contains cancellation points
|
||||
#endif
|
||||
// debuglev = dl;
|
||||
|
||||
@@ -2001,13 +2001,20 @@ void handle_setrateanchori(rtsp_conn_info *conn, rtsp_message *req, rtsp_message
|
||||
debug(2, "Connection %d: Start playing, with anchor clock %" PRIx64 ".",
|
||||
conn->connection_number, conn->networkTimeTimelineID);
|
||||
activity_monitor_signify_activity(1);
|
||||
|
||||
#ifdef CONFIG_METADATA
|
||||
send_ssnc_metadata('pres', NULL, 0, 1); // resume -- contains cancellation points
|
||||
#endif
|
||||
conn->ap2_play_enabled = 1;
|
||||
} else {
|
||||
debug(2, "Connection %d: Stop playing.", conn->connection_number);
|
||||
activity_monitor_signify_activity(0);
|
||||
conn->ap2_play_enabled = 0;
|
||||
activity_monitor_signify_activity(0);
|
||||
reset_anchor_info(conn);
|
||||
if (config.output->stop) {
|
||||
#ifdef CONFIG_METADATA
|
||||
send_ssnc_metadata('paus', NULL, 0, 1); // pause -- contains cancellation points
|
||||
#endif
|
||||
if (config.output->stop) {
|
||||
debug(2, "Connection %d: Stop the output backend.", conn->connection_number);
|
||||
config.output->stop();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user