summaryrefslogtreecommitdiffstats
path: root/gst/audioresample
diff options
context:
space:
mode:
Diffstat (limited to 'gst/audioresample')
-rw-r--r--gst/audioresample/gstaudioresample.c12
-rw-r--r--gst/audioresample/resample_ref.c3
2 files changed, 13 insertions, 2 deletions
diff --git a/gst/audioresample/gstaudioresample.c b/gst/audioresample/gstaudioresample.c
index 2aba0928..cbbfe81a 100644
--- a/gst/audioresample/gstaudioresample.c
+++ b/gst/audioresample/gstaudioresample.c
@@ -353,6 +353,7 @@ static GstFlowReturn
guchar *data;
gulong size;
int outsize;
+ int outsamples;
/* FIXME: move to _inplace */
#if 0
@@ -390,10 +391,17 @@ static GstFlowReturn
}
outsize = resample_get_output_data (r, GST_BUFFER_DATA (outbuf), outsize);
+ outsamples = outsize / r->sample_size;
+ GST_LOG_OBJECT (audioresample, "resample gave me %d bytes or %d samples",
+ outsize, outsamples);
+
GST_BUFFER_TIMESTAMP (outbuf) =
audioresample->offset * GST_SECOND / audioresample->o_rate;
- audioresample->offset += outsize / sizeof (gint16) / audioresample->channels;
- GST_BUFFER_DURATION (outbuf) = outsize * GST_SECOND / audioresample->o_rate;
+ GST_BUFFER_DURATION (outbuf) =
+ outsamples * GST_SECOND / audioresample->o_rate;
+ GST_BUFFER_OFFSET (outbuf) = audioresample->offset;
+ audioresample->offset += outsamples;
+ GST_BUFFER_OFFSET_END (outbuf) = audioresample->offset;
/* check for possible mem corruption */
if (outsize > GST_BUFFER_SIZE (outbuf)) {
diff --git a/gst/audioresample/resample_ref.c b/gst/audioresample/resample_ref.c
index 187f72c4..4cb3d250 100644
--- a/gst/audioresample/resample_ref.c
+++ b/gst/audioresample/resample_ref.c
@@ -111,6 +111,9 @@ resample_scale_ref (ResampleState * r)
-0.5 * r->i_inc, r->i_inc);
buffer = audioresample_buffer_queue_pull (r->queue, r->sample_size);
if (buffer == NULL) {
+ /* FIXME: for the first buffer, this isn't necessarily an error,
+ * since because of the filter length we'll output less buffers.
+ * deal with that so we don't print to console */
RESAMPLE_ERROR ("buffer_queue_pull returned NULL");
return;
}