mirror of
https://github.com/pikvm/ustreamer.git
synced 2026-02-18 02:55:46 +00:00
refactoring
This commit is contained in:
parent
099bb85d66
commit
0a5bf0411b
@ -66,7 +66,7 @@ static boolean _jpeg_empty_output_buffer(j_compress_ptr jpeg);
|
||||
static void _jpeg_term_destination(j_compress_ptr jpeg);
|
||||
|
||||
|
||||
unsigned long jpeg_compress_buffer(struct device_t *dev, int index) {
|
||||
void jpeg_compress_buffer(struct device_t *dev, int index) {
|
||||
// This function based on compress_image_to_jpeg() from mjpg-streamer
|
||||
|
||||
struct jpeg_compress_struct jpeg;
|
||||
@ -107,7 +107,6 @@ unsigned long jpeg_compress_buffer(struct device_t *dev, int index) {
|
||||
jpeg_destroy_compress(&jpeg);
|
||||
free(line_buffer);
|
||||
assert(dev->run->pictures[index].size > 0);
|
||||
return dev->run->pictures[index].size;
|
||||
}
|
||||
|
||||
static void _jpeg_set_dest_picture(j_compress_ptr jpeg, unsigned char *picture, unsigned long *written) {
|
||||
|
||||
@ -26,4 +26,4 @@
|
||||
#include "device.h"
|
||||
|
||||
|
||||
unsigned long jpeg_compress_buffer(struct device_t *dev, int index);
|
||||
void jpeg_compress_buffer(struct device_t *dev, int index);
|
||||
|
||||
@ -390,7 +390,6 @@ static void *_stream_worker_thread(void *v_ctx) {
|
||||
A_PTHREAD_M_UNLOCK(ctx->has_job_mutex);
|
||||
|
||||
if (!*ctx->workers_stop) {
|
||||
unsigned long compressed;
|
||||
time_t start_sec;
|
||||
time_t stop_sec;
|
||||
long start_msec;
|
||||
@ -401,7 +400,7 @@ static void *_stream_worker_thread(void *v_ctx) {
|
||||
|
||||
LOG_DEBUG("Worker %d compressing JPEG ...", ctx->index);
|
||||
|
||||
compressed = jpeg_compress_buffer(ctx->dev, ctx->index);
|
||||
jpeg_compress_buffer(ctx->dev, ctx->index);
|
||||
|
||||
if (_stream_release_buffer(ctx->dev, &ctx->buf_info) == 0) {
|
||||
*ctx->has_job = false;
|
||||
@ -417,7 +416,10 @@ static void *_stream_worker_thread(void *v_ctx) {
|
||||
*ctx->last_comp_time = last_comp_time;
|
||||
A_PTHREAD_M_UNLOCK(ctx->last_comp_time_mutex);
|
||||
|
||||
LOG_PERF("Compressed JPEG size=%ld; time=%0.3Lf (worker %d)", compressed, last_comp_time, ctx->index);
|
||||
LOG_PERF(
|
||||
"Compressed JPEG size=%ld; time=%0.3Lf (worker %d)",
|
||||
ctx->dev->run->pictures[ctx->index].size, last_comp_time, ctx->index
|
||||
);
|
||||
} else {
|
||||
*ctx->job_failed = true;
|
||||
*ctx->has_job = false;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user