diff options
author | Harunobu Kurokawa <harunobu.kurokawa.dn@renesas.com> | 2017-05-16 21:52:27 +0900 |
---|---|---|
committer | Harunobu Kurokawa <harunobu.kurokawa.dn@renesas.com> | 2017-05-23 10:10:49 +0900 |
commit | 1394e295da553c1252f5b56cface3b6ee69a3fad (patch) | |
tree | 18fb0589f1dc27a2685e1966c4467b67fbaaa8ea /meta-rcar-gen2/recipes-graphics/wayland | |
parent | 7b85f7a3e5129f743e533692c6cbf15273ac02f6 (diff) |
meta-renesas: weston: Fix gst-record uses MONOTONIC time for Cluster Demo
gst-record plugin uses gettimeofday to adapt gst buffer duration.
When WLAN network access internet, system timer is changed by NTP, then
the gst plugin system stopped.
This patch change to use MONOTONIC timer to detect buffer time frame.
v3:
Need to use gst_clock_get_time function and GstClockTime.
Change-Id: I372afcfaf4fe61238e84cfdaadd4b81bcc6c6fb2
Signed-off-by: Harunobu Kurokawa <harunobu.kurokawa.dn@renesas.com>
Diffstat (limited to 'meta-rcar-gen2/recipes-graphics/wayland')
-rw-r--r-- | meta-rcar-gen2/recipes-graphics/wayland/weston/0005-gst-record-switch-to-gettime-function-to-CLOCK_MONOT.patch | 68 | ||||
-rw-r--r-- | meta-rcar-gen2/recipes-graphics/wayland/weston_1.9.0.bbappend | 1 |
2 files changed, 69 insertions, 0 deletions
diff --git a/meta-rcar-gen2/recipes-graphics/wayland/weston/0005-gst-record-switch-to-gettime-function-to-CLOCK_MONOT.patch b/meta-rcar-gen2/recipes-graphics/wayland/weston/0005-gst-record-switch-to-gettime-function-to-CLOCK_MONOT.patch new file mode 100644 index 0000000..ae87cde --- /dev/null +++ b/meta-rcar-gen2/recipes-graphics/wayland/weston/0005-gst-record-switch-to-gettime-function-to-CLOCK_MONOT.patch @@ -0,0 +1,68 @@ +From 7d6cc173fb04597a05e846c5d17962de7ec388d4 Mon Sep 17 00:00:00 2001 +From: Harunobu Kurokawa <harunobu.kurokawa.dn@renesas.com> +Date: Tue, 16 May 2017 21:50:02 +0900 +Subject: [PATCH] gst-record: switch to gettime function to CLOCK_MONOTONIC + +When system time is changed (e.g. from NTP) and buffer duration +is bigger, the gst-record stops. It should use the CLOCK_MONOTONIC time. + +v2: + Need to use gst_clock_get_time function. Thus, GstClockTime is nsec +timescale, it should be convert uint64_t by GST_TIME_AS_MSECONDS. + +v3: + Need to use gst_clock_get_time function and GstClockTime. + +Signed-off-by: Harunobu Kurokawa <harunobu.kurokawa.dn@renesas.com> +--- + src/gst-recorder.c | 14 +++++++++----- + 1 file changed, 9 insertions(+), 5 deletions(-) + +diff --git a/src/gst-recorder.c b/src/gst-recorder.c +index 91ba0c7..1a06a39 100644 +--- a/src/gst-recorder.c ++++ b/src/gst-recorder.c +@@ -102,8 +102,9 @@ struct gst_recorder { + /* bus */ + GstBus *bus; + /* timestamp */ ++ GstClock *clock; + GstClockTime timestamp; +- uint32_t ts_last_frame; ++ GstClockTime ts_last_frame; + /* to be removed */ + guint callback_tag; + +@@ -1042,6 +1043,9 @@ gst_recorder_create(struct gst_recorder_settings *settings) + goto err_gst_stop; + } + ++ /* set clock time */ ++ r->clock = gst_element_get_clock (GST_ELEMENT_CAST (r->appsrc)); ++ + weston_log("gst_recorder_create done\n"); + + return r; +@@ -1077,15 +1081,15 @@ gst_recorder_destroy(struct gst_recorder *r) + static int + gst_recorder_set_timestamp(struct gst_recorder *r, GstBuffer *buffer) + { +- uint32_t cur_time = weston_compositor_get_time(); ++ GstClockTime cur_time = gst_clock_get_time(r->clock); + + if (r->timestamp == 0) { + /* first frame assume around DEFAULT_FPS FPS */ + GST_BUFFER_DURATION(buffer) = gst_util_uint64_scale_int(1, GST_SECOND, DEFAULT_FPS); + } else { +- uint32_t delta = cur_time - r->ts_last_frame; +- /* delta in mS */ +- GST_BUFFER_DURATION(buffer) = gst_util_uint64_scale_int(delta, GST_SECOND, 1000); ++ GstClockTime delta = cur_time - r->ts_last_frame; ++ /* delta in nS */ ++ GST_BUFFER_DURATION(buffer) = delta; + } + + r->timestamp += GST_BUFFER_DURATION(buffer); +-- +2.9.2 + diff --git a/meta-rcar-gen2/recipes-graphics/wayland/weston_1.9.0.bbappend b/meta-rcar-gen2/recipes-graphics/wayland/weston_1.9.0.bbappend index 533be7e..7a54fcf 100644 --- a/meta-rcar-gen2/recipes-graphics/wayland/weston_1.9.0.bbappend +++ b/meta-rcar-gen2/recipes-graphics/wayland/weston_1.9.0.bbappend @@ -8,5 +8,6 @@ SRC_URI_append = " \ file://0002-Get-DMA-fd-on-bo.patch \ file://0003-Add-gst-recorder-for-h264-output-streaming.patch \ file://0004-Fix-GST-error-complainings.patch \ + file://0005-gst-record-switch-to-gettime-function-to-CLOCK_MONOT.patch \ file://weston.service \ " |