Pipewireパッケージ(ちょっと変更)
修訂 | 4823e573dcc3131e458310b1fdcb7a148d3db294 (tree) |
---|---|
時間 | 2023-09-27 02:11:08 |
作者 | Christian Glombek <lorbus@fedo...> |
Commiter | Christian Glombek |
module-raop-sink: Send POST /feedback every 2 seconds
@@ -236,6 +236,7 @@ struct impl { | ||
236 | 236 | uint16_t control_port; |
237 | 237 | int control_fd; |
238 | 238 | struct spa_source *control_source; |
239 | + struct spa_source *feedback_timer; | |
239 | 240 | |
240 | 241 | uint16_t timing_port; |
241 | 242 | int timing_fd; |
@@ -984,6 +985,14 @@ static int rtsp_send_volume(struct impl *impl) | ||
984 | 985 | return rtsp_send(impl, "SET_PARAMETER", "text/parameters", header, rtsp_log_reply_status); |
985 | 986 | } |
986 | 987 | |
988 | +static void rtsp_do_post_feedback(void *data, uint64_t expirations) | |
989 | +{ | |
990 | + struct impl *impl = data; | |
991 | + | |
992 | + pw_rtsp_client_url_send(impl->rtsp, "/feedback", "POST", &impl->headers->dict, | |
993 | + NULL, NULL, 0, rtsp_log_reply_status, impl); | |
994 | +} | |
995 | + | |
987 | 996 | static int rtsp_record_reply(void *data, int status, const struct spa_dict *headers, const struct pw_array *content) |
988 | 997 | { |
989 | 998 | struct impl *impl = data; |
@@ -994,9 +1003,19 @@ static int rtsp_record_reply(void *data, int status, const struct spa_dict *head | ||
994 | 1003 | struct spa_pod_builder b; |
995 | 1004 | struct spa_latency_info latency; |
996 | 1005 | char progress[128]; |
1006 | + struct timespec timeout, interval; | |
997 | 1007 | |
998 | 1008 | pw_log_info("record status: %d", status); |
999 | 1009 | |
1010 | + timeout.tv_sec = 2; | |
1011 | + timeout.tv_nsec = 0; | |
1012 | + interval.tv_sec = 2; | |
1013 | + interval.tv_nsec = 0; | |
1014 | + | |
1015 | + if (!impl->feedback_timer) | |
1016 | + impl->feedback_timer = pw_loop_add_timer(impl->loop, rtsp_do_post_feedback, impl); | |
1017 | + pw_loop_update_timer(impl->loop, impl->feedback_timer, &timeout, &interval, false); | |
1018 | + | |
1000 | 1019 | if ((str = spa_dict_lookup(headers, "Audio-Latency")) != NULL) { |
1001 | 1020 | uint32_t l; |
1002 | 1021 | if (spa_atou32(str, &l, 0)) |
@@ -1574,6 +1593,10 @@ static void connection_cleanup(struct impl *impl) | ||
1574 | 1593 | close(impl->timing_fd); |
1575 | 1594 | impl->timing_fd = -1; |
1576 | 1595 | } |
1596 | + if (impl->feedback_timer != NULL) { | |
1597 | + pw_loop_destroy_source(impl->loop, impl->feedback_timer); | |
1598 | + impl->feedback_timer = NULL; | |
1599 | + } | |
1577 | 1600 | free(impl->auth_method); |
1578 | 1601 | impl->auth_method = NULL; |
1579 | 1602 | free(impl->realm); |