gst-libs/gst/audio/gstringbuffer.c

Original commit message from CVS:
2006-02-09  Andy Wingo  <wingo@pobox.com>

* gst-libs/gst/audio/gstringbuffer.c
(gst_ring_buffer_samples_done): Cast to guint64, fixes an integer
overflow after 13.5 hours of recording. Kapow!

* ext/alsa/gstalsasrc.c (gst_alsasrc_delay): Clamp the delay to
the buffer size -- we don't care about underrun/overrun reporting
right now, just need to return a useful value.
This commit is contained in:
Andy Wingo 2006-02-09 11:36:18 +00:00
parent 7b47d0fbb0
commit 4ae63e7361
3 changed files with 24 additions and 21 deletions

View file

@ -1,3 +1,13 @@
2006-02-09 Andy Wingo <wingo@pobox.com>
* gst-libs/gst/audio/gstringbuffer.c
(gst_ring_buffer_samples_done): Cast to guint64, fixes an integer
overflow after 13.5 hours of recording. Kapow!
* ext/alsa/gstalsasrc.c (gst_alsasrc_delay): Clamp the delay to
the buffer size -- we don't care about underrun/overrun reporting
right now, just need to return a useful value.
2006-02-09 Jan Schmidt <thaytan@mad.scientist.com>
* configure.ac:
@ -57,6 +67,7 @@
frame right at offset 0 and if so suggest mpeg/audio
caps with a very low probability (#153004).
>>>>>>> 1.2367
2006-02-07 Andy Wingo <wingo@pobox.com>
* gst/tcp/gsttcpclientsrc.c (gst_tcp_client_src_create): Switch to

View file

@ -684,7 +684,7 @@ gst_alsasrc_delay (GstAudioSrc * asrc)
snd_pcm_delay (alsa->handle, &delay);
return delay;
return CLAMP (delay, 0, alsa->buffer_size);
}
static void

View file

@ -980,7 +980,7 @@ gst_ring_buffer_samples_done (GstRingBuffer * buf)
/* and the number of samples not yet processed */
delay = gst_ring_buffer_delay (buf);
samples = (segdone * buf->samples_per_seg);
samples = ((guint64) segdone) * buf->samples_per_seg);
raw = samples;
if (samples >= delay)
@ -1006,8 +1006,7 @@ gst_ring_buffer_samples_done (GstRingBuffer * buf)
*
* MT safe.
*/
void
gst_ring_buffer_set_sample (GstRingBuffer * buf, guint64 sample)
void gst_ring_buffer_set_sample (GstRingBuffer * buf, guint64 sample)
{
g_return_if_fail (buf != NULL);
@ -1036,8 +1035,7 @@ gst_ring_buffer_set_sample (GstRingBuffer * buf, guint64 sample)
*
* MT safe.
*/
void
gst_ring_buffer_clear_all (GstRingBuffer * buf)
void gst_ring_buffer_clear_all (GstRingBuffer * buf)
{
gint i;
@ -1055,8 +1053,7 @@ gst_ring_buffer_clear_all (GstRingBuffer * buf)
}
static gboolean
wait_segment (GstRingBuffer * buf)
static gboolean wait_segment (GstRingBuffer * buf)
{
/* buffer must be started now or we deadlock since nobody is reading */
if (g_atomic_int_get (&buf->state) != GST_RING_BUFFER_STATE_STARTED) {
@ -1120,9 +1117,8 @@ flushing:
* MT safe.
*/
guint
gst_ring_buffer_commit (GstRingBuffer * buf, guint64 sample, guchar * data,
guint len)
{
gst_ring_buffer_commit (GstRingBuffer * buf, guint64 sample, guchar * data,
guint len) {
gint segdone;
gint segsize, segtotal, bps, sps;
guint8 *dest;
@ -1227,9 +1223,8 @@ not_started:
* MT safe.
*/
guint
gst_ring_buffer_read (GstRingBuffer * buf, guint64 sample, guchar * data,
guint len)
{
gst_ring_buffer_read (GstRingBuffer * buf, guint64 sample, guchar * data,
guint len) {
gint segdone;
gint segsize, segtotal, bps, sps;
guint8 *dest;
@ -1333,9 +1328,8 @@ not_started:
* MT safe.
*/
gboolean
gst_ring_buffer_prepare_read (GstRingBuffer * buf, gint * segment,
guint8 ** readptr, gint * len)
{
gst_ring_buffer_prepare_read (GstRingBuffer * buf, gint * segment,
guint8 ** readptr, gint * len) {
guint8 *data;
gint segdone;
@ -1378,8 +1372,7 @@ gst_ring_buffer_prepare_read (GstRingBuffer * buf, gint * segment,
*
* MT safe.
*/
void
gst_ring_buffer_advance (GstRingBuffer * buf, guint advance)
void gst_ring_buffer_advance (GstRingBuffer * buf, guint advance)
{
g_return_if_fail (buf != NULL);
@ -1407,8 +1400,7 @@ gst_ring_buffer_advance (GstRingBuffer * buf, guint advance)
*
* MT safe.
*/
void
gst_ring_buffer_clear (GstRingBuffer * buf, gint segment)
void gst_ring_buffer_clear (GstRingBuffer * buf, gint segment)
{
guint8 *data;