Drop first recording buffer if it's from tizen allocator 66/188466/2 accepted/tizen/unified/20180906.054554 submit/tizen/20180905.091740
authorJeongmo Yang <jm80.yang@samsung.com>
Wed, 5 Sep 2018 07:39:45 +0000 (16:39 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Wed, 5 Sep 2018 07:50:02 +0000 (16:50 +0900)
- In single stream device, preview buffer is also used for recording,
  and the first recording buffer to appsrc is copied, because its reference count is bigger than 1.
  Dropping buffer will decrease reference count and avoid to copy it.

[Version] 0.10.168
[Profile] Common
[Issue Type] Update
[Dependency module] N/A
[Test] [M(T) - Boot=(OK), sdb=(OK), Home=(OK), Touch=(OK), Version=tizen-unified_20180903.2]

Change-Id: I658bf7822f62cb3f86a5749fe4dacc120bf44685
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
packaging/libmm-camcorder.spec
src/mm_camcorder_gstcommon.c

index 51a531f47d5d99e102ea1d57a50791d83fbc6598..76c5ddeca4a9123767a5648bdf0ff2654c0e00a9 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-camcorder
 Summary:    Camera and recorder library
-Version:    0.10.167
+Version:    0.10.168
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index 63cb3a9a863b7ab2e51c293a20abc2b3ae0d7735..2204baf5f8de613db5c0707566d1040959d1cefd 100644 (file)
@@ -1948,7 +1948,6 @@ static GstPadProbeReturn __mmcamcorder_video_dataprobe_push_buffer_to_record(Gst
 
                if (sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst) {
                        if (sc->info_video->is_firstframe) {
-                               sc->info_video->is_firstframe = FALSE;
                                clock = GST_ELEMENT_CLOCK(sc->encode_element[_MMCAMCORDER_AUDIOSRC_SRC].gst);
                                if (clock) {
                                        gst_object_ref(clock);
@@ -1966,7 +1965,6 @@ static GstPadProbeReturn __mmcamcorder_video_dataprobe_push_buffer_to_record(Gst
                                        g_cond_signal(&hcamcorder->task_thread_cond);
                                        g_mutex_unlock(&hcamcorder->task_thread_lock);
                                }
-                               sc->info_video->is_firstframe = FALSE;
                                sc->info_video->base_video_ts = GST_BUFFER_PTS(buffer);
                        }
                }
@@ -1994,6 +1992,16 @@ static GstPadProbeReturn __mmcamcorder_video_dataprobe_push_buffer_to_record(Gst
                g_signal_emit_by_name(sc->encode_element[_MMCAMCORDER_ENCSINK_SRC].gst, "push-buffer", buffer, &ret);
 
                /*_mmcam_dbg_log("push buffer result : 0x%x", ret);*/
+
+               if (sc->info_video->is_firstframe) {
+                       sc->info_video->is_firstframe = FALSE;
+
+                       /* drop buffer if it's from tizen allocator */
+                       if (gst_is_tizen_memory(gst_buffer_peek_memory(buffer, 0))) {
+                               _mmcam_dbg_warn("drop first buffer from tizen allocator to avoid copy in basesrc");
+                               return GST_PAD_PROBE_DROP;
+                       }
+               }
        }
 
        /* skip display if too fast FPS */