diff --git a/src/main.cpp b/src/main.cpp index cacd3931d..0b5b900e3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -204,6 +204,7 @@ struct state_uv { } } + string capture_device_name; struct vidcap *capture_device; struct display *display_device; @@ -414,17 +415,14 @@ static void usage(const char *exec_path, bool full = false) printf("\n"); } -static void print_fps(bool should_print, steady_clock::time_point &t0, int &frames) { - if (!should_print) { - return; - } - frames += 1; +static void print_fps(steady_clock::time_point *t0, int *frames, const string &name) { + *frames += 1; steady_clock::time_point t1 = steady_clock::now(); - double seconds = duration_cast>(t1 - t0).count(); + double seconds = duration_cast>(t1 - *t0).count(); if (seconds >= 5.0) { - float fps = frames / seconds; - LOG(LOG_LEVEL_INFO) << "[capture] " << frames << " frames in " << seconds << " seconds = " << BOLD(fps << " FPS\n"); - t0 = t1; + double fps = *frames / seconds; + LOG(LOG_LEVEL_INFO) << "[" << name << "] " << frames << " frames in " << seconds << " seconds = " << BOLD(fps << " FPS\n"); + *t0 = t1; frames = 0; } } @@ -457,7 +455,9 @@ static void *capture_thread(void *arg) } if (tx_frame != NULL) { - print_fps(should_print_fps, t0, frames); + if (should_print_fps) { + print_fps(&t0, &frames, uv->capture_device_name); + } //tx_frame = vf_get_copy(tx_frame); bool wait_for_cur_uncompressed_frame; shared_ptr frame; @@ -1397,6 +1397,7 @@ int main(int argc, char *argv[]) } if (video_rxtx_mode & MODE_SENDER) { + uv.capture_device_name = vidcap_params_get_driver(vidcap_params_head); if (pthread_create (&capture_thread_id, NULL, capture_thread, (void *) &uv.root_module) != 0) {