From 9586339c11df0cc2f5bf16e2ccf9bd720956bc4a Mon Sep 17 00:00:00 2001 From: Jeongmo Yang Date: Wed, 5 Sep 2018 16:39:45 +0900 Subject: [PATCH] Drop first recording buffer if it's from tizen allocator - 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 --- packaging/libmm-camcorder.spec | 2 +- src/mm_camcorder_gstcommon.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/packaging/libmm-camcorder.spec b/packaging/libmm-camcorder.spec index 51a531f..76c5dde 100644 --- a/packaging/libmm-camcorder.spec +++ b/packaging/libmm-camcorder.spec @@ -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 diff --git a/src/mm_camcorder_gstcommon.c b/src/mm_camcorder_gstcommon.c index 63cb3a9..2204baf 100644 --- a/src/mm_camcorder_gstcommon.c +++ b/src/mm_camcorder_gstcommon.c @@ -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 */ -- 2.7.4