mirror of
https://github.com/pikvm/ustreamer.git
synced 2026-03-12 02:23:43 +00:00
show fps in /ping
This commit is contained in:
@@ -168,10 +168,10 @@ static void _http_callback_ping(struct evhttp_request *request, void *v_server)
|
|||||||
assert(evbuffer_add_printf(buf,
|
assert(evbuffer_add_printf(buf,
|
||||||
"{\"stream\": {\"resolution\":"
|
"{\"stream\": {\"resolution\":"
|
||||||
" {\"width\": %u, \"height\": %u},"
|
" {\"width\": %u, \"height\": %u},"
|
||||||
" \"online\": %s}}",
|
" \"fps\": %u, \"online\": %s}}",
|
||||||
(server->fake_width ? server->fake_width : server->run->exposed->width),
|
(server->fake_width ? server->fake_width : server->run->exposed->width),
|
||||||
(server->fake_height ? server->fake_height : server->run->exposed->height),
|
(server->fake_height ? server->fake_height : server->run->exposed->height),
|
||||||
(server->run->exposed->online ? "true" : "false")
|
server->run->exposed->fps, (server->run->exposed->online ? "true" : "false")
|
||||||
));
|
));
|
||||||
ADD_HEADER("Content-Type", "application/json");
|
ADD_HEADER("Content-Type", "application/json");
|
||||||
evhttp_send_reply(request, HTTP_OK, "OK", buf);
|
evhttp_send_reply(request, HTTP_OK, "OK", buf);
|
||||||
@@ -379,6 +379,7 @@ void _expose_new_picture(struct http_server_t *server) {
|
|||||||
server->run->exposed->picture.size = server->run->stream->picture.size;
|
server->run->exposed->picture.size = server->run->stream->picture.size;
|
||||||
server->run->exposed->width = server->run->stream->width;
|
server->run->exposed->width = server->run->stream->width;
|
||||||
server->run->exposed->height = server->run->stream->height;
|
server->run->exposed->height = server->run->stream->height;
|
||||||
|
server->run->exposed->fps = server->run->stream->fps;
|
||||||
server->run->exposed->online = true;
|
server->run->exposed->online = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -397,6 +398,7 @@ void _expose_blank_picture(struct http_server_t *server) {
|
|||||||
server->run->exposed->picture.size = BLANK_JPG_SIZE;
|
server->run->exposed->picture.size = BLANK_JPG_SIZE;
|
||||||
server->run->exposed->width = BLANK_JPG_WIDTH;
|
server->run->exposed->width = BLANK_JPG_WIDTH;
|
||||||
server->run->exposed->height = BLANK_JPG_HEIGHT;
|
server->run->exposed->height = BLANK_JPG_HEIGHT;
|
||||||
|
server->run->exposed->fps = 0;
|
||||||
server->run->exposed->online = false;
|
server->run->exposed->online = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ struct exposed_t {
|
|||||||
struct picture_t picture;
|
struct picture_t picture;
|
||||||
unsigned width;
|
unsigned width;
|
||||||
unsigned height;
|
unsigned height;
|
||||||
|
unsigned fps;
|
||||||
bool online;
|
bool online;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
13
src/stream.c
13
src/stream.c
@@ -197,14 +197,13 @@ void stream_loop(struct stream_t *stream) {
|
|||||||
}
|
}
|
||||||
fluency_passed = 0;
|
fluency_passed = 0;
|
||||||
|
|
||||||
if (log_level >= LOG_LEVEL_PERF) {
|
if ((long long)now != fps_second) {
|
||||||
if ((long long)now != fps_second) {
|
LOG_PERF("Oldest worker complete, encoding FPS = %u", fps);
|
||||||
LOG_PERF("Oldest worker complete, encoding FPS = %u", fps);
|
stream->fps = fps;
|
||||||
fps = 0;
|
fps = 0;
|
||||||
fps_second = (long long)now;
|
fps_second = (long long)now;
|
||||||
}
|
|
||||||
++fps;
|
|
||||||
}
|
}
|
||||||
|
++fps;
|
||||||
|
|
||||||
long double fluency_delay = _stream_get_fluency_delay(stream->dev, &pool);
|
long double fluency_delay = _stream_get_fluency_delay(stream->dev, &pool);
|
||||||
|
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ struct stream_t {
|
|||||||
struct picture_t picture;
|
struct picture_t picture;
|
||||||
unsigned width;
|
unsigned width;
|
||||||
unsigned height;
|
unsigned height;
|
||||||
|
unsigned fps;
|
||||||
bool updated;
|
bool updated;
|
||||||
pthread_mutex_t mutex;
|
pthread_mutex_t mutex;
|
||||||
struct device_t *dev;
|
struct device_t *dev;
|
||||||
|
|||||||
Reference in New Issue
Block a user