audiotestsrc: Max audio frequency is half the rate, not 1/4

https://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem
This commit is contained in:
Vivia Nikolaidou 2019-05-17 16:35:40 +03:00
parent 4a89608f07
commit 843cf07564

View file

@ -245,8 +245,8 @@ gst_audio_test_src_class_init (GstAudioTestSrcClass * klass)
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. "
"The sample rate needs to be at least 4 times higher.",
0.0, (gdouble) G_MAXINT / 4, DEFAULT_FREQ,
"The sample rate needs to be at least 2 times higher.",
0.0, (gdouble) G_MAXINT / 2, 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,
@ -372,7 +372,7 @@ gst_audio_test_src_fixate (GstBaseSrc * bsrc, GstCaps * caps)
GST_DEBUG_OBJECT (src, "fixating samplerate to %d", GST_AUDIO_DEF_RATE);
rate = MAX (GST_AUDIO_DEF_RATE, src->freq * 4);
rate = MAX (GST_AUDIO_DEF_RATE, src->freq * 2);
gst_structure_fixate_field_nearest_int (structure, "rate", rate);
gst_structure_fixate_field_string (structure, "format", DEFAULT_FORMAT_STR);