wrappercamerabinsrc: Push newsegments on video capture start
authorThiago Santos <thiago.sousa.santos@collabora.com>
Mon, 19 Dec 2011 18:16:42 +0000 (15:16 -0300)
committerThiago Santos <thiago.sousa.santos@collabora.com>
Tue, 20 Dec 2011 17:46:26 +0000 (14:46 -0300)
Pushing newsegments to inform muxers about the start time of the
video buffer timestamps.

gst/camerabin2/gstwrappercamerabinsrc.c

index 16aa34b..5c8d2d1 100644 (file)
@@ -253,9 +253,17 @@ gst_wrapper_camera_bin_src_vidsrc_probe (GstPad * pad, GstBuffer * buffer,
   if (self->video_rec_status == GST_VIDEO_RECORDING_STATUS_DONE) {
     /* NOP */
   } else if (self->video_rec_status == GST_VIDEO_RECORDING_STATUS_STARTING) {
+    GstClockTime ts;
+
     GST_DEBUG_OBJECT (self, "Starting video recording");
     self->video_rec_status = GST_VIDEO_RECORDING_STATUS_RUNNING;
 
+    ts = GST_BUFFER_TIMESTAMP (buffer);
+    if (!GST_CLOCK_TIME_IS_VALID (ts))
+      ts = 0;
+    gst_pad_push_event (self->vidsrc, gst_event_new_new_segment (FALSE, 1.0,
+            GST_FORMAT_TIME, ts, -1, 0));
+
     /* post preview */
     GST_DEBUG_OBJECT (self, "Posting preview for video");
     gst_base_camera_src_post_preview (camerasrc, buffer);