[libcamera-devel,v1] gstreamer: Convert cm_singleton_ptr to static variable
diff mbox series

Message ID 20210922170619.421818-1-vedantparanjape160201@gmail.com
State Accepted
Commit 8d3d92ea81a1a5e52a27684aee3c4161d7dc96a7
Headers show
Series
  • [libcamera-devel,v1] gstreamer: Convert cm_singleton_ptr to static variable
Related show

Commit Message

Vedant Paranjape Sept. 22, 2021, 5:06 p.m. UTC
The global pointer pointing to libcamera's CameraManager isn't used
outside of the gstlibcamera-utils.cpp compilation unit. Make it static.

Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>
---
 src/gstreamer/gstlibcamera-utils.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Nicolas Dufresne Sept. 22, 2021, 5:37 p.m. UTC | #1
Le mercredi 22 septembre 2021 à 22:36 +0530, Vedant Paranjape a écrit :
> The global pointer pointing to libcamera's CameraManager isn't used
> outside of the gstlibcamera-utils.cpp compilation unit. Make it static.
> 
> Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>

Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>

> ---
>  src/gstreamer/gstlibcamera-utils.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp
> index 0af91c1acb67..c434bca65174 100644
> --- a/src/gstreamer/gstlibcamera-utils.cpp
> +++ b/src/gstreamer/gstlibcamera-utils.cpp
> @@ -223,7 +223,7 @@ gst_libcamera_resume_task(GstTask *task)
>  }
>  
>  G_LOCK_DEFINE_STATIC(cm_singleton_lock);
> -std::weak_ptr<CameraManager> cm_singleton_ptr;
> +static std::weak_ptr<CameraManager> cm_singleton_ptr;
>  
>  std::shared_ptr<CameraManager>
>  gst_libcamera_get_camera_mananger(int &ret)
Jean-Michel Hautbois Sept. 22, 2021, 6:26 p.m. UTC | #2
Hi Vedant,

On 22/09/2021 19:06, Vedant Paranjape wrote:
> The global pointer pointing to libcamera's CameraManager isn't used
> outside of the gstlibcamera-utils.cpp compilation unit. Make it static.
> 
> Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>
> ---
>  src/gstreamer/gstlibcamera-utils.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp
> index 0af91c1acb67..c434bca65174 100644
> --- a/src/gstreamer/gstlibcamera-utils.cpp
> +++ b/src/gstreamer/gstlibcamera-utils.cpp
> @@ -223,7 +223,7 @@ gst_libcamera_resume_task(GstTask *task)
>  }
>  
>  G_LOCK_DEFINE_STATIC(cm_singleton_lock);
> -std::weak_ptr<CameraManager> cm_singleton_ptr;
> +static std::weak_ptr<CameraManager> cm_singleton_ptr;

That's a good catch !
Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>

>  
>  std::shared_ptr<CameraManager>
>  gst_libcamera_get_camera_mananger(int &ret)
>
Umang Jain Sept. 22, 2021, 6:28 p.m. UTC | #3
Hi Vedant,

Thank you for the patch.

On 9/22/21 10:36 PM, Vedant Paranjape wrote:
> The global pointer pointing to libcamera's CameraManager isn't used
> outside of the gstlibcamera-utils.cpp compilation unit. Make it static.
>
> Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>


Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
> ---
>   src/gstreamer/gstlibcamera-utils.cpp | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp
> index 0af91c1acb67..c434bca65174 100644
> --- a/src/gstreamer/gstlibcamera-utils.cpp
> +++ b/src/gstreamer/gstlibcamera-utils.cpp
> @@ -223,7 +223,7 @@ gst_libcamera_resume_task(GstTask *task)
>   }
>   
>   G_LOCK_DEFINE_STATIC(cm_singleton_lock);
> -std::weak_ptr<CameraManager> cm_singleton_ptr;
> +static std::weak_ptr<CameraManager> cm_singleton_ptr;
>   
>   std::shared_ptr<CameraManager>
>   gst_libcamera_get_camera_mananger(int &ret)

Patch
diff mbox series

diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp
index 0af91c1acb67..c434bca65174 100644
--- a/src/gstreamer/gstlibcamera-utils.cpp
+++ b/src/gstreamer/gstlibcamera-utils.cpp
@@ -223,7 +223,7 @@  gst_libcamera_resume_task(GstTask *task)
 }
 
 G_LOCK_DEFINE_STATIC(cm_singleton_lock);
-std::weak_ptr<CameraManager> cm_singleton_ptr;
+static std::weak_ptr<CameraManager> cm_singleton_ptr;
 
 std::shared_ptr<CameraManager>
 gst_libcamera_get_camera_mananger(int &ret)