[Gstreamer-openmax] Repeat Mode of Totem Player

Felipe Contreras felipe.contreras at gmail.com
Thu Sep 9 16:06:00 PDT 2010


On Mon, Aug 30, 2010 at 2:25 PM, Mickey Kim <jihun.kim at samsung.com> wrote:
> >From 794a96ffdbb7c1a4451ff0e0e14a7e2fad337c45 Mon Sep 17 00:00:00 2001
> From: mickey <mickey at avatar.(none)>
> Date: Mon, 30 Aug 2010 15:44:00 +0900
> Subject: [PATCH] [gst-openmax] Fix repeate mode issue of totem player
> When totem play single file in playlist in repeat mode, single file is played for 2times.
> Totem stops at third time, only plays when seek button is pressed.
> When totem player detects EOS (end of stream) in repeat mode, it doesn't change the statete.
> gst-openmax, libomx source code are implemented without consideration of this case.
> The repeate mode without state change causes a buffer loss in gst-openmax queue for one repeatation.
> Singed-off-by: Mickey Kim <jihun.kim at samsung.com>
> ---
>  omx/gstomx_base_filter.c |    1 +
>  omx/gstomx_util.c        |   13 +++++++++++--
>  2 files changed, 12 insertions(+), 2 deletions(-)
> diff --git a/omx/gstomx_base_filter.c b/omx/gstomx_base_filter.c
> index a16cb5f..40d4c4c 100644
> --- a/omx/gstomx_base_filter.c
> +++ b/omx/gstomx_base_filter.c
> @@ -504,6 +504,7 @@ output_loop (gpointer data)
>             GST_DEBUG_OBJECT (self, "got eos");
>             gst_pad_push_event (self->srcpad, gst_event_new_eos ());
>             ret = GST_FLOW_UNEXPECTED;
> +            g_omx_port_push_buffer (out_port, omx_buffer);
>             goto leave;
>         }
>
> diff --git a/omx/gstomx_util.c b/omx/gstomx_util.c
> index 283c32d..ce226e0 100644
> --- a/omx/gstomx_util.c
> +++ b/omx/gstomx_util.c
> @@ -697,8 +697,17 @@ g_omx_port_flush (GOmxPort *port)
>         OMX_BUFFERHEADERTYPE *omx_buffer;
>         while ((omx_buffer = async_queue_pop_forced (port->queue)))
>         {
> -            omx_buffer->nFilledLen = 0;
> -            g_omx_port_release_buffer (port, omx_buffer);
> +            if (omx_buffer->nFlags & OMX_BUFFERFLAG_EOS)
> +            {
> +                omx_buffer->nFlags = 0;
> +                g_omx_port_push_buffer (port, omx_buffer);
> +                break;
> +            }
> +            else
> +            {
> +                omx_buffer->nFilledLen = 0;
> +                g_omx_port_release_buffer (port, omx_buffer);
> +            }
>         }
>     }
>     else
> --
> 1.7.0.4

I don't think this is the right approach.

Buffers marked with EOS should not be any different from other
buffers; they should be returned with OMX_FillThisBuffer().

However, it does seem true that the EOS is not handled correctly as
the buffers are lost.

What do you think about this instead?

--- a/omx/gstomx_base_filter.c
+++ b/omx/gstomx_base_filter.c
@@ -499,14 +499,6 @@ output_loop (gpointer data)
             GST_WARNING_OBJECT (self, "empty buffer");
         }

-        if (G_UNLIKELY (omx_buffer->nFlags & OMX_BUFFERFLAG_EOS))
-        {
-            GST_DEBUG_OBJECT (self, "got eos");
-            gst_pad_push_event (self->srcpad, gst_event_new_eos ());
-            ret = GST_FLOW_UNEXPECTED;
-            goto leave;
-        }
-
         if (self->share_output_buffer &&
             !omx_buffer->pBuffer &&
             omx_buffer->nOffset == 0)
@@ -542,6 +534,14 @@ output_loop (gpointer data)
             GST_ERROR_OBJECT (self, "no input buffer to share");
         }

+        if (G_UNLIKELY (omx_buffer->nFlags & OMX_BUFFERFLAG_EOS))
+        {
+            GST_DEBUG_OBJECT (self, "got eos");
+            gst_pad_push_event (self->srcpad, gst_event_new_eos ());
+            omx_buffer->nFlags &= ~OMX_BUFFERFLAG_EOS;
+            ret = GST_FLOW_UNEXPECTED;
+        }
+
         omx_buffer->nFilledLen = 0;
         GST_LOG_OBJECT (self, "release_buffer");
         g_omx_port_release_buffer (out_port, omx_buffer);

-- 
Felipe Contreras




More information about the Gstreamer-openmax mailing list