From bd89f2430bd34f57808f3cf67185db1b647ad128 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 2 Nov 2015 15:54:19 +0100 Subject: [PATCH] audiotestsrc: increase freq limit Raise the frequency limit and try to negotiate to a samplerate of 4*freq when larger then the default samplerate. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=754450 --- gst/audiotestsrc/gstaudiotestsrc.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/gst/audiotestsrc/gstaudiotestsrc.c b/gst/audiotestsrc/gstaudiotestsrc.c index c5ab4c4..15cb4a3 100644 --- a/gst/audiotestsrc/gstaudiotestsrc.c +++ b/gst/audiotestsrc/gstaudiotestsrc.c @@ -180,8 +180,9 @@ gst_audio_test_src_class_init (GstAudioTestSrcClass * klass) GST_TYPE_AUDIO_TEST_SRC_WAVE, GST_AUDIO_TEST_SRC_WAVE_SINE, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_FREQ, - g_param_spec_double ("freq", "Frequency", "Frequency of test signal", - 0.0, 20000.0, DEFAULT_FREQ, + g_param_spec_double ("freq", "Frequency", "Frequency of test signal. " + "The sample rate needs to be at least 4 times higher.", + 0.0, (gdouble) G_MAXINT / 4, DEFAULT_FREQ, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_VOLUME, g_param_spec_double ("volume", "Volume", "Volume of test signal", 0.0, @@ -267,7 +268,7 @@ gst_audio_test_src_fixate (GstBaseSrc * bsrc, GstCaps * caps) { GstAudioTestSrc *src = GST_AUDIO_TEST_SRC (bsrc); GstStructure *structure; - gint channels; + gint channels, rate; caps = gst_caps_make_writable (caps); @@ -275,8 +276,8 @@ gst_audio_test_src_fixate (GstBaseSrc * bsrc, GstCaps * caps) GST_DEBUG_OBJECT (src, "fixating samplerate to %d", GST_AUDIO_DEF_RATE); - gst_structure_fixate_field_nearest_int (structure, "rate", - GST_AUDIO_DEF_RATE); + rate = MAX (GST_AUDIO_DEF_RATE, src->freq * 4); + gst_structure_fixate_field_nearest_int (structure, "rate", rate); gst_structure_fixate_field_string (structure, "format", DEFAULT_FORMAT_STR); -- 2.7.4