mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 09:40:37 +00:00
sys/oss/gstosssrc.c: Timestamp fixes.
Original commit message from CVS: * sys/oss/gstosssrc.c: (gst_osssrc_get): Timestamp fixes.
This commit is contained in:
parent
31583fcae3
commit
dfcce47075
2 changed files with 23 additions and 3 deletions
|
@ -1,3 +1,8 @@
|
|||
2004-06-16 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
* sys/oss/gstosssrc.c: (gst_osssrc_get):
|
||||
Timestamp fixes.
|
||||
|
||||
2004-06-16 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
* sys/v4l/gstv4lsrc.c: (gst_v4lsrc_sync_mode_get_type),
|
||||
|
|
|
@ -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 %"
|
||||
|
|
Loading…
Reference in a new issue