v4l2src: Set duration on buffers
authorThiago Santos <thiagoss@embedded.ufcg.edu.br>
Wed, 14 Oct 2009 10:38:26 +0000 (07:38 -0300)
committerThiago Santos <thiagoss@embedded.ufcg.edu.br>
Wed, 14 Oct 2009 11:00:49 +0000 (08:00 -0300)
Use framerate to estimate duration of buffers.

Fixes #590362

sys/v4l2/gstv4l2src.c

index 1178f5a..581ef5c 100644 (file)
@@ -906,6 +906,7 @@ gst_v4l2src_create (GstPushSrc * src, GstBuffer ** buf)
   if (G_LIKELY (ret == GST_FLOW_OK && *buf)) {
     GstClock *clock;
     GstClockTime timestamp;
+    GstClockTime duration = GST_CLOCK_TIME_NONE;
 
     GST_BUFFER_OFFSET (*buf) = v4l2src->offset++;
     GST_BUFFER_OFFSET_END (*buf) = v4l2src->offset;
@@ -938,11 +939,14 @@ gst_v4l2src_create (GstPushSrc * src, GstBuffer ** buf)
           timestamp -= latency;
         else
           timestamp = 0;
+
+        duration = latency;
       }
     }
 
     /* FIXME: use the timestamp from the buffer itself! */
     GST_BUFFER_TIMESTAMP (*buf) = timestamp;
+    GST_BUFFER_DURATION (*buf) = duration;
   }
   return ret;
 }