History

Fix a bug where src_callback_read() would hand under varying src_ratio.

Erik de Castro Lopo committed 19 years ago

Commit 2efc6b91 parent c61d92b4 files · +22 −27Browse files

Unified · Split

4 files
  1. ChangeLog +10 −0
  2. src/src_linear.c +4 −4
  3. src/src_sinc.c +3 −11
  4. src/src_zoh.c +5 −12
ChangeLog+10−0
@@ -3,6 +3,16 @@ · 2 unmodified lines
3 * src/samplerate.c3 * src/samplerate.c
4 Refactor checking of supplied src ratio against min and max.4 Refactor checking of supplied src ratio against min and max.
5 5
6 * configure.ac
7 Remove -pendantic from CFLAGS and add -std=gnu99.
8
9 * tests/callback_hang_test.c tests/Makefile.am
10 Add new test program and hook it into build.
11
12 * src/src_linear.c src/src_sinc.c src/src_zoh.c
13 Fix a bug where the src_callback_read () function would hang under varying
14 src_ratio.
15
62007-01-21 Erik de Castro Lopo <erikd AT mega-nerd DOT com>162007-01-21 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
7 17
8 * doc/api.html doc/api_callback.html doc/api_misc.html18 * doc/api.html doc/api_callback.html doc/api_misc.html
src/src_linear.c+4−4
@@ -83,8 +83,8 @@ linear_vari_process (SRC_PRIVATE *psrc, SRC_DATA *data) · 82 unmodified lines
83 if (linear->in_used + linear->channels * input_index > linear->in_count)83 if (linear->in_used + linear->channels * input_index > linear->in_count)
84 break ;84 break ;
85 85
86 if (fabs (psrc->last_ratio - data->src_ratio) > SRC_MIN_RATIO_DIFF)86 if (linear->out_count > 0 && fabs (psrc->last_ratio - data->src_ratio) > SRC_MIN_RATIO_DIFF)
87 src_ratio = psrc->last_ratio + linear->out_gen * (data->src_ratio - psrc->last_ratio) / (linear->out_count - 1) ;87 src_ratio = psrc->last_ratio + linear->out_gen * (data->src_ratio - psrc->last_ratio) / linear->out_count ;
88 88
89 for (ch = 0 ; ch < linear->channels ; ch++)89 for (ch = 0 ; ch < linear->channels ; ch++)
90 { data->data_out [linear->out_gen] = (float) (linear->last_value [ch] + input_index *90 { data->data_out [linear->out_gen] = (float) (linear->last_value [ch] + input_index *
@@ -103,8 +103,8 @@ linear_vari_process (SRC_PRIVATE *psrc, SRC_DATA *data) · 12 unmodified lines
103 /* Main processing loop. */103 /* Main processing loop. */
104 while (linear->out_gen < linear->out_count && linear->in_used + linear->channels * input_index <= linear->in_count)104 while (linear->out_gen < linear->out_count && linear->in_used + linear->channels * input_index <= linear->in_count)
105 {105 {
106 if (fabs (psrc->last_ratio - data->src_ratio) > SRC_MIN_RATIO_DIFF)106 if (linear->out_count > 0 && fabs (psrc->last_ratio - data->src_ratio) > SRC_MIN_RATIO_DIFF)
107 src_ratio = psrc->last_ratio + linear->out_gen * (data->src_ratio - psrc->last_ratio) / (linear->out_count - 1) ;107 src_ratio = psrc->last_ratio + linear->out_gen * (data->src_ratio - psrc->last_ratio) / linear->out_count ;
108 108
109 if (SRC_DEBUG && linear->in_used < linear->channels && input_index < 1.0)109 if (SRC_DEBUG && linear->in_used < linear->channels && input_index < 1.0)
110 { printf ("Whoops!!!! in_used : %ld channels : %d input_index : %f\n", linear->in_used, linear->channels, input_index) ;110 { printf ("Whoops!!!! in_used : %ld channels : %d input_index : %f\n", linear->in_used, linear->channels, input_index) ;
src/src_sinc.c+3−11
@@ -1,5 +1,5 @@
1/*1/*
2** Copyright (C) 2002-2006 Erik de Castro Lopo <erikd@mega-nerd.com>2** Copyright (C) 2002-2007 Erik de Castro Lopo <erikd@mega-nerd.com>
3**3**
4** This program is free software; you can redistribute it and/or modify4** This program is free software; you can redistribute it and/or modify
5** it under the terms of the GNU General Public License as published by5** it under the terms of the GNU General Public License as published by
@@ -307,8 +307,8 @@ sinc_vari_process (SRC_PRIVATE *psrc, SRC_DATA *data) · 301 unmodified lines
307 break ;307 break ;
308 } ;308 } ;
309 309
310 if (fabs (psrc->last_ratio - data->src_ratio) > 1e-10)310 if (filter->out_count > 0 && fabs (psrc->last_ratio - data->src_ratio) > 1e-10)
311 src_ratio = psrc->last_ratio + filter->out_gen * (data->src_ratio - psrc->last_ratio) / (filter->out_count - 1) ;311 src_ratio = psrc->last_ratio + filter->out_gen * (data->src_ratio - psrc->last_ratio) / filter->out_count ;
312 312
313 float_increment = filter->index_inc * 1.0 ;313 float_increment = filter->index_inc * 1.0 ;
314 if (src_ratio < 1.0)314 if (src_ratio < 1.0)
@@ -466,11 +466,3 @@ calc_output (SINC_FILTER *filter, increment_t increment, increment_t start_filte · 151 unmodified lines
466 return (left + right) ;466 return (left + right) ;
467} /* calc_output */467} /* calc_output */
468 468
469/*
470** Do not edit or modify anything in this comment block.
471** The arch-tag line is a file identity tag for the GNU Arch
472** revision control system.
473**
474** arch-tag: db8efe06-2fbd-487e-be8f-bfc01e68c19f
475*/
476
src/src_zoh.c+5−12
@@ -1,5 +1,5 @@
1/*1/*
2** Copyright (C) 2002-2006 Erik de Castro Lopo <erikd@mega-nerd.com>2** Copyright (C) 2002-2007 Erik de Castro Lopo <erikd@mega-nerd.com>
3**3**
4** This program is free software; you can redistribute it and/or modify4** This program is free software; you can redistribute it and/or modify
5** it under the terms of the GNU General Public License as published by5** it under the terms of the GNU General Public License as published by
@@ -81,8 +81,8 @@ zoh_vari_process (SRC_PRIVATE *psrc, SRC_DATA *data) · 75 unmodified lines
81 if (zoh->in_used + zoh->channels * input_index >= zoh->in_count)81 if (zoh->in_used + zoh->channels * input_index >= zoh->in_count)
82 break ;82 break ;
83 83
84 if (fabs (psrc->last_ratio - data->src_ratio) > SRC_MIN_RATIO_DIFF)84 if (zoh->out_count > 0 && fabs (psrc->last_ratio - data->src_ratio) > SRC_MIN_RATIO_DIFF)
85 src_ratio = psrc->last_ratio + zoh->out_gen * (data->src_ratio - psrc->last_ratio) / (zoh->out_count - 1) ;85 src_ratio = psrc->last_ratio + zoh->out_gen * (data->src_ratio - psrc->last_ratio) / zoh->out_count ;
86 86
87 for (ch = 0 ; ch < zoh->channels ; ch++)87 for (ch = 0 ; ch < zoh->channels ; ch++)
88 { data->data_out [zoh->out_gen] = zoh->last_value [ch] ;88 { data->data_out [zoh->out_gen] = zoh->last_value [ch] ;
@@ -100,8 +100,8 @@ zoh_vari_process (SRC_PRIVATE *psrc, SRC_DATA *data) · 11 unmodified lines
100 /* Main processing loop. */100 /* Main processing loop. */
101 while (zoh->out_gen < zoh->out_count && zoh->in_used + zoh->channels * input_index <= zoh->in_count)101 while (zoh->out_gen < zoh->out_count && zoh->in_used + zoh->channels * input_index <= zoh->in_count)
102 {102 {
103 if (fabs (psrc->last_ratio - data->src_ratio) > SRC_MIN_RATIO_DIFF)103 if (zoh->out_count > 0 && fabs (psrc->last_ratio - data->src_ratio) > SRC_MIN_RATIO_DIFF)
104 src_ratio = psrc->last_ratio + zoh->out_gen * (data->src_ratio - psrc->last_ratio) / (zoh->out_count - 1) ;104 src_ratio = psrc->last_ratio + zoh->out_gen * (data->src_ratio - psrc->last_ratio) / zoh->out_count ;
105 105
106 for (ch = 0 ; ch < zoh->channels ; ch++)106 for (ch = 0 ; ch < zoh->channels ; ch++)
107 { data->data_out [zoh->out_gen] = data->data_in [zoh->in_used - zoh->channels + ch] ;107 { data->data_out [zoh->out_gen] = data->data_in [zoh->in_used - zoh->channels + ch] ;
@@ -208,11 +208,4 @@ zoh_reset (SRC_PRIVATE *psrc) · 100 unmodified lines
208 208
209 return ;209 return ;
210} /* zoh_reset */210} /* zoh_reset */
211/*
212** Do not edit or modify anything in this comment block.
213** The arch-tag line is a file identity tag for the GNU Arch
214** revision control system.
215**
216** arch-tag: 808e62f8-2e4a-44a6-840f-180a3e41af01
217*/
218 211

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t