summaryrefslogtreecommitdiffstats
path: root/gst/audioresample/gstaudioresample.c
diff options
context:
space:
mode:
authorThomas Vander Stichele <thomas@apestaart.org>2005-08-26 17:35:28 +0000
committerThomas Vander Stichele <thomas@apestaart.org>2005-08-26 17:35:28 +0000
commitfb39749b0fe905830e330e643cc5c92f3ecef407 (patch)
treeddc1ee6d2cf7347a5524fdc08965beaa1b1319e3 /gst/audioresample/gstaudioresample.c
parent282065617d0b4c73a3cb89b118a5f161c96ac773 (diff)
downloadgst-plugins-bad-fb39749b0fe905830e330e643cc5c92f3ecef407.tar.gz
gst-plugins-bad-fb39749b0fe905830e330e643cc5c92f3ecef407.tar.bz2
gst-plugins-bad-fb39749b0fe905830e330e643cc5c92f3ecef407.zip
use base class' newsegment to properly timestamp
Original commit message from CVS: use base class' newsegment to properly timestamp
Diffstat (limited to 'gst/audioresample/gstaudioresample.c')
-rw-r--r--gst/audioresample/gstaudioresample.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gst/audioresample/gstaudioresample.c b/gst/audioresample/gstaudioresample.c
index 02537075..79a4d285 100644
--- a/gst/audioresample/gstaudioresample.c
+++ b/gst/audioresample/gstaudioresample.c
@@ -295,9 +295,12 @@ gboolean
} else {
/* take a best guess, this is called cheating */
*othersize = floor (size * state->i_rate / state->o_rate);
+ *othersize -= *othersize % state->sample_size;
}
*othersize += state->sample_size;
+ g_assert (*othersize % state->sample_size == 0);
+
/* we make room for one extra sample, given that the resampling filter
* can output an extra one for non-integral i_rate/o_rate */
GST_DEBUG_OBJECT (base, "transformed size %d to %d", size, *othersize);
@@ -396,7 +399,7 @@ static GstFlowReturn
outsize, outsamples);
GST_BUFFER_OFFSET (outbuf) = audioresample->offset;
- GST_BUFFER_TIMESTAMP (outbuf) =
+ GST_BUFFER_TIMESTAMP (outbuf) = base->segment_start +
audioresample->offset * GST_SECOND / audioresample->o_rate;
audioresample->offset += outsamples;
@@ -405,7 +408,7 @@ static GstFlowReturn
/* we calculate DURATION as the difference between "next" timestamp
* and current timestamp so we ensure a contiguous stream, instead of
* having rounding errors. */
- GST_BUFFER_DURATION (outbuf) =
+ GST_BUFFER_DURATION (outbuf) = base->segment_start +
audioresample->offset * GST_SECOND / audioresample->o_rate -
GST_BUFFER_TIMESTAMP (outbuf);