mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-31 11:32:38 +00:00
camerabin: application element memory leak fixes
If videobin/imagebin was never set to READY state the ownership of elements created and set by application were never taken by bin and therefore gst_object_sink is called for these elements before unreffing (they may still be in floating state and not unreffed properly without sinking first)
This commit is contained in:
parent
a11b314b1e
commit
7e9fb16c48
2 changed files with 19 additions and 0 deletions
|
@ -196,7 +196,14 @@ gst_camerabin_image_dispose (GstCameraBinImage * img)
|
|||
}
|
||||
|
||||
|
||||
/* Note: if imagebin was never set to READY state the
|
||||
ownership of elements created by application were never
|
||||
taken by bin and therefore gst_object_sink is called for
|
||||
these elements (they may still be in floating state
|
||||
and not unreffed properly without sinking first)
|
||||
*/
|
||||
if (img->app_enc) {
|
||||
gst_object_sink (img->app_enc);
|
||||
GST_LOG_OBJECT (img, "disposing %s with refcount %d",
|
||||
GST_ELEMENT_NAME (img->app_enc),
|
||||
GST_OBJECT_REFCOUNT_VALUE (img->app_enc));
|
||||
|
@ -205,6 +212,7 @@ gst_camerabin_image_dispose (GstCameraBinImage * img)
|
|||
}
|
||||
|
||||
if (img->post) {
|
||||
gst_object_sink (img->post);
|
||||
GST_LOG_OBJECT (img, "disposing %s with refcount %d",
|
||||
GST_ELEMENT_NAME (img->post), GST_OBJECT_REFCOUNT_VALUE (img->post));
|
||||
gst_object_unref (img->post);
|
||||
|
|
|
@ -215,27 +215,38 @@ gst_camerabin_video_dispose (GstCameraBinVideo * vid)
|
|||
vid->vid_sink_probe_id = 0;
|
||||
}
|
||||
|
||||
/* Note: if videobin was never set to READY state the
|
||||
ownership of elements created by application were never
|
||||
taken by bin and therefore gst_object_sink is called for
|
||||
these elements (they may still be in floating state
|
||||
and not unreffed properly without sinking first)
|
||||
*/
|
||||
if (vid->app_post) {
|
||||
gst_object_sink (vid->app_post);
|
||||
gst_object_unref (vid->app_post);
|
||||
vid->app_post = NULL;
|
||||
}
|
||||
|
||||
if (vid->app_vid_enc) {
|
||||
gst_object_sink (vid->app_vid_enc);
|
||||
gst_object_unref (vid->app_vid_enc);
|
||||
vid->app_vid_enc = NULL;
|
||||
}
|
||||
|
||||
if (vid->app_aud_enc) {
|
||||
gst_object_sink (vid->app_aud_enc);
|
||||
gst_object_unref (vid->app_aud_enc);
|
||||
vid->app_aud_enc = NULL;
|
||||
}
|
||||
|
||||
if (vid->app_aud_src) {
|
||||
gst_object_sink (vid->app_aud_src);
|
||||
gst_object_unref (vid->app_aud_src);
|
||||
vid->app_aud_src = NULL;
|
||||
}
|
||||
|
||||
if (vid->app_mux) {
|
||||
gst_object_sink (vid->app_mux);
|
||||
gst_object_unref (vid->app_mux);
|
||||
vid->app_mux = NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue