mirror of
https://github.com/pikvm/ustreamer.git
synced 2026-03-15 03:53:43 +00:00
refactoring
This commit is contained in:
@@ -856,8 +856,7 @@ static bool _expose_new_picture_unsafe(struct http_server_t *server) {
|
|||||||
if (
|
if (
|
||||||
EXPOSED(online)
|
EXPOSED(online)
|
||||||
&& EXPOSED(dropped) < server->drop_same_frames
|
&& EXPOSED(dropped) < server->drop_same_frames
|
||||||
&& EXPOSED(picture->used) == STREAM(picture->used)
|
&& picture_compare(EXPOSED(picture), STREAM(picture))
|
||||||
&& !memcmp(EXPOSED(picture->data), STREAM(picture->data), STREAM(picture->used))
|
|
||||||
) {
|
) {
|
||||||
EXPOSED(expose_cmp_time) = get_now_monotonic();
|
EXPOSED(expose_cmp_time) = get_now_monotonic();
|
||||||
EXPOSED(expose_end_time) = EXPOSED(expose_cmp_time);
|
EXPOSED(expose_end_time) = EXPOSED(expose_cmp_time);
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#include "picture.h"
|
#include "picture.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <stdbool.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
@@ -89,3 +90,7 @@ void picture_copy(const struct picture_t *src, struct picture_t *dest) {
|
|||||||
|
|
||||||
# undef COPY
|
# undef COPY
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool picture_compare(const struct picture_t *a, const struct picture_t *b) {
|
||||||
|
return (a->used == b->used && !memcmp(a->data, b->data, b->used));
|
||||||
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
|
||||||
struct picture_t {
|
struct picture_t {
|
||||||
@@ -47,3 +48,4 @@ void picture_set_data(struct picture_t *picture, const unsigned char *data, size
|
|||||||
void picture_append_data(struct picture_t *picture, const unsigned char *data, size_t size);
|
void picture_append_data(struct picture_t *picture, const unsigned char *data, size_t size);
|
||||||
|
|
||||||
void picture_copy(const struct picture_t *src, struct picture_t *dest);
|
void picture_copy(const struct picture_t *src, struct picture_t *dest);
|
||||||
|
bool picture_compare(const struct picture_t *a, const struct picture_t *b);
|
||||||
|
|||||||
Reference in New Issue
Block a user