fix memory leak 33/70633/3 accepted/tizen/common/20160526.145829 accepted/tizen/ivi/20160602.020550 accepted/tizen/mobile/20160602.020427 accepted/tizen/tv/20160602.020524 accepted/tizen/wearable/20160602.020503 submit/tizen/20160524.060031
authorSeokHoon Lee <andy.shlee@samsung.com>
Fri, 20 May 2016 02:15:44 +0000 (11:15 +0900)
committerSeokHoon Lee <andy.shlee@samsung.com>
Fri, 20 May 2016 04:36:10 +0000 (13:36 +0900)
 - add caps_unref in buffer push function
 - delete unused caps and srcpad

Signed-off-by: SeokHoon Lee <andy.shlee@samsung.com>
Change-Id: Ieccbeedfe1d46d963df4ae408a3bce88c8b7805a

packaging/libmm-streamrecorder.spec
src/mm_streamrecorder_recorder.c

index 1b9de95..2583090 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-streamrecorder
 Summary:    Media Stream Recorder library
-Version:    0.0.6
+Version:    0.0.7
 Release:    0
 Group:      Multimedia/Other
 License:    Apache-2.0
index 402118e..bfd8046 100644 (file)
@@ -1843,7 +1843,7 @@ int _mmstreamrecorder_push_videostream_buffer(MMHandleType handle, unsigned long
 {
        mmf_streamrecorder_t *hstreamrecorder = MMF_STREAMRECORDER(handle);
        _MMStreamRecorderSubContext *sc = NULL;
-       GstPad *srcpad = NULL;
+       /* GstPad *srcpad = NULL; */
        GstCaps *srccaps = NULL;
        char *err_name = NULL;
        int video_fps = 0;
@@ -1871,12 +1871,16 @@ int _mmstreamrecorder_push_videostream_buffer(MMHandleType handle, unsigned long
        if (sc->encode_element[_MMSTREAMRECORDER_ENCSINK_SRC].gst) {
 
                /*_mmstreamrec_dbg_log("Buffer Push start , time stamp %ld",timestamp);*/
-               srcpad = gst_element_get_static_pad(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_SRC].gst, "src");
-               srccaps = gst_pad_get_current_caps(srcpad);
+               /* srcpad = gst_element_get_static_pad(sc->encode_element[_MMSTREAMRECORDER_ENCSINK_SRC].gst, "src"); */
+               /* srccaps = gst_pad_get_current_caps(srcpad); */
                srccaps = gst_set_videosrcpad_caps(video_src, video_width, video_height, video_fps, 1);
-               gst_app_src_set_caps((GstAppSrc *) sc->encode_element[_MMSTREAMRECORDER_ENCSINK_SRC].gst, srccaps);
-               /*_mmstreamrec_dbg_err("newbuf streamrecorder(%p) ",newbuf);*/
+               if (srccaps) {
+                       gst_app_src_set_caps((GstAppSrc *) sc->encode_element[_MMSTREAMRECORDER_ENCSINK_SRC].gst, srccaps);
+                       gst_caps_unref(srccaps);
+                       srccaps = NULL;
+               }
 
+               /*_mmstreamrec_dbg_err("newbuf streamrecorder(%p) ",newbuf);*/
                ret = gst_app_src_push_buffer((GstAppSrc *) sc->encode_element[_MMSTREAMRECORDER_ENCSINK_SRC].gst, buffer);
                if (ret) {
                        _mmstreamrec_dbg_err("video gst_app_src_push_buffer %d", ret);