summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2018-12-07 12:09:20 -0500
committerScott Murray <scott.murray@konsulko.com>2018-12-10 18:49:40 +0000
commit4ec177a75aeb99520bdcac827b564abd0c3fe235 (patch)
tree83e45ed73db7d07dd8c92eb247a86273b892158c
parent3c47c38fd19ebd0f9493ec7cc8ad05ebff1d0e94 (diff)
weston: Add patch to improve gst-record robustness
Add a patch to do some retries with a delay when the gst-record feature is initializing and attempts to query the omx encoder plugin for its buffer pools. It is not clear why exactly the encoder is not consistently ready at this point, but in my testing this change greatly improved the robustness of weston startup with gst-record enabled. Change-Id: Ibd26ad64be035e1f9d40cc3cd9337e9efeabfad4 Signed-off-by: Scott Murray <scott.murray@konsulko.com>
-rw-r--r--meta-gstrecorder-rcar-gen3/recipes-graphics/wayland/weston/0005-gst-record-Add-omx-pool-retries.patch51
-rw-r--r--meta-gstrecorder-rcar-gen3/recipes-graphics/wayland/weston_2.0.0.bbappend1
2 files changed, 52 insertions, 0 deletions
diff --git a/meta-gstrecorder-rcar-gen3/recipes-graphics/wayland/weston/0005-gst-record-Add-omx-pool-retries.patch b/meta-gstrecorder-rcar-gen3/recipes-graphics/wayland/weston/0005-gst-record-Add-omx-pool-retries.patch
new file mode 100644
index 00000000..d6a7a1b3
--- /dev/null
+++ b/meta-gstrecorder-rcar-gen3/recipes-graphics/wayland/weston/0005-gst-record-Add-omx-pool-retries.patch
@@ -0,0 +1,51 @@
+gst-record: Add retry on omx buffer pool query
+
+The omx encoder plugin seems to sometimes not be ready immediately to
+answer the pad query to get the buffer pool, add a retry loop with a
+slight delay between attempts to avoid failing.
+
+Upstream-Status: Inappropriate [bugfix]
+
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+
+diff --git a/libweston/gst-recorder.c b/libweston/gst-recorder.c
+index 7dafd956..9c29d04b 100644
+--- a/libweston/gst-recorder.c
++++ b/libweston/gst-recorder.c
+@@ -833,6 +833,7 @@ static int
+ gst_recorder_find_omx_pool(struct gst_recorder *r)
+ {
+ int ret = 0;
++ int i;
+ GstCaps *caps;
+ GstQuery *query;
+ GstBufferPool *pool;
+@@ -853,14 +854,24 @@ gst_recorder_find_omx_pool(struct gst_recorder *r)
+ /* find a pool for the negotiated caps now */
+ query = gst_query_new_allocation (caps, TRUE);
+
+- if (!gst_pad_peer_query (r->appsrc_pad, query)) {
+- /* query failed, not a problem, we use the query defaults */
+- weston_log("allocation query failed\n");
++ /*
++ * The omx plugin seems to not always be ready to respond to queries
++ * immediately, try a few times with a delay to avoid failures.
++ */
++ for (i = 0; i < 5; i++) {
++ usleep(100000);
++ if (gst_pad_peer_query (r->appsrc_pad, query)) {
++ break;
++ } else {
++ weston_log("allocation query attempt %d failed\n", i + 1);
++ }
++ }
++ if (i == 5) {
+ ret = -1;
+ goto err;
+ }
+
+- weston_log("goot %d pools\n", gst_query_get_n_allocation_pools (query));
++ weston_log("got %d pools\n", gst_query_get_n_allocation_pools (query));
+ if (gst_query_get_n_allocation_pools (query) > 0) {
+ /* we got configuration from our peer, parse them */
+ gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
diff --git a/meta-gstrecorder-rcar-gen3/recipes-graphics/wayland/weston_2.0.0.bbappend b/meta-gstrecorder-rcar-gen3/recipes-graphics/wayland/weston_2.0.0.bbappend
index 51b75ce3..7ba1fbcb 100644
--- a/meta-gstrecorder-rcar-gen3/recipes-graphics/wayland/weston_2.0.0.bbappend
+++ b/meta-gstrecorder-rcar-gen3/recipes-graphics/wayland/weston_2.0.0.bbappend
@@ -5,6 +5,7 @@ SRC_URI_append_rcar-gen3 = " \
file://0002-Add-gst-recorder-for-h264-output-streaming.patch \
file://0003-gst-recorder-Use-USERPTR-instead-of-DMABUF-for-VSP-o.patch \
file://0004-gst-record-Specify-bytesused-and-length-of-VSP-input.patch \
+ file://0005-gst-record-Add-omx-pool-retries.patch \
"
COMPATIBLE_MACHINE = "salvator-x|m3ulcb|h3ulcb"