| From bdbe225a9c826bd9ecd44af48f957c131e8ce22a Mon Sep 17 00:00:00 2001 | |
| From: Yuan Fang <yuan.fang@mediatek.com> | |
| Date: Wed, 14 Aug 2019 15:30:04 +0800 | |
| Subject: [PATCH] upgrade-gst-to-1_14_4 | |
| --- | |
| gst/gstallocator.c | 6 ++++++ | |
| libs/gst/base/gstbaseparse.c | 5 +++++ | |
| plugins/elements/gstfakesink.c | 36 ++++++++++++++++++++++++++++++++++++ | |
| 3 files changed, 47 insertions(+) | |
| diff --git a/gst/gstallocator.c b/gst/gstallocator.c | |
| index 4b78a33..2b7fb27 100644 | |
| --- a/gst/gstallocator.c | |
| +++ b/gst/gstallocator.c | |
| @@ -592,6 +592,12 @@ _priv_gst_allocator_initialize (void) | |
| GST_CAT_DEBUG (GST_CAT_MEMORY, "memory alignment: %" G_GSIZE_FORMAT, | |
| gst_memory_alignment); | |
| + if (gst_memory_alignment < 127) | |
| + { | |
| + gst_memory_alignment = 127; | |
| + } | |
| + GST_CAT_DEBUG (GST_CAT_MEMORY, "Adjusted memory alignment: %" G_GSIZE_FORMAT,gst_memory_alignment); | |
| + | |
| _sysmem_allocator = g_object_new (gst_allocator_sysmem_get_type (), NULL); | |
| /* Clear floating flag */ | |
| diff --git a/libs/gst/base/gstbaseparse.c b/libs/gst/base/gstbaseparse.c | |
| index 9a8f986..1630af1 100644 | |
| --- a/libs/gst/base/gstbaseparse.c | |
| +++ b/libs/gst/base/gstbaseparse.c | |
| @@ -2522,6 +2522,11 @@ gst_base_parse_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame) | |
| } | |
| } | |
| + if (frame->flags & GST_BASE_PARSE_FRAME_FLAG_DROP) { | |
| + GST_LOG_OBJECT (parse, "frame with drop flag"); | |
| + ret = GST_BASE_PARSE_FLOW_DROPPED; | |
| + } | |
| + | |
| if (ret == GST_BASE_PARSE_FLOW_DROPPED) { | |
| GST_LOG_OBJECT (parse, "frame (%" G_GSIZE_FORMAT " bytes) dropped", size); | |
| if (GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DISCONT)) | |
| diff --git a/plugins/elements/gstfakesink.c b/plugins/elements/gstfakesink.c | |
| index b71f20f..d8fa7d6 100644 | |
| --- a/plugins/elements/gstfakesink.c | |
| +++ b/plugins/elements/gstfakesink.c | |
| @@ -37,6 +37,11 @@ | |
| # include "config.h" | |
| #endif | |
| +#define DEBUG_SINK_PERFORMANCE | |
| +#ifdef DEBUG_SINK_PERFORMANCE | |
| +#include <sys/time.h> | |
| +#endif | |
| + | |
| #include "gstelements_private.h" | |
| #include "gstfakesink.h" | |
| #include <string.h> | |
| @@ -435,6 +440,33 @@ eos: | |
| } | |
| } | |
| +#ifdef DEBUG_SINK_PERFORMANCE | |
| +static void | |
| +gst_fake_sink_debug_performance(GstFakeSink * sink) | |
| +{ | |
| + static gfloat costTime=0.0; | |
| + gfloat avgTimeOnce=0.0; | |
| + | |
| + static guint count=0; | |
| + | |
| + static struct timeval tpStart; | |
| + struct timeval tpEnd; | |
| + | |
| + count++; | |
| + if (count == 1) { | |
| + gettimeofday(&tpStart,NULL); | |
| + } | |
| + | |
| + if(count % 100 == 0) { | |
| + gettimeofday(&tpEnd,NULL); | |
| + | |
| + costTime = 1000000*(tpEnd.tv_sec-tpStart.tv_sec)+(tpEnd.tv_usec-tpStart.tv_usec); | |
| + avgTimeOnce = costTime/count; //us | |
| + GST_INFO_OBJECT (sink, "FPS info: total %d frames,costTime=%fus,avg=%fms,fps=%f",count,costTime,avgTimeOnce/1000,1*1000/(avgTimeOnce/1000)); | |
| + } | |
| +} | |
| +#endif | |
| + | |
| static GstFlowReturn | |
| gst_fake_sink_render (GstBaseSink * bsink, GstBuffer * buf) | |
| { | |
| @@ -443,6 +475,10 @@ gst_fake_sink_render (GstBaseSink * bsink, GstBuffer * buf) | |
| if (sink->num_buffers_left == 0) | |
| goto eos; | |
| +#ifdef DEBUG_SINK_PERFORMANCE | |
| + gst_fake_sink_debug_performance (sink); | |
| +#endif | |
| + | |
| if (sink->num_buffers_left != -1) | |
| sink->num_buffers_left--; | |
| -- | |
| 1.9.1 | |