Skip to content

Commit

Permalink
display/conference: Fix behaviour when fps is unspecified
Browse files Browse the repository at this point in the history
  • Loading branch information
mpiatka committed May 27, 2024
1 parent 49c9d24 commit 05fb0a5
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/video_display/conference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ struct state_conference_common{
struct module *parent = nullptr;
module_raii mod;

double req_fps = 0;
struct video_desc desc = {};
Video_mixer::Layout layout = Video_mixer::Layout::Tiled;

Expand Down Expand Up @@ -506,7 +507,9 @@ static void *display_conference_init(struct module *parent, const char *fmt, uns
FAIL_IF(!parse_num(tokenize(conf_cfg, ':'), desc.height), "Failed to parse height\n");

auto tok = tokenize(conf_cfg, ':');
FAIL_IF(!tok.empty() && !parse_num(tokenize(tok, ':'), desc.fps), "Failed to parse fps\n");
FAIL_IF(!tok.empty() && !parse_num(tokenize(tok, ':'), s->common->req_fps), "Failed to parse fps\n");

desc.fps = s->common->req_fps;

tok = tokenize(conf_cfg, ':');
if(tok == "one_big"){
Expand Down Expand Up @@ -537,6 +540,12 @@ static void display_conference_worker(std::shared_ptr<state_conference_common> s
PROFILE_FUNC;
Video_mixer mixer(s->desc.width, s->desc.height, s->layout);

/**
* We initially set next_frame_time to infinity (or a very long time
* from now) to avoid uselessly outputing the same frame twice in a row
* if we haven't received any new input, because then any new input
* would have to wait up to 1 frametime adding needless latency.
*/
auto next_frame_time = clock::now() + std::chrono::hours(1); //workaround for gcc bug 58931
auto last_frame_time = clock::time_point::min();
for(;;){
Expand Down Expand Up @@ -603,6 +612,9 @@ static void display_conference_worker(std::shared_ptr<state_conference_common> s
display_put_frame(s->real_display.get(), nullptr, PUTF_BLOCKING);
break;
}
if(s->req_fps <= 0){
s->desc.fps = std::max(s->desc.fps, frame->fps);
}
mixer.process_frame(std::move(frame));
}

Expand Down

0 comments on commit 05fb0a5

Please sign in to comment.