diff options
author | Wim Taymans <wtaymans@redhat.com> | 2014-06-11 17:07:22 +0200 |
---|---|---|
committer | Wim Taymans <wtaymans@redhat.com> | 2014-06-12 16:56:44 +0200 |
commit | 6daa72bd27e9200acba7cb3e3ea98027e4d6626d (patch) | |
tree | f9761fa39a97912343a1a8a88d7612665b4ab586 | |
parent | 509bf7110329e5511102bda4718c4b84e36335f9 (diff) |
shell-recorder-src: use timestamping from basesrc
Use the do-timestamp feature of basesrc to place the correct timestamp
on each outgoing buffer.
-rw-r--r-- | src/shell-recorder-src.c | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/src/shell-recorder-src.c b/src/shell-recorder-src.c index af75b211..b26d5ca3 100644 --- a/src/shell-recorder-src.c +++ b/src/shell-recorder-src.c @@ -14,9 +14,6 @@ struct _ShellRecorderSrc GMutex mutex_data; GMutex *mutex; - GstClock *clock; - GstClockTime last_frame_time; - GstCaps *caps; GAsyncQueue *queue; gboolean closed; @@ -45,9 +42,7 @@ shell_recorder_src_init (ShellRecorderSrc *src) { gst_base_src_set_format (GST_BASE_SRC (src), GST_FORMAT_TIME); gst_base_src_set_live (GST_BASE_SRC (src), TRUE); - - src->clock = gst_system_clock_obtain (); - src->last_frame_time = 0; + gst_base_src_set_do_timestamp (GST_BASE_SRC (src), TRUE); src->queue = g_async_queue_new (); src->mutex = &src->mutex_data; @@ -113,9 +108,6 @@ shell_recorder_src_create (GstPushSrc *push_src, buffer = g_async_queue_pop (src->queue); - if (src->last_frame_time == 0) - src->last_frame_time = gst_clock_get_time (GST_CLOCK (src->clock)); - if (buffer == RECORDER_QUEUE_END) { /* Returning UNEXPECTED here will cause a EOS message to be sent */ @@ -127,9 +119,6 @@ shell_recorder_src_create (GstPushSrc *push_src, - (int)(gst_buffer_get_size(buffer) / 1024)); *buffer_out = buffer; - GST_BUFFER_DURATION(*buffer_out) = GST_CLOCK_DIFF (src->last_frame_time, gst_clock_get_time (GST_CLOCK (src->clock))); - - src->last_frame_time = gst_clock_get_time (GST_CLOCK (src->clock)); return GST_FLOW_OK; } @@ -171,8 +160,6 @@ shell_recorder_src_finalize (GObject *object) g_mutex_clear (src->mutex); - gst_object_unref (src->clock); - G_OBJECT_CLASS (shell_recorder_src_parent_class)->finalize (object); } |