mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-03 05:59:10 +00:00
audiofilter: Clip input buffers to the segment before handling them
https://bugzilla.gnome.org/show_bug.cgi?id=757068
This commit is contained in:
parent
3dd26bb9e8
commit
736a27fe1e
1 changed files with 24 additions and 0 deletions
|
@ -55,6 +55,8 @@ static gboolean gst_audio_filter_set_caps (GstBaseTransform * btrans,
|
||||||
GstCaps * incaps, GstCaps * outcaps);
|
GstCaps * incaps, GstCaps * outcaps);
|
||||||
static gboolean gst_audio_filter_get_unit_size (GstBaseTransform * btrans,
|
static gboolean gst_audio_filter_get_unit_size (GstBaseTransform * btrans,
|
||||||
GstCaps * caps, gsize * size);
|
GstCaps * caps, gsize * size);
|
||||||
|
static GstFlowReturn gst_audio_filter_submit_input_buffer (GstBaseTransform *
|
||||||
|
btrans, gboolean is_discont, GstBuffer * input);
|
||||||
|
|
||||||
#define do_init G_STMT_START { \
|
#define do_init G_STMT_START { \
|
||||||
GST_DEBUG_CATEGORY_INIT (audiofilter_dbg, "audiofilter", 0, "audiofilter"); \
|
GST_DEBUG_CATEGORY_INIT (audiofilter_dbg, "audiofilter", 0, "audiofilter"); \
|
||||||
|
@ -94,6 +96,7 @@ gst_audio_filter_class_init (GstAudioFilterClass * klass)
|
||||||
basetrans_class->get_unit_size =
|
basetrans_class->get_unit_size =
|
||||||
GST_DEBUG_FUNCPTR (gst_audio_filter_get_unit_size);
|
GST_DEBUG_FUNCPTR (gst_audio_filter_get_unit_size);
|
||||||
basetrans_class->transform_meta = gst_audio_filter_transform_meta;
|
basetrans_class->transform_meta = gst_audio_filter_transform_meta;
|
||||||
|
basetrans_class->submit_input_buffer = gst_audio_filter_submit_input_buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -164,6 +167,27 @@ invalid_format:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GstFlowReturn
|
||||||
|
gst_audio_filter_submit_input_buffer (GstBaseTransform * btrans,
|
||||||
|
gboolean is_discont, GstBuffer * input)
|
||||||
|
{
|
||||||
|
GstAudioFilter *filter = GST_AUDIO_FILTER (btrans);
|
||||||
|
|
||||||
|
if (btrans->segment.format == GST_FORMAT_TIME) {
|
||||||
|
input =
|
||||||
|
gst_audio_buffer_clip (input, &btrans->segment, filter->info.rate,
|
||||||
|
filter->info.bpf);
|
||||||
|
|
||||||
|
if (!input)
|
||||||
|
return GST_FLOW_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
GST_BASE_TRANSFORM_CLASS
|
||||||
|
(gst_audio_filter_parent_class)->submit_input_buffer (btrans, is_discont,
|
||||||
|
input);
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_audio_filter_get_unit_size (GstBaseTransform * btrans, GstCaps * caps,
|
gst_audio_filter_get_unit_size (GstBaseTransform * btrans, GstCaps * caps,
|
||||||
gsize * size)
|
gsize * size)
|
||||||
|
|
Loading…
Reference in a new issue