[Bug 787290] GST_EVENT_FLUSH_START for omxvideodec

GStreamer (GNOME Bugzilla) bugzilla at gnome.org
Fri Sep 8 10:12:00 UTC 2017


https://bugzilla.gnome.org/show_bug.cgi?id=787290

--- Comment #3 from Yuji Kuwabara <HHG01200 at nifty.ne.jp> ---
I ended up with following modifications.
I hope original authors and other experts verify this, and consider
improvements.


"gstglimagesink.c"

In gst_glimage_sink_event(), add handler for GST_EVENT_FLUSH_START .
(almost same as GST_STATE_CHANGE_PAUSED_TO_READY in
gst_glimage_sink_change_state())
I think this prevents deadlock in gst_omx_video_dec_loop() by releasing output
port.
(also set "enable-last-sample" to FALSE)

-------------------------------------

   case GST_EVENT_FLUSH_START:
    {
      GstBuffer *buf[2];

      GST_GLIMAGE_SINK_LOCK (gl_sink);
      /* mark the redisplay_texture as unavailable (=0)
       * to avoid drawing
       */
      gl_sink->redisplay_texture = 0;
      buf[0] = gl_sink->stored_buffer[0];
      buf[1] = gl_sink->stored_buffer[1];
      gl_sink->stored_buffer[0] = gl_sink->stored_buffer[1] = NULL;
      gl_sink->stored_sync_meta = gl_sink->next_sync_meta = NULL;

      if (gl_sink->stored_sync)
        gst_buffer_unref (gl_sink->stored_sync);
      gl_sink->stored_sync = NULL;

 //     GST_GLIMAGE_SINK_UNLOCK (gl_sink);

      gst_buffer_replace (buf, NULL);
      gst_buffer_replace (buf + 1, NULL);

      gst_object_replace ((GstObject **) & gl_sink->convert_views, NULL);
      gst_buffer_replace (&gl_sink->input_buffer, NULL);
      gst_buffer_replace (&gl_sink->input_buffer2, NULL);
      gst_buffer_replace (&gl_sink->next_buffer, NULL);
      gst_buffer_replace (&gl_sink->next_buffer2, NULL);
      gst_buffer_replace (&gl_sink->next_sync, NULL);

     GST_GLIMAGE_SINK_UNLOCK (gl_sink);

    }
    break;

-------------------------------------



"gstomxvideodec.c"

Add sink_event() handler.
I think this prevents deadlock in gst_omx_video_dec_handle_frame() by releasing
input port.

Suppress port reconfiguration error while flushing.
(occasionally port reconfiguration event occur, 
and fails with OMX_ErrorIncorrectStateOperation)

-------------------------------------

gst_omx_video_dec_class_init()
{


  video_decoder_class->sink_event = GST_DEBUG_FUNCPTR
(gst_omx_video_dec_sink_event);


}


gst_omx_video_dec_loop()
{


reconfigure_error:
  {


    if (!GST_PAD_IS_FLUSHING (GST_VIDEO_DECODER_SINK_PAD (self)))
    {

    GST_ELEMENT_ERROR (self, LIBRARY, SETTINGS, (NULL),
        ("Unable to reconfigure output port"));

    }

  }

}


static gboolean gst_omx_video_dec_sink_event (GstVideoDecoder *decoder,
GstEvent *event)
{
    gboolean    ret;

    ret = GST_VIDEO_DECODER_CLASS(gst_omx_video_dec_parent_class)->sink_event
(decoder, event);

    switch (GST_EVENT_TYPE(event))
    {
    case GST_EVENT_FLUSH_START:
        {
            GstVideoDecoderClass    *klass;

            klass = GST_VIDEO_DECODER_GET_CLASS (decoder);
            {
                GST_VIDEO_DECODER_STREAM_LOCK (decoder);

                klass->flush(decoder);

                GST_VIDEO_DECODER_STREAM_UNLOCK (decoder);
            }
        }
        break;
    default:
        break;
    }
    return ret;
}

-------------------------------------

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list