mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
gst-libs/gst/audio/gstbaseaudiosink.c: Report the latency with the new seglatency parameter.
Original commit message from CVS: * gst-libs/gst/audio/gstbaseaudiosink.c: (gst_base_audio_sink_query): Report the latency with the new seglatency parameter. * gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_debug_spec_buff), (gst_ring_buffer_parse_caps), (gst_ring_buffer_acquire): * gst-libs/gst/audio/gstringbuffer.h: Add new field to the ringbufferspec to specify the expected latency between the underlying device read/write pointer, this is needed when writing sinks that sit a little closer to the hardware. Add some more docs for other fields.
This commit is contained in:
parent
8c3b00be4d
commit
09f7dee84d
4 changed files with 44 additions and 7 deletions
15
ChangeLog
15
ChangeLog
|
@ -1,3 +1,18 @@
|
|||
2008-05-07 Wim Taymans <wim.taymans@collabora.co.uk>
|
||||
|
||||
* gst-libs/gst/audio/gstbaseaudiosink.c:
|
||||
(gst_base_audio_sink_query):
|
||||
Report the latency with the new seglatency parameter.
|
||||
|
||||
* gst-libs/gst/audio/gstringbuffer.c:
|
||||
(gst_ring_buffer_debug_spec_buff), (gst_ring_buffer_parse_caps),
|
||||
(gst_ring_buffer_acquire):
|
||||
* gst-libs/gst/audio/gstringbuffer.h:
|
||||
Add new field to the ringbufferspec to specify the expected latency
|
||||
between the underlying device read/write pointer, this is needed
|
||||
when writing sinks that sit a little closer to the hardware.
|
||||
Add some more docs for other fields.
|
||||
|
||||
2008-05-06 Sebastian Dröge <slomo@circular-chaos.org>
|
||||
|
||||
* gst/volume/gstvolume.c: (volume_transform_ip):
|
||||
|
|
|
@ -333,7 +333,7 @@ gst_base_audio_sink_query (GstElement * element, GstQuery * query)
|
|||
basesink->priv->us_latency = min_l;
|
||||
|
||||
min_latency =
|
||||
gst_util_uint64_scale_int (spec->segtotal * spec->segsize,
|
||||
gst_util_uint64_scale_int (spec->seglatency * spec->segsize,
|
||||
GST_SECOND, spec->rate * spec->bytes_per_sample);
|
||||
|
||||
/* we cannot go lower than the buffer size and the min peer latency */
|
||||
|
|
|
@ -258,6 +258,7 @@ gst_ring_buffer_debug_spec_buff (GstRingBufferSpec * spec)
|
|||
GST_DEBUG ("acquire ringbuffer: latency time: %" G_GINT64_FORMAT " usec",
|
||||
spec->latency_time);
|
||||
GST_DEBUG ("acquire ringbuffer: total segments: %d", spec->segtotal);
|
||||
GST_DEBUG ("acquire ringbuffer: latency segments: %d", spec->seglatency);
|
||||
GST_DEBUG ("acquire ringbuffer: segment size: %d bytes = %d samples",
|
||||
spec->segsize, spec->segsize / spec->bytes_per_sample);
|
||||
GST_DEBUG ("acquire ringbuffer: buffer size: %d bytes = %d samples",
|
||||
|
@ -414,6 +415,9 @@ gst_ring_buffer_parse_caps (GstRingBufferSpec * spec, GstCaps * caps)
|
|||
spec->segsize -= spec->segsize % spec->bytes_per_sample;
|
||||
|
||||
spec->segtotal = spec->buffer_time / spec->latency_time;
|
||||
/* leave the latency undefined now, implementations can change it but if it's
|
||||
* not changed, we assume the same value as segtotal */
|
||||
spec->seglatency = -1;
|
||||
|
||||
gst_ring_buffer_debug_spec_caps (spec);
|
||||
gst_ring_buffer_debug_spec_buff (spec);
|
||||
|
@ -649,6 +653,11 @@ gst_ring_buffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec)
|
|||
if (G_UNLIKELY ((bps = buf->spec.bytes_per_sample) == 0))
|
||||
goto invalid_bps;
|
||||
|
||||
/* if the seglatency was overwritten with something else than -1, use it, else
|
||||
* assume segtotal as the latency */
|
||||
if (buf->spec.seglatency == -1)
|
||||
buf->spec.seglatency = buf->spec.segtotal;
|
||||
|
||||
segsize = buf->spec.segsize;
|
||||
|
||||
buf->samples_per_seg = segsize / bps;
|
||||
|
|
|
@ -200,17 +200,30 @@ struct _GstRingBufferSpec
|
|||
gint rate;
|
||||
gint channels;
|
||||
|
||||
guint64 latency_time; /* the required/actual latency time */
|
||||
guint64 buffer_time; /* the required/actual time of the buffer */
|
||||
gint segsize; /* size of one buffer segment in bytes */
|
||||
gint segtotal; /* total number of segments */
|
||||
|
||||
guint64 latency_time; /* the required/actual latency time, this is the
|
||||
* actual the size of one segment and the
|
||||
* minimum possible latency we can achieve. */
|
||||
guint64 buffer_time; /* the required/actual time of the buffer, this is
|
||||
* the total size of the buffer and maximum
|
||||
* latency we can compensate for. */
|
||||
gint segsize; /* size of one buffer segment in bytes, this value
|
||||
* should be chosen to match latency_time as
|
||||
* well as possible. */
|
||||
gint segtotal; /* total number of segments, this value is the
|
||||
* number of segments of @segsize and should be
|
||||
* chosen so that it matches buffer_time as
|
||||
* close as possible. */
|
||||
/* out */
|
||||
gint bytes_per_sample; /* number of bytes of one sample */
|
||||
guint8 silence_sample[32]; /* bytes representing silence */
|
||||
|
||||
/* ABI added 0.10.20 */
|
||||
gint seglatency; /* number of segments queued in the lower
|
||||
* level device, defaults to segtotal. */
|
||||
|
||||
/*< private >*/
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
/* gpointer _gst_reserved[GST_PADDING]; */
|
||||
guint8 _gst_reserved[(sizeof (gpointer) * GST_PADDING) - sizeof (gint)];
|
||||
};
|
||||
|
||||
#define GST_RING_BUFFER_GET_COND(buf) (((GstRingBuffer *)buf)->cond)
|
||||
|
|
Loading…
Reference in a new issue