mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 02:31:03 +00:00
ext/alsa/gstalsasrc.c: don't use a fixed buffer size when writing variable length data to it. Fixes memory corruption...
Original commit message from CVS: * ext/alsa/gstalsasrc.c: (gst_alsa_src_loop): don't use a fixed buffer size when writing variable length data to it. Fixes memory corruption and makes alsasrc work
This commit is contained in:
parent
9e9573ff1f
commit
f1479afe49
2 changed files with 14 additions and 4 deletions
|
@ -1,3 +1,9 @@
|
|||
2004-05-09 Benjamin Otte <otte@gnome.org>
|
||||
|
||||
* ext/alsa/gstalsasrc.c: (gst_alsa_src_loop):
|
||||
don't use a fixed buffer size when writing variable length data to
|
||||
it. Fixes memory corruption and makes alsasrc work
|
||||
|
||||
2004-05-09 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
||||
|
||||
* ext/gnomevfs/gstgnomevfssink.c:
|
||||
|
|
|
@ -346,15 +346,18 @@ gst_alsa_src_loop (GstElement * element)
|
|||
g_assert (avail >= this->period_size);
|
||||
/* make sure every pad has a buffer */
|
||||
for (i = 0; i < element->numpads; i++) {
|
||||
if (!src->buf[i]) {
|
||||
src->buf[i] = gst_buffer_new_and_alloc (4096);
|
||||
}
|
||||
if (src->buf[i])
|
||||
gst_data_unref (GST_DATA (src->buf[i]));
|
||||
src->buf[i] =
|
||||
gst_buffer_new_and_alloc (gst_alsa_samples_to_bytes (this, avail));
|
||||
}
|
||||
/* fill buffer with data */
|
||||
if ((copied = this->transmit (this, &avail)) <= 0)
|
||||
return;
|
||||
/* push the buffers out and let them have fun */
|
||||
for (i = 0; i < element->numpads; i++) {
|
||||
GstBuffer *buf;
|
||||
|
||||
if (!src->buf[i])
|
||||
return;
|
||||
if (copied != this->period_size)
|
||||
|
@ -363,8 +366,9 @@ gst_alsa_src_loop (GstElement * element)
|
|||
gst_alsa_samples_to_timestamp (this, this->transmitted);
|
||||
GST_BUFFER_DURATION (src->buf[i]) =
|
||||
gst_alsa_samples_to_timestamp (this, copied);
|
||||
gst_pad_push (this->pad[i], GST_DATA (src->buf[i]));
|
||||
buf = src->buf[i];
|
||||
src->buf[i] = NULL;
|
||||
gst_pad_push (this->pad[i], GST_DATA (buf));
|
||||
}
|
||||
this->transmitted += copied;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue