mirror of
https://github.com/pikvm/ustreamer.git
synced 2026-02-18 02:55:46 +00:00
removed old fps regulation for jpeg encoders
This commit is contained in:
parent
de2cfa36e1
commit
ec2e6c313b
@ -162,14 +162,8 @@ void us_encoder_open(us_encoder_s *enc, us_capture_s *cap) {
|
|||||||
run->quality = quality;
|
run->quality = quality;
|
||||||
US_MUTEX_UNLOCK(run->mutex);
|
US_MUTEX_UNLOCK(run->mutex);
|
||||||
|
|
||||||
const ldf desired_interval = (
|
|
||||||
cap->desired_fps > 0 && (cap->desired_fps < cap->run->hw_fps || cap->run->hw_fps == 0)
|
|
||||||
? (ldf)1 / cap->desired_fps
|
|
||||||
: 0
|
|
||||||
);
|
|
||||||
|
|
||||||
enc->run->pool = us_workers_pool_init(
|
enc->run->pool = us_workers_pool_init(
|
||||||
"JPEG", "jw", n_workers, desired_interval,
|
"JPEG", "jw", n_workers,
|
||||||
_worker_job_init, (void*)enc,
|
_worker_job_init, (void*)enc,
|
||||||
_worker_job_destroy,
|
_worker_job_destroy,
|
||||||
_worker_run_job);
|
_worker_run_job);
|
||||||
|
|||||||
@ -37,7 +37,7 @@ static void *_worker_thread(void *v_worker);
|
|||||||
|
|
||||||
|
|
||||||
us_workers_pool_s *us_workers_pool_init(
|
us_workers_pool_s *us_workers_pool_init(
|
||||||
const char *name, const char *wr_prefix, uint n_workers, ldf desired_interval,
|
const char *name, const char *wr_prefix, uint n_workers,
|
||||||
us_workers_pool_job_init_f job_init, void *job_init_arg,
|
us_workers_pool_job_init_f job_init, void *job_init_arg,
|
||||||
us_workers_pool_job_destroy_f job_destroy,
|
us_workers_pool_job_destroy_f job_destroy,
|
||||||
us_workers_pool_run_job_f run_job) {
|
us_workers_pool_run_job_f run_job) {
|
||||||
@ -47,7 +47,6 @@ us_workers_pool_s *us_workers_pool_init(
|
|||||||
us_workers_pool_s *pool;
|
us_workers_pool_s *pool;
|
||||||
US_CALLOC(pool, 1);
|
US_CALLOC(pool, 1);
|
||||||
pool->name = name;
|
pool->name = name;
|
||||||
pool->desired_interval = desired_interval;
|
|
||||||
pool->job_destroy = job_destroy;
|
pool->job_destroy = job_destroy;
|
||||||
pool->run_job = run_job;
|
pool->run_job = run_job;
|
||||||
|
|
||||||
@ -147,14 +146,8 @@ ldf us_workers_pool_get_fluency_delay(us_workers_pool_s *pool, const us_worker_s
|
|||||||
|
|
||||||
pool->approx_job_time = approx_job_time;
|
pool->approx_job_time = approx_job_time;
|
||||||
|
|
||||||
const ldf min_delay = pool->approx_job_time / pool->n_workers; // Среднее время работы размазывается на N воркеров
|
// Среднее время работы размазывается на N воркеров
|
||||||
|
return (pool->approx_job_time / pool->n_workers);
|
||||||
if (pool->desired_interval > 0 && min_delay > 0 && pool->desired_interval > min_delay) {
|
|
||||||
// Искусственное время задержки на основе желаемого FPS, если включен --desired-fps
|
|
||||||
// и аппаратный fps не попадает точно в желаемое значение
|
|
||||||
return pool->desired_interval;
|
|
||||||
}
|
|
||||||
return min_delay;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *_worker_thread(void *v_worker) {
|
static void *_worker_thread(void *v_worker) {
|
||||||
|
|||||||
@ -56,7 +56,6 @@ typedef bool (*us_workers_pool_run_job_f)(us_worker_s *wr);
|
|||||||
|
|
||||||
typedef struct us_workers_pool_sx {
|
typedef struct us_workers_pool_sx {
|
||||||
const char *name;
|
const char *name;
|
||||||
ldf desired_interval;
|
|
||||||
|
|
||||||
us_workers_pool_job_destroy_f job_destroy;
|
us_workers_pool_job_destroy_f job_destroy;
|
||||||
us_workers_pool_run_job_f run_job;
|
us_workers_pool_run_job_f run_job;
|
||||||
@ -76,7 +75,7 @@ typedef struct us_workers_pool_sx {
|
|||||||
|
|
||||||
|
|
||||||
us_workers_pool_s *us_workers_pool_init(
|
us_workers_pool_s *us_workers_pool_init(
|
||||||
const char *name, const char *wr_prefix, uint n_workers, ldf desired_interval,
|
const char *name, const char *wr_prefix, uint n_workers,
|
||||||
us_workers_pool_job_init_f job_init, void *job_init_arg,
|
us_workers_pool_job_init_f job_init, void *job_init_arg,
|
||||||
us_workers_pool_job_destroy_f job_destroy,
|
us_workers_pool_job_destroy_f job_destroy,
|
||||||
us_workers_pool_run_job_f run_job);
|
us_workers_pool_run_job_f run_job);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user