1 gst-record: Add retry on omx buffer pool query
3 The omx encoder plugin seems to sometimes not be ready immediately to
4 answer the pad query to get the buffer pool, add a retry loop with a
5 slight delay between attempts to avoid failing.
7 Upstream-Status: Inappropriate [bugfix]
9 Signed-off-by: Scott Murray <scott.murray@konsulko.com>
11 diff --git a/libweston/gst-recorder.c b/libweston/gst-recorder.c
12 index 7dafd956..9c29d04b 100644
13 --- a/libweston/gst-recorder.c
14 +++ b/libweston/gst-recorder.c
15 @@ -833,6 +833,7 @@ static int
16 gst_recorder_find_omx_pool(struct gst_recorder *r)
23 @@ -853,14 +854,24 @@ gst_recorder_find_omx_pool(struct gst_recorder *r)
24 /* find a pool for the negotiated caps now */
25 query = gst_query_new_allocation (caps, TRUE);
27 - if (!gst_pad_peer_query (r->appsrc_pad, query)) {
28 - /* query failed, not a problem, we use the query defaults */
29 - weston_log("allocation query failed\n");
31 + * The omx plugin seems to not always be ready to respond to queries
32 + * immediately, try a few times with a delay to avoid failures.
34 + for (i = 0; i < 5; i++) {
36 + if (gst_pad_peer_query (r->appsrc_pad, query)) {
39 + weston_log("allocation query attempt %d failed\n", i + 1);
47 - weston_log("goot %d pools\n", gst_query_get_n_allocation_pools (query));
48 + weston_log("got %d pools\n", gst_query_get_n_allocation_pools (query));
49 if (gst_query_get_n_allocation_pools (query) > 0) {
50 /* we got configuration from our peer, parse them */
51 gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);