diff options
author | Olivier Crete <olivier.crete@collabora.co.uk> | 2008-07-04 21:52:08 +0000 |
---|---|---|
committer | Olivier CrĂȘte <olivier.crete@collabora.co.uk> | 2009-03-03 14:34:06 -0500 |
commit | 9e7cada4a92961c4b0fb2fdeea21642c942fef51 (patch) | |
tree | 8d7295d73ed28f1c3565d8a215829448756a2c3f /ext | |
parent | 749e12bb15c43aca81bb2f3b88fda71fa7844d4c (diff) | |
download | gst-plugins-bad-9e7cada4a92961c4b0fb2fdeea21642c942fef51.tar.gz gst-plugins-bad-9e7cada4a92961c4b0fb2fdeea21642c942fef51.tar.bz2 gst-plugins-bad-9e7cada4a92961c4b0fb2fdeea21642c942fef51.zip |
[MOVED FROM GST-P-FARSIGHT] Use the timestamp from the first buffer as the base
20080704215208-3e2dc-5822771f2694deda4a7cd5cdd3c38ab9eff7fa2d.gz
Diffstat (limited to 'ext')
-rw-r--r-- | ext/mimic/gstmimdec.c | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/ext/mimic/gstmimdec.c b/ext/mimic/gstmimdec.c index 4ce13a88..bf61794d 100644 --- a/ext/mimic/gstmimdec.c +++ b/ext/mimic/gstmimdec.c @@ -130,7 +130,7 @@ gst_mimdec_init (GstMimDec *mimdec, GstMimDecClass *klass) mimdec->payload_size = -1; mimdec->last_ts = -1; mimdec->current_ts = -1; - mimdec->gst_timestamp = -1; + mimdec->gst_timestamp = GST_CLOCK_TIME_NONE; } static void @@ -167,19 +167,8 @@ gst_mimdec_chain (GstPad *pad, GstBuffer *in) gst_adapter_push (mimdec->adapter, buf); - if (mimdec->gst_timestamp == -1) { - GstClock *clock; - GstClockTime base_time; - - base_time = gst_element_get_base_time (GST_ELEMENT (mimdec)); - - clock = gst_element_get_clock (GST_ELEMENT (mimdec)); - if (clock != NULL) { - mimdec->gst_timestamp = gst_clock_get_time (clock) - base_time; - gst_object_unref (clock); - } - } - + if (!GST_CLOCK_TIME_IS_VALID (mimdec->gst_timestamp)) + mimdec->gst_timestamp = GST_BUFFER_TIMESTAMP (in); // do we have enough bytes to read a header while (gst_adapter_available (mimdec->adapter) >= (mimdec->have_header ? mimdec->payload_size : 24)) { @@ -286,7 +275,8 @@ gst_mimdec_chain (GstPad *pad, GstBuffer *in) if (diff < 0 || diff > 5000) { diff = 1000; } - mimdec->gst_timestamp += diff * GST_MSECOND; + if (GST_CLOCK_TIME_IS_VALID (mimdec->gst_timestamp)) + mimdec->gst_timestamp += diff * GST_MSECOND; } GST_BUFFER_TIMESTAMP(out_buf) = mimdec->gst_timestamp; mimdec->last_ts = mimdec->current_ts; @@ -335,7 +325,7 @@ gst_mimdec_change_state (GstElement *element, GstStateChange transition) mimdec->buffer_size = -1; mimdec->have_header = FALSE; mimdec->payload_size = -1; - mimdec->gst_timestamp = -1; + mimdec->gst_timestamp = GST_CLOCK_TIME_NONE; mimdec->current_ts = -1; mimdec->last_ts = -1; } |