summaryrefslogtreecommitdiff
path: root/sys/oss
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2004-06-16 10:48:04 +0000
committerWim Taymans <wim.taymans@gmail.com>2004-06-16 10:48:04 +0000
commitdfcce4707593fc6c2aa9a55a7e21dab97b444242 (patch)
treed558c4d549b020841859124715a4a46a6150278d /sys/oss
parent31583fcae3352712757b0de83c1630abcde02f2c (diff)
sys/oss/gstosssrc.c: Timestamp fixes.
Original commit message from CVS: * sys/oss/gstosssrc.c: (gst_osssrc_get): Timestamp fixes.
Diffstat (limited to 'sys/oss')
-rw-r--r--sys/oss/gstosssrc.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/sys/oss/gstosssrc.c b/sys/oss/gstosssrc.c
index 31d9fc1ce..704b480e4 100644
--- a/sys/oss/gstosssrc.c
+++ b/sys/oss/gstosssrc.c
@@ -374,13 +374,28 @@ gst_osssrc_get (GstPad * pad)
GST_BUFFER_SIZE (buf) = readbytes;
GST_BUFFER_OFFSET (buf) = src->curoffset;
- /* FIXME: we are falsely assuming that we are the master clock here */
- GST_BUFFER_TIMESTAMP (buf) =
- src->curoffset * GST_SECOND / GST_OSSELEMENT (src)->bps;
GST_BUFFER_DURATION (buf) =
(GST_SECOND * GST_BUFFER_SIZE (buf)) / (GST_OSSELEMENT (src)->bps *
GST_OSSELEMENT (src)->rate);
+ /* if we have a clock */
+ if (src->clock) {
+ if (src->clock == src->provided_clock) {
+ /* if it's our own clock, we can be very accurate */
+ GST_BUFFER_TIMESTAMP (buf) =
+ src->curoffset * GST_SECOND / GST_OSSELEMENT (src)->bps;
+ } else {
+ /* somebody elses clock, timestamp with that clock, no discontinuity in
+ * the stream since the OFFSET is updated correctly. Elements can stretch
+ * to match timestamps */
+ GST_BUFFER_TIMESTAMP (buf) =
+ gst_element_get_time (GST_ELEMENT (src)) - GST_BUFFER_DURATION (buf);
+ }
+ } else {
+ /* no clock, no timestamp */
+ GST_BUFFER_TIMESTAMP (buf) = GST_CLOCK_TIME_NONE;
+ }
+
src->curoffset += readbytes;
GST_DEBUG ("pushed buffer from soundcard of %ld bytes, timestamp %"