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
This commit is contained in:
Wim Taymans 2015-11-02 15:54:19 +01:00
parent c688eb0d88
commit bd89f2430b

View file

@ -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);