mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-30 04:00:37 +00:00
7647f7fc4e
Original commit message from CVS: * gst/audioresample/debug.c: * gst/audioresample/gstaudioresample.c: add room for extra overlap samples when asked to transform size protect against possible mem corruption and check for discrepancies between written size and outbuffer's size so we can warn for potential problems * gst/audioresample/resample.c: (resample_init), (resample_get_output_size_for_input), (resample_get_output_size), (resample_set_n_channels), (resample_set_format): set debug level based on RESAMPLE_DEBUG env var make sure that get_output_size* returns a whole number of sample_size set sample_size each time either channel or format is set * gst/audioresample/resample_chunk.c: (resample_scale_chunk): * gst/audioresample/resample_functable.c: (resample_scale_functable): * gst/audioresample/resample_ref.c: (resample_scale_ref): remove r->sample_size, it's done in resample.c now add some debugging to the ref implementation make sure we only give back bytes that are wholes of the sample size
65 lines
1.2 KiB
C
65 lines
1.2 KiB
C
|
|
#ifdef HAVE_CONFIG_H
|
|
#include "config.h"
|
|
#endif
|
|
|
|
#include <glib.h>
|
|
#include <stdio.h>
|
|
#include <debug.h>
|
|
|
|
static const char *resample_debug_level_names[] = {
|
|
"NONE",
|
|
"ERROR",
|
|
"WARNING",
|
|
"INFO",
|
|
"DEBUG",
|
|
"LOG"
|
|
};
|
|
|
|
static int resample_debug_level = RESAMPLE_LEVEL_ERROR;
|
|
|
|
void
|
|
resample_debug_log (int level, const char *file, const char *function,
|
|
int line, const char *format, ...)
|
|
{
|
|
#ifndef GLIB_COMPAT
|
|
va_list varargs;
|
|
char *s;
|
|
|
|
if (level > resample_debug_level)
|
|
return;
|
|
|
|
va_start (varargs, format);
|
|
s = g_strdup_vprintf (format, varargs);
|
|
va_end (varargs);
|
|
|
|
fprintf (stderr, "RESAMPLE: %s: %s(%d): %s: %s\n",
|
|
resample_debug_level_names[level], file, line, function, s);
|
|
g_free (s);
|
|
#else
|
|
va_list varargs;
|
|
char s[1000];
|
|
|
|
if (level > resample_debug_level)
|
|
return;
|
|
|
|
va_start (varargs, format);
|
|
vsnprintf (s, 999, format, varargs);
|
|
va_end (varargs);
|
|
|
|
fprintf (stderr, "RESAMPLE: %s: %s(%d): %s: %s\n",
|
|
resample_debug_level_names[level], file, line, function, s);
|
|
#endif
|
|
}
|
|
|
|
void
|
|
resample_debug_set_level (int level)
|
|
{
|
|
resample_debug_level = level;
|
|
}
|
|
|
|
int
|
|
resample_debug_get_level (void)
|
|
{
|
|
return resample_debug_level;
|
|
}
|