Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test-awhitening issue #216

Closed
niugx opened this issue Dec 6, 2018 · 3 comments
Closed

test-awhitening issue #216

niugx opened this issue Dec 6, 2018 · 3 comments

Comments

@niugx
Copy link

niugx commented Dec 6, 2018

root@ubuntu:/opt/aubio-0.4.7/build/tests# gdb ./test-awhitening
......
(gdb) b source.c:129
No source file named source.c.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (source.c:129) pending.
(gdb) r
Starting program: /opt/aubio-0.4.7/build/tests/test-awhitening ../../../ringback.wav output_path/ringback.wav
spectral whitening relaxation time is 20.000000

Breakpoint 1, aubio_source_do (s=0x6058e0, data=0x603010, read=0x7fffffffe2e8) at ../src/io/source.c:129
129 s->s_do((void *)s->source, data, read);
(gdb) p s->s_do
$1 = (aubio_source_do_t) 0x7ffff7bb1bae <aubio_source_sndfile_do>
(gdb) c
Continuing.

Breakpoint 1, aubio_source_do (s=0x6058e0, data=0x603010, read=0x7fffffffe2e8) at ../src/io/source.c:129
129 s->s_do((void *)s->source, data, read);
(gdb) p s->s_do
$2 = (aubio_source_do_t) 0x31c3ec8fe64674a
(gdb) c
Continuing.

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7bb1725 in aubio_source_do (s=0x6058e0, data=0x603010, read=0x7fffffffe2e8) at ../src/io/source.c:129
129 s->s_do((void *)s->source, data, read);
(gdb)

@piem
Copy link
Member

piem commented Dec 6, 2018

hi @niugx

Thanks for the report. I could not reproduce it, and I see no reason why s->s_do would change. Can you confirm you can reproduce from HEAD?

I've just pushed a branch fix/awhitening that should fix the other issue in the test program.

Best, piem

@niugx
Copy link
Author

niugx commented Dec 6, 2018

hi @piem

Are you modify line 48 of test-awhitening.c like follwing?

48 new_aubio_spectral_whitening (win_size*4, hop_size, samplerate);

modify the first parameter of new_aubio_spectral_whitening to "win_size*4", may cause fftgrain->norm[i] of line 49 of awhitening.c array write overflow, i think maybe this is reason.

43 aubio_spectral_whitening_do (aubio_spectral_whitening_t * o, cvec_t * fftgrain)
44 {
45 uint_t i = 0;
46 for (i = 0; i < o->peak_values->length; i++) {
47 smpl_t tmp = MAX(o->r_decay * o->peak_values->data[i], o->floor);
48 o->peak_values->data[i] = MAX(fftgrain->norm[i], tmp);
49 fftgrain->norm[i] /= o->peak_values->data[i];
50 }
}

when remove line 60 of test-awhitening.c, this issue doesn't occur.
60 // aubio_spectral_whitening_do(awhitening, fftgrain);

you can try this again?

@piem
Copy link
Member

piem commented Dec 6, 2018

Ok, well, I have just pushed a fix for this one.

However, note that you will find several ways to create pipelines that crash. Most aubio_..._do functions do not have such checks in place. The reason is mostly optimization, since these functions are meant to be run in the audio thread, where is no easy way to recover from a failure. Using asserts in debug mode might be more appropriate for these.

@piem piem closed this as completed in ed80243 Dec 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants