Buffers dropped due to temporal clipping

Yogesh Tyagi yogesh.bit2006 at gmail.com
Tue May 20 22:44:33 PDT 2014


Hi,

In my plugin, I have a convert function in video sink element which is
checking for temporal clipping in the buffer and drops the buffer if buffer
duration is outside segment boundaries. Due to temporal clipping, I get
choppy audio/video or sometimes no audio for some streams.If I disable this
convert function, streams start plying fine.

static GstBuffer *
mds_gst_vidsink_convert (MdsGstElement * mds_element, GstBuffer * buf,
    gboolean need_seq_hdr)
{
  MdsGstVidsink *vidsink = MDS_GST_VIDSINK (mds_element);
  GstBuffer *outbuf = buf;
  GstClockTime pts, duration;
  gint64 clip_start, clip_stop;
  gboolean in_seg;

  pts = GST_BUFFER_TIMESTAMP (buf);
  duration = GST_BUFFER_DURATION (buf);
  if (GST_CLOCK_TIME_IS_VALID (pts)) {
    GST_LOG_OBJECT (vidsink, "check for clipping on buffer %p with pts %" \
        GST_TIME_FORMAT " and duration %" GST_TIME_FORMAT,
        buf, GST_TIME_ARGS (pts), GST_TIME_ARGS (duration));

    clip_start = clip_stop = pts;
    if (GST_CLOCK_TIME_IS_VALID (duration))
      clip_stop += duration;

    /* Check if this buffer's timestamp/duration is in our segment */
    in_seg = gst_segment_clip (&mds_element->segment, GST_FORMAT_TIME,
        clip_start, clip_stop, &clip_start, &clip_stop);

    if (G_UNLIKELY (!in_seg)) {
      GST_LOG_OBJECT (vidsink, "dropping buffer due to temporal clipping");
      gst_buffer_unref (buf);
      outbuf = NULL;
    }
  }
}


Is this a must have function for video sink elements?

Thanks,
Yogesh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20140521/647b4b39/attachment.html>


More information about the gstreamer-devel mailing list