rpicamsrc: Destroy mmal pool on shutdown always.
authorJan Schmidt <jan@centricular.com>
Sat, 8 Oct 2016 11:10:30 +0000 (11:10 +0000)
committerTim-Philipp Müller <tim@centricular.com>
Fri, 10 Jul 2020 15:45:52 +0000 (16:45 +0100)
Avoid hangs on the next run because we didn't clean up the mmal pool
last time we shutdown.

sys/rpicamsrc/RaspiCapture.c

index b3608ca..8065e70 100644 (file)
@@ -1561,13 +1561,14 @@ static void destroy_encoder_component(RASPIVID_STATE *state)
       }
    }
 
+   // Get rid of any port buffers first
+   if (state->encoder_pool)
+   {
+      mmal_port_pool_destroy(state->encoder_output_port, state->encoder_pool);
+      state->encoder_pool = NULL;
+   }
+
    if (state->encoder_component) {
-      // Get rid of any port buffers first
-      if (state->encoder_pool)
-      {
-         mmal_port_pool_destroy(state->encoder_component->output[0], state->encoder_pool);
-         state->encoder_pool = NULL;
-      }
 
       mmal_component_destroy(state->encoder_component);
       state->encoder_component = NULL;