spectrum: more comments and tune and logging

This commit is contained in:
Stefan Kost 2011-03-10 14:29:25 +02:00
parent 1a32265b51
commit 32afdea96d

View file

@ -949,12 +949,20 @@ gst_spectrum_transform_ip (GstBaseTransform * trans, GstBuffer * buffer)
gst_spectrum_alloc_channel_data (spectrum); gst_spectrum_alloc_channel_data (spectrum);
/* number of sample frames we process before posting a message
* interval is in ns */
spectrum->frames_per_interval = spectrum->frames_per_interval =
gst_util_uint64_scale (spectrum->interval, rate, GST_SECOND); gst_util_uint64_scale (spectrum->interval, rate, GST_SECOND);
/* rounding error in ns, aggregated it in accumulated_error */
spectrum->error_per_interval = (spectrum->interval * rate) % GST_SECOND; spectrum->error_per_interval = (spectrum->interval * rate) % GST_SECOND;
if (spectrum->frames_per_interval == 0) if (spectrum->frames_per_interval == 0)
spectrum->frames_per_interval = 1; spectrum->frames_per_interval = 1;
GST_INFO_OBJECT (spectrum, "interval %" GST_TIME_FORMAT ", fpi %"
G_GUINT64_FORMAT ", error %" GST_TIME_FORMAT,
GST_TIME_ARGS (spectrum->interval), spectrum->frames_per_interval,
GST_TIME_ARGS (spectrum->error_per_interval));
spectrum->input_pos = 0; spectrum->input_pos = 0;
gst_spectrum_flush (spectrum); gst_spectrum_flush (spectrum);
@ -995,9 +1003,8 @@ gst_spectrum_transform_ip (GstBaseTransform * trans, GstBuffer * buffer)
/* Do we have the FFTs for one interval? */ /* Do we have the FFTs for one interval? */
if (have_full_interval) { if (have_full_interval) {
GST_DEBUG_OBJECT (spectrum, "nfft: %u frames: %" G_GUINT64_FORMAT
GST_INFO ("nfft: %u num_frames: %" G_GUINT64_FORMAT " fpi: %" " fpi: %" G_GUINT64_FORMAT " error: %" GST_TIME_FORMAT, nfft,
G_GUINT64_FORMAT " error: %" GST_TIME_FORMAT, nfft,
spectrum->num_frames, spectrum->frames_per_interval, spectrum->num_frames, spectrum->frames_per_interval,
GST_TIME_ARGS (spectrum->accumulated_error)); GST_TIME_ARGS (spectrum->accumulated_error));
@ -1062,8 +1069,8 @@ gst_spectrum_transform_ip (GstBaseTransform * trans, GstBuffer * buffer)
/* Do we have the FFTs for one interval? */ /* Do we have the FFTs for one interval? */
if (have_full_interval) { if (have_full_interval) {
GST_INFO ("nfft: %u num_frames: %" G_GUINT64_FORMAT " fpi: %" GST_DEBUG_OBJECT (spectrum, "nfft: %u frames: %" G_GUINT64_FORMAT
G_GUINT64_FORMAT " error: %" GST_TIME_FORMAT, nfft, " fpi: %" G_GUINT64_FORMAT " error: %" GST_TIME_FORMAT, nfft,
spectrum->num_frames, spectrum->frames_per_interval, spectrum->num_frames, spectrum->frames_per_interval,
GST_TIME_ARGS (spectrum->accumulated_error)); GST_TIME_ARGS (spectrum->accumulated_error));