summaryrefslogtreecommitdiffstats
path: root/meta-rcar-gen2/recipes-multimedia/gstreamer/gstreamer1.0-omx/0005-gssomxbufferpool-add-exported-flag.patch
blob: c6b5c36b5e1e7b7d6b5ec77b19daed91bd25591e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
From c4e86a58041cd4408d283444dcba6f532a80697c Mon Sep 17 00:00:00 2001
From: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
Date: Thu, 1 Sep 2016 17:33:44 +0300
Subject: [PATCH 05/10] gssomxbufferpool: add exported flag

This flag indicates that buffer are used outside of OMX component

Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
---
 omx/gstomx.c           |    1 +
 omx/gstomx.h           |    5 +++++
 omx/gstomxbufferpool.c |    5 ++++-
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/omx/gstomx.c b/omx/gstomx.c
index c018e72..5a916dc 100644
--- a/omx/gstomx.c
+++ b/omx/gstomx.c
@@ -1663,6 +1663,7 @@ gst_omx_port_allocate_buffers_unlocked (GstOMXPort * port,
     buf = g_slice_new0 (GstOMXBuffer);
     buf->port = port;
     buf->used = FALSE;
+    buf->exported = FALSE;
     buf->settings_cookie = port->settings_cookie;
     g_ptr_array_add (port->buffers, buf);
 
diff --git a/omx/gstomx.h b/omx/gstomx.h
index 84980f3..27cb2a9 100644
--- a/omx/gstomx.h
+++ b/omx/gstomx.h
@@ -279,6 +279,11 @@ struct _GstOMXBuffer {
    */
   gboolean used;
 
+  /* TRUE if the buffer exported outside the component,
+   * i.e. someone acquired this buffer
+   */
+  gboolean exported;
+
   /* Cookie of the settings when this buffer was allocated */
   gint settings_cookie;
 
diff --git a/omx/gstomxbufferpool.c b/omx/gstomxbufferpool.c
index b9fa769..1e0a14c 100644
--- a/omx/gstomxbufferpool.c
+++ b/omx/gstomxbufferpool.c
@@ -695,7 +695,7 @@ gst_omx_buffer_pool_acquire_buffer (GstBufferPool * bpool,
           pool->enc_buffer_index = 0;
 
         count += 1;
-      } while (omx_buf->used == TRUE &&
+      } while (omx_buf->exported == TRUE &&
           count < pool->port->port_def.nBufferCountActual * 3);
 
       if (count == pool->port->port_def.nBufferCountActual * 3) {
@@ -703,6 +703,7 @@ gst_omx_buffer_pool_acquire_buffer (GstBufferPool * bpool,
         GST_ERROR_OBJECT (pool,
             "Can not acquire buffer after 3 times searching");
       } else {
+        omx_buf->exported = TRUE;
         *buffer = buf;
         ret = GST_FLOW_OK;
       }
@@ -731,6 +732,8 @@ gst_omx_buffer_pool_release_buffer (GstBufferPool * bpool, GstBuffer * buffer)
     omx_buf =
         gst_mini_object_get_qdata (GST_MINI_OBJECT_CAST (buffer),
         gst_omx_buffer_data_quark);
+    if (GST_IS_OMX_VIDEO_ENC (pool->element))
+      omx_buf->exported = FALSE;
     if (pool->port->port_def.eDir == OMX_DirOutput && !omx_buf->used) {
       /* Release back to the port, can be filled again */
       err = gst_omx_port_release_buffer (pool->port, omx_buf);
-- 
1.7.10.4