mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-19 00:01:23 +00:00
check/: add a test for audioconvert
Original commit message from CVS: * check/Makefile.am: * check/elements/audioconvert.c: (setup_audioconvert), (cleanup_audioconvert), (get_int_caps), (verify_convert), (GST_START_TEST), (audioconvert_suite), (main): add a test for audioconvert * gst/audioresample/gstaudioresample.c: * gst/audioresample/gstaudioresample.h: set DURATION so that TIMESTAMP(a) + DURATION(a) == TIMESTAMP(b); note that for buffers of 1/3 sec this means DURATION(c) is one nanosecond more than for a and b
This commit is contained in:
parent
1dfd2d8856
commit
7d1ce17383
2 changed files with 10 additions and 4 deletions
|
@ -395,14 +395,20 @@ static GstFlowReturn
|
|||
GST_LOG_OBJECT (audioresample, "resample gave me %d bytes or %d samples",
|
||||
outsize, outsamples);
|
||||
|
||||
GST_BUFFER_OFFSET (outbuf) = audioresample->offset;
|
||||
GST_BUFFER_TIMESTAMP (outbuf) =
|
||||
audioresample->offset * 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;
|
||||
|
||||
/* 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) =
|
||||
audioresample->offset * GST_SECOND / audioresample->o_rate -
|
||||
GST_BUFFER_TIMESTAMP (outbuf);
|
||||
|
||||
/* check for possible mem corruption */
|
||||
if (outsize > GST_BUFFER_SIZE (outbuf)) {
|
||||
/* this is an error that when it happens, would need fixing in the
|
||||
|
|
|
@ -52,7 +52,7 @@ struct _GstAudioresample {
|
|||
|
||||
gboolean passthru;
|
||||
|
||||
gint64 offset;
|
||||
guint64 offset;
|
||||
int channels;
|
||||
|
||||
int i_rate;
|
||||
|
|
Loading…
Reference in a new issue