Browse Source

Don't update metadata faster than the framerate

Martijn Braam 1 year ago
parent
commit
4032b53592
1 changed files with 7 additions and 0 deletions
  1. 7 0
      src/io_pipeline.c

+ 7 - 0
src/io_pipeline.c

@@ -21,6 +21,7 @@ MPCamera *mpcamera = NULL;
 
 static MPPipeline *pipeline;
 static GSource *capture_source;
+static bool pipeline_changed = true;
 
 static void
 setup(MPPipeline *pipeline, const void *data)
@@ -52,6 +53,10 @@ mp_io_pipeline_stop()
 static void
 update_process_pipeline()
 {
+        if (!pipeline_changed) {
+                return;
+        }
+        pipeline_changed = false;
         // Grab the latest control values
         if (!state_io.gain.manual && state_io.gain.control) {
                 state_io.gain.value = mp_camera_control_get_int32(
@@ -268,6 +273,8 @@ on_frame(MPBuffer buffer, void *_data)
                 return;
         }
 
+        pipeline_changed = true;
+
         // Only update controls right after a frame was captured
         do_aaa();
         update_controls();