Hi All,
arecord is failing vumeter option -V stereo only.
localhost ~ # arecord -Dhw:1,2 -r48000 -c2 -fS32_LE /tmp/test_record.wav -M -d 1 -V stereo Recording WAVE '/tmp/test_record.wav' : Signed 32 bit Little Endian, Rate 48000 Hz, Stereo *** buffer overflow detected ***: terminated Aborted by signal Aborted...
Please provide pointers to debug this option.
Thanks Sujith
1.2.1.2
On Fri, 20 Aug, 2021, 12:04 AM folkert, folkert@vanheusden.com wrote:
arecord is failing vumeter option -V stereo only.
What version? Because the commandline you provide works fine here with 1.2.4-1ubuntu3.
Hi Folkert,
In all version it is crashing. when i debug these i found that p value is coming negative at memset. the function snippet is: in aplay.c file in alsa-utils.
in the below function for c=0 it is working when c incremented to 1 the p value is becoming negative . so memset is crashing.
static void print_vu_meter_stereo(int *perc, int *maxperc) { const int bar_length = 35; char line[80]; int c;
memset(line, ' ', sizeof(line) - 1); line[bar_length + 3] = '|';
for (c = 0; c < 2; c++) { int p = perc[c] * bar_length / 100; char tmp[4]; if (p > bar_length) p = bar_length; if (c) memset(line + bar_length + 6 + 1, '#', p); ----------------//this is the line where it is crashing.here p value is becoming negative at c=1.As we see if we change the p value to bar_length it works fine ..As it is a player issue not a driver issue.
else memset(line + bar_length - p - 1, '#', p); p = maxperc[c] * bar_length / 100; if (p > bar_length) p = bar_length; if (c) line[bar_length + 6 + 1 + p] = '+'; else line[bar_length - p - 1] = '+'; if (maxperc[c] > 99) sprintf(tmp, "MAX"); else sprintf(tmp, "%02d%%", maxperc[c]); if (c) memcpy(line + bar_length + 3 + 1, tmp, 3); else memcpy(line + bar_length, tmp, 3); } line[bar_length * 2 + 6 + 2] = 0; fputs(line, stderr); } Could you please help on this.As the driver data is fine when we keep p value to bar length and checked . .
Thanks Sujith
On Fri, Aug 20, 2021 at 12:36 AM folkert folkert@vanheusden.com wrote:
arecord is failing vumeter option -V stereo only.
What version? Because the commandline you provide works fine here with
1.2.4-1ubuntu3.
1.2.1.2
See what happens if you upgrade to 1.2.4.
const int bar_length = 35; char line[80];
...
if (p > bar_length) p = bar_length; if (c) memset(line + bar_length + 6 + 1, '#', p);
----------------//this is the line where it is crashing.here p value is becoming negative at c=1.As we see if we change the p value to bar_length it works fine ..As it is a player issue not a driver issue.
This is puzzling. bar_length + 6 + 1 + p and thus 35 + 6 + 1 + 35 is max 77, that fits easlity in 80.
But wait:
line[bar_length - p - 1] = '+';
p is max bar_length, so we would end up putting '+' in line[-1]
Can you try this?
diff --git a/aplay/aplay.c b/aplay/aplay.c index cc51dcb..9cfd52c 100644 --- a/aplay/aplay.c +++ b/aplay/aplay.c @@ -1764,7 +1764,7 @@ static void print_vu_meter_stereo(int *perc, int *maxperc) p = bar_length; if (c) line[bar_length + 6 + 1 + p] = '+'; - else + else if (p < bar_length) line[bar_length - p - 1] = '+'; if (ABS(maxperc[c]) > 99) sprintf(tmp, "MAX");
Tried with the above code.This is also getting p value negative.
snippet code:
fprintf(stderr, _(" %s sujith %d \n"), __func__,p); if (p > bar_length) p = bar_length; if (c) memset(line + bar_length + 6 + 1, '#', p); else memset(line + bar_length - p - 1, '#', p);
logs.... // c=0 case
print_vu_meter_stereo sujith 35 ///value of p is 35 c =1 case
print_vu_meter_stereo sujith -9227433 ///value is negative//
On Mon, Aug 23, 2021 at 10:33 PM folkert folkert@vanheusden.com wrote:
const int bar_length = 35; char line[80];
...
if (p > bar_length) p = bar_length; if (c) memset(line + bar_length + 6 + 1, '#', p);
----------------//this is the line where it is crashing.here p value is becoming negative at c=1.As we see if we change the p value to bar_length it works fine ..As it is a player issue not a driver issue.
This is puzzling. bar_length + 6 + 1 + p and thus 35 + 6 + 1 + 35 is max 77, that fits easlity in 80.
But wait:
line[bar_length - p - 1] = '+';
p is max bar_length, so we would end up putting '+' in line[-1]
Can you try this?
diff --git a/aplay/aplay.c b/aplay/aplay.c index cc51dcb..9cfd52c 100644 --- a/aplay/aplay.c +++ b/aplay/aplay.c @@ -1764,7 +1764,7 @@ static void print_vu_meter_stereo(int *perc, int *maxperc) p = bar_length; if (c) line[bar_length + 6 + 1 + p] = '+';
else
else if (p < bar_length) line[bar_length - p - 1] = '+'; if (ABS(maxperc[c]) > 99) sprintf(tmp, "MAX");
Ah same bug. Please try this. The idea is that in both cases the extra '-1' breaks it.
diff --git a/aplay/aplay.c b/aplay/aplay.c index cc51dcb..47db7e7 100644 --- a/aplay/aplay.c +++ b/aplay/aplay.c @@ -1753,8 +1753,8 @@ static void print_vu_meter_stereo(int *perc, int *maxperc) for (c = 0; c < 2; c++) { int p = perc[c] * bar_length / 100; char tmp[4]; - if (p > bar_length) - p = bar_length; + if (p >= bar_length) + p = bar_length - 1; if (c) memset(line + bar_length + 6 + 1, '#', p); else
On Tue, Aug 24, 2021 at 12:14:00AM +0530, sujith kumar reddy wrote:
Tried with the above code.This is also getting p value negative.
snippet code:
fprintf(stderr, _(" %s sujith %d \n"), __func__,p); if (p > bar_length) p = bar_length; if (c) memset(line + bar_length + 6 + 1, '#', p); else memset(line + bar_length - p - 1, '#', p);
logs.... // c=0 case
print_vu_meter_stereo sujith 35 ///value of p is 35 c =1 case
print_vu_meter_stereo sujith -9227433 ///value is negative//
On Mon, Aug 23, 2021 at 10:33 PM folkert folkert@vanheusden.com wrote:
const int bar_length = 35; char line[80];
...
if (p > bar_length) p = bar_length; if (c) memset(line + bar_length + 6 + 1, '#', p);
----------------//this is the line where it is crashing.here p value is becoming negative at c=1.As we see if we change the p value to bar_length it works fine ..As it is a player issue not a driver issue.
This is puzzling. bar_length + 6 + 1 + p and thus 35 + 6 + 1 + 35 is max 77, that fits easlity in 80.
But wait:
line[bar_length - p - 1] = '+';
p is max bar_length, so we would end up putting '+' in line[-1]
Can you try this?
diff --git a/aplay/aplay.c b/aplay/aplay.c index cc51dcb..9cfd52c 100644 --- a/aplay/aplay.c +++ b/aplay/aplay.c @@ -1764,7 +1764,7 @@ static void print_vu_meter_stereo(int *perc, int *maxperc) p = bar_length; if (c) line[bar_length + 6 + 1 + p] = '+';
else
else if (p < bar_length) line[bar_length - p - 1] = '+'; if (ABS(maxperc[c]) > 99) sprintf(tmp, "MAX");
Hi Folkert,
Tried with the above code.This is also getting p value negative.
My point is p is negative it doesn't go to
if (p >= bar_length) p = bar_length - 1; it is going to memset second argument p,that is negative so crashing.
logs: localhost ~ # ./sujith/arecord -D hw:1,2 -f S32_LE -r 48000 -c 2 1.wav -V s Sujith entry: main Recording WAVE '1.wav' : Signed 32 bit Little Endian, Rate 48000 Hz, Stereo
print_vu_meter_stereo sujith 35 ////////////////////////// c=0 case print_vu_meter_stereo sujith* -9227433* /////////////////////c=1 case p value negative which is going to memset second argument.
Thanks Sujith
On Tue, Aug 24, 2021 at 12:17 AM folkert folkert@vanheusden.com wrote:
Ah same bug. Please try this. The idea is that in both cases the extra '-1' breaks it.
diff --git a/aplay/aplay.c b/aplay/aplay.c index cc51dcb..47db7e7 100644 --- a/aplay/aplay.c +++ b/aplay/aplay.c @@ -1753,8 +1753,8 @@ static void print_vu_meter_stereo(int *perc, int *maxperc) for (c = 0; c < 2; c++) { int p = perc[c] * bar_length / 100; char tmp[4];
if (p > bar_length)
p = bar_length;
if (p >= bar_length)
p = bar_length - 1; if (c) memset(line + bar_length + 6 + 1, '#', p); else
On Tue, Aug 24, 2021 at 12:14:00AM +0530, sujith kumar reddy wrote:
Tried with the above code.This is also getting p value negative.
snippet code:
fprintf(stderr, _(" %s sujith %d \n"), __func__,p); if (p > bar_length) p = bar_length; if (c) memset(line + bar_length + 6 + 1, '#', p); else memset(line + bar_length - p - 1, '#', p);
logs.... // c=0 case
print_vu_meter_stereo sujith 35 ///value of p is 35 c =1 case
print_vu_meter_stereo sujith -9227433 ///value is negative//
On Mon, Aug 23, 2021 at 10:33 PM folkert folkert@vanheusden.com wrote:
const int bar_length = 35; char line[80];
...
if (p > bar_length) p = bar_length; if (c) memset(line + bar_length + 6 + 1, '#', p);
----------------//this is the line where it is crashing.here p value
is
becoming negative at c=1.As we see if we change the p value to
bar_length
it works fine ..As it is a player issue not a driver issue.
This is puzzling. bar_length + 6 + 1 + p and thus 35 + 6 + 1 + 35 is max 77, that fits easlity in 80.
But wait:
line[bar_length - p - 1] = '+';
p is max bar_length, so we would end up putting '+' in line[-1]
Can you try this?
diff --git a/aplay/aplay.c b/aplay/aplay.c index cc51dcb..9cfd52c 100644 --- a/aplay/aplay.c +++ b/aplay/aplay.c @@ -1764,7 +1764,7 @@ static void print_vu_meter_stereo(int *perc, int *maxperc) p = bar_length; if (c) line[bar_length + 6 + 1 + p] = '+';
else
else if (p < bar_length) line[bar_length - p - 1] = '+'; if (ABS(maxperc[c]) > 99) sprintf(tmp, "MAX");
:-)
If this also doesn't work, then I give up.
diff --git a/aplay/aplay.c b/aplay/aplay.c index cc51dcb..03a4f73 100644 --- a/aplay/aplay.c +++ b/aplay/aplay.c @@ -1753,8 +1753,10 @@ static void print_vu_meter_stereo(int *perc, int *maxperc) for (c = 0; c < 2; c++) { int p = perc[c] * bar_length / 100; char tmp[4]; - if (p > bar_length) - p = bar_length; + if (p >= bar_length) + p = bar_length - 1; + if (p < 0) + p = 0; if (c) memset(line + bar_length + 6 + 1, '#', p); else
On Tue, Aug 24, 2021 at 12:36:05AM +0530, sujith kumar reddy wrote:
Hi Folkert,
Tried with the above code.This is also getting p value negative.
My point is p is negative it doesn't go to
if (p >= bar_length) p = bar_length - 1; it is going to memset second argument p,that is negative so crashing.
logs: localhost ~ # ./sujith/arecord -D hw:1,2 -f S32_LE -r 48000 -c 2 1.wav -V s Sujith entry: main Recording WAVE '1.wav' : Signed 32 bit Little Endian, Rate 48000 Hz, Stereo
print_vu_meter_stereo sujith 35 ////////////////////////// c=0 case print_vu_meter_stereo sujith* -9227433* /////////////////////c=1 case p value negative which is going to memset second argument.
Thanks Sujith
On Tue, Aug 24, 2021 at 12:17 AM folkert folkert@vanheusden.com wrote:
Ah same bug. Please try this. The idea is that in both cases the extra '-1' breaks it.
diff --git a/aplay/aplay.c b/aplay/aplay.c index cc51dcb..47db7e7 100644 --- a/aplay/aplay.c +++ b/aplay/aplay.c @@ -1753,8 +1753,8 @@ static void print_vu_meter_stereo(int *perc, int *maxperc) for (c = 0; c < 2; c++) { int p = perc[c] * bar_length / 100; char tmp[4];
if (p > bar_length)
p = bar_length;
if (p >= bar_length)
p = bar_length - 1; if (c) memset(line + bar_length + 6 + 1, '#', p); else
On Tue, Aug 24, 2021 at 12:14:00AM +0530, sujith kumar reddy wrote:
Tried with the above code.This is also getting p value negative.
snippet code:
fprintf(stderr, _(" %s sujith %d \n"), __func__,p); if (p > bar_length) p = bar_length; if (c) memset(line + bar_length + 6 + 1, '#', p); else memset(line + bar_length - p - 1, '#', p);
logs.... // c=0 case
print_vu_meter_stereo sujith 35 ///value of p is 35 c =1 case
print_vu_meter_stereo sujith -9227433 ///value is negative//
On Mon, Aug 23, 2021 at 10:33 PM folkert folkert@vanheusden.com wrote:
const int bar_length = 35; char line[80];
...
if (p > bar_length) p = bar_length; if (c) memset(line + bar_length + 6 + 1, '#', p);
----------------//this is the line where it is crashing.here p value
is
becoming negative at c=1.As we see if we change the p value to
bar_length
it works fine ..As it is a player issue not a driver issue.
This is puzzling. bar_length + 6 + 1 + p and thus 35 + 6 + 1 + 35 is max 77, that fits easlity in 80.
But wait:
line[bar_length - p - 1] = '+';
p is max bar_length, so we would end up putting '+' in line[-1]
Can you try this?
diff --git a/aplay/aplay.c b/aplay/aplay.c index cc51dcb..9cfd52c 100644 --- a/aplay/aplay.c +++ b/aplay/aplay.c @@ -1764,7 +1764,7 @@ static void print_vu_meter_stereo(int *perc, int *maxperc) p = bar_length; if (c) line[bar_length + 6 + 1 + p] = '+';
else
else if (p < bar_length) line[bar_length - p - 1] = '+'; if (ABS(maxperc[c]) > 99) sprintf(tmp, "MAX");
Folkert van Heusden
Hi folkert,
The above you suggested p=0 is working . i tried like if (p > bar_length || p < 0) p = bar_length; This is also working.
Which is the perfect one we can use? Is there any impact of p with driver data or this is just a application calculated value.
Thanks Sujith
On Tue, Aug 24, 2021 at 12:39 AM folkert folkert@vanheusden.com wrote:
:-)
If this also doesn't work, then I give up.
diff --git a/aplay/aplay.c b/aplay/aplay.c index cc51dcb..03a4f73 100644 --- a/aplay/aplay.c +++ b/aplay/aplay.c @@ -1753,8 +1753,10 @@ static void print_vu_meter_stereo(int *perc, int *maxperc) for (c = 0; c < 2; c++) { int p = perc[c] * bar_length / 100; char tmp[4];
if (p > bar_length)
p = bar_length;
if (p >= bar_length)
p = bar_length - 1;
if (p < 0)
p = 0; if (c) memset(line + bar_length + 6 + 1, '#', p); else
On Tue, Aug 24, 2021 at 12:36:05AM +0530, sujith kumar reddy wrote:
Hi Folkert,
Tried with the above code.This is also getting p value negative.
My point is p is negative it doesn't go to
if (p >= bar_length) p = bar_length - 1; it is going to memset second argument p,that is negative so crashing.
logs: localhost ~ # ./sujith/arecord -D hw:1,2 -f S32_LE -r 48000 -c 2 1.wav
-V s
Sujith entry: main Recording WAVE '1.wav' : Signed 32 bit Little Endian, Rate 48000 Hz,
Stereo
print_vu_meter_stereo sujith 35 ////////////////////////// c=0 case print_vu_meter_stereo sujith* -9227433* /////////////////////c=1 case p value negative which is going to memset second argument.
Thanks Sujith
On Tue, Aug 24, 2021 at 12:17 AM folkert folkert@vanheusden.com wrote:
Ah same bug. Please try this. The idea is that in both cases the extra '-1' breaks it.
diff --git a/aplay/aplay.c b/aplay/aplay.c index cc51dcb..47db7e7 100644 --- a/aplay/aplay.c +++ b/aplay/aplay.c @@ -1753,8 +1753,8 @@ static void print_vu_meter_stereo(int *perc, int *maxperc) for (c = 0; c < 2; c++) { int p = perc[c] * bar_length / 100; char tmp[4];
if (p > bar_length)
p = bar_length;
if (p >= bar_length)
p = bar_length - 1; if (c) memset(line + bar_length + 6 + 1, '#', p); else
On Tue, Aug 24, 2021 at 12:14:00AM +0530, sujith kumar reddy wrote:
Tried with the above code.This is also getting p value negative.
snippet code:
fprintf(stderr, _(" %s sujith %d \n"), __func__,p); if (p > bar_length) p = bar_length; if (c) memset(line + bar_length + 6 + 1, '#', p); else memset(line + bar_length - p - 1, '#', p);
logs.... // c=0 case
print_vu_meter_stereo sujith 35 ///value of p is 35 c =1 case
print_vu_meter_stereo sujith -9227433 ///value is negative//
On Mon, Aug 23, 2021 at 10:33 PM folkert folkert@vanheusden.com
wrote:
const int bar_length = 35; char line[80];
...
if (p > bar_length) p = bar_length; if (c) memset(line + bar_length + 6 + 1, '#',
p);
----------------//this is the line where it is crashing.here p
value
is
becoming negative at c=1.As we see if we change the p value to
bar_length
it works fine ..As it is a player issue not a driver issue.
This is puzzling. bar_length + 6 + 1 + p and thus 35 + 6 + 1 + 35 is max 77, that
fits
easlity in 80.
But wait:
line[bar_length - p - 1] = '+';
p is max bar_length, so we would end up putting '+' in line[-1]
Can you try this?
diff --git a/aplay/aplay.c b/aplay/aplay.c index cc51dcb..9cfd52c 100644 --- a/aplay/aplay.c +++ b/aplay/aplay.c @@ -1764,7 +1764,7 @@ static void print_vu_meter_stereo(int *perc,
int
*maxperc) p = bar_length; if (c) line[bar_length + 6 + 1 + p] = '+';
else
else if (p < bar_length) line[bar_length - p - 1] = '+'; if (ABS(maxperc[c]) > 99) sprintf(tmp, "MAX");
Folkert van Heusden
-- Multitail es una herramienta flexible que permite visualizar los "log file" y seguir la ejecución de comandos. Permite filtrar, añadir colores, combinar archivos, la visualización de diferencias (diff- view), etc. http://www.vanheusden.com/multitail/
Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com
p=0 is more correct I think
this is application only
On Tue, Aug 24, 2021 at 01:03:27AM +0530, sujith kumar reddy wrote:
Hi folkert,
The above you suggested p=0 is working . i tried like if (p > bar_length || p < 0) p = bar_length; This is also working.
Which is the perfect one we can use? Is there any impact of p with driver data or this is just a application calculated value.
Thanks Sujith
On Tue, Aug 24, 2021 at 12:39 AM folkert folkert@vanheusden.com wrote:
:-)
If this also doesn't work, then I give up.
diff --git a/aplay/aplay.c b/aplay/aplay.c index cc51dcb..03a4f73 100644 --- a/aplay/aplay.c +++ b/aplay/aplay.c @@ -1753,8 +1753,10 @@ static void print_vu_meter_stereo(int *perc, int *maxperc) for (c = 0; c < 2; c++) { int p = perc[c] * bar_length / 100; char tmp[4];
if (p > bar_length)
p = bar_length;
if (p >= bar_length)
p = bar_length - 1;
if (p < 0)
p = 0; if (c) memset(line + bar_length + 6 + 1, '#', p); else
On Tue, Aug 24, 2021 at 12:36:05AM +0530, sujith kumar reddy wrote:
Hi Folkert,
Tried with the above code.This is also getting p value negative.
My point is p is negative it doesn't go to
if (p >= bar_length) p = bar_length - 1; it is going to memset second argument p,that is negative so crashing.
logs: localhost ~ # ./sujith/arecord -D hw:1,2 -f S32_LE -r 48000 -c 2 1.wav
-V s
Sujith entry: main Recording WAVE '1.wav' : Signed 32 bit Little Endian, Rate 48000 Hz,
Stereo
print_vu_meter_stereo sujith 35 ////////////////////////// c=0 case print_vu_meter_stereo sujith* -9227433* /////////////////////c=1 case p value negative which is going to memset second argument.
Thanks Sujith
On Tue, Aug 24, 2021 at 12:17 AM folkert folkert@vanheusden.com wrote:
Ah same bug. Please try this. The idea is that in both cases the extra '-1' breaks it.
diff --git a/aplay/aplay.c b/aplay/aplay.c index cc51dcb..47db7e7 100644 --- a/aplay/aplay.c +++ b/aplay/aplay.c @@ -1753,8 +1753,8 @@ static void print_vu_meter_stereo(int *perc, int *maxperc) for (c = 0; c < 2; c++) { int p = perc[c] * bar_length / 100; char tmp[4];
if (p > bar_length)
p = bar_length;
if (p >= bar_length)
p = bar_length - 1; if (c) memset(line + bar_length + 6 + 1, '#', p); else
On Tue, Aug 24, 2021 at 12:14:00AM +0530, sujith kumar reddy wrote:
Tried with the above code.This is also getting p value negative.
snippet code:
fprintf(stderr, _(" %s sujith %d \n"), __func__,p); if (p > bar_length) p = bar_length; if (c) memset(line + bar_length + 6 + 1, '#', p); else memset(line + bar_length - p - 1, '#', p);
logs.... // c=0 case
print_vu_meter_stereo sujith 35 ///value of p is 35 c =1 case
print_vu_meter_stereo sujith -9227433 ///value is negative//
On Mon, Aug 23, 2021 at 10:33 PM folkert folkert@vanheusden.com
wrote:
> const int bar_length = 35; > char line[80]; ... > if (p > bar_length) > p = bar_length; > if (c) > memset(line + bar_length + 6 + 1, '#',
p);
> ----------------//this is the line where it is crashing.here p
value
is
> becoming negative at c=1.As we see if we change the p value to
bar_length
> it works fine ..As it is a player issue not a driver issue.
This is puzzling. bar_length + 6 + 1 + p and thus 35 + 6 + 1 + 35 is max 77, that
fits
easlity in 80.
But wait:
line[bar_length - p - 1] = '+';
p is max bar_length, so we would end up putting '+' in line[-1]
Can you try this?
diff --git a/aplay/aplay.c b/aplay/aplay.c index cc51dcb..9cfd52c 100644 --- a/aplay/aplay.c +++ b/aplay/aplay.c @@ -1764,7 +1764,7 @@ static void print_vu_meter_stereo(int *perc,
int
*maxperc) p = bar_length; if (c) line[bar_length + 6 + 1 + p] = '+';
else
else if (p < bar_length) line[bar_length - p - 1] = '+'; if (ABS(maxperc[c]) > 99) sprintf(tmp, "MAX");
Folkert van Heusden
-- Multitail es una herramienta flexible que permite visualizar los "log file" y seguir la ejecución de comandos. Permite filtrar, añadir colores, combinar archivos, la visualización de diferencias (diff- view), etc. http://www.vanheusden.com/multitail/
Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com
Folkert van Heusden
Ok thank you folkert .
On Tue, 24 Aug, 2021, 1:46 AM folkert, folkert@vanheusden.com wrote:
p=0 is more correct I think
this is application only
On Tue, Aug 24, 2021 at 01:03:27AM +0530, sujith kumar reddy wrote:
Hi folkert,
The above you suggested p=0 is working . i tried like if (p > bar_length || p < 0) p = bar_length; This is also working.
Which is the perfect one we can use? Is there any impact of p with driver data or this is just a application calculated value.
Thanks Sujith
On Tue, Aug 24, 2021 at 12:39 AM folkert folkert@vanheusden.com wrote:
:-)
If this also doesn't work, then I give up.
diff --git a/aplay/aplay.c b/aplay/aplay.c index cc51dcb..03a4f73 100644 --- a/aplay/aplay.c +++ b/aplay/aplay.c @@ -1753,8 +1753,10 @@ static void print_vu_meter_stereo(int *perc, int *maxperc) for (c = 0; c < 2; c++) { int p = perc[c] * bar_length / 100; char tmp[4];
if (p > bar_length)
p = bar_length;
if (p >= bar_length)
p = bar_length - 1;
if (p < 0)
p = 0; if (c) memset(line + bar_length + 6 + 1, '#', p); else
On Tue, Aug 24, 2021 at 12:36:05AM +0530, sujith kumar reddy wrote:
Hi Folkert,
Tried with the above code.This is also getting p value negative.
My point is p is negative it doesn't go to
if (p >= bar_length) p = bar_length - 1; it is going to memset second argument p,that is negative so crashing.
logs: localhost ~ # ./sujith/arecord -D hw:1,2 -f S32_LE -r 48000 -c 2
1.wav
-V s
Sujith entry: main Recording WAVE '1.wav' : Signed 32 bit Little Endian, Rate 48000 Hz,
Stereo
print_vu_meter_stereo sujith 35 ////////////////////////// c=0 case print_vu_meter_stereo sujith* -9227433* /////////////////////c=1
case p
value negative which is going to memset second argument.
Thanks Sujith
On Tue, Aug 24, 2021 at 12:17 AM folkert folkert@vanheusden.com
wrote:
Ah same bug. Please try this. The idea is that in both cases the extra '-1' breaks it.
diff --git a/aplay/aplay.c b/aplay/aplay.c index cc51dcb..47db7e7 100644 --- a/aplay/aplay.c +++ b/aplay/aplay.c @@ -1753,8 +1753,8 @@ static void print_vu_meter_stereo(int *perc,
int
*maxperc) for (c = 0; c < 2; c++) { int p = perc[c] * bar_length / 100; char tmp[4];
if (p > bar_length)
p = bar_length;
if (p >= bar_length)
p = bar_length - 1; if (c) memset(line + bar_length + 6 + 1, '#', p); else
On Tue, Aug 24, 2021 at 12:14:00AM +0530, sujith kumar reddy wrote:
Tried with the above code.This is also getting p value negative.
snippet code:
fprintf(stderr, _(" %s sujith %d \n"), __func__,p); if (p > bar_length) p = bar_length; if (c) memset(line + bar_length + 6 + 1, '#',
p);
else memset(line + bar_length - p - 1, '#',
p);
logs.... // c=0 case
print_vu_meter_stereo sujith 35 ///value of p is 35 c =1 case
print_vu_meter_stereo sujith -9227433 ///value is negative//
On Mon, Aug 23, 2021 at 10:33 PM folkert <folkert@vanheusden.com
wrote:
> > const int bar_length = 35; > > char line[80]; > ... > > if (p > bar_length) > > p = bar_length; > > if (c) > > memset(line + bar_length + 6 + 1,
'#',
p);
> > ----------------//this is the line where it is crashing.here
p
value
is
> > becoming negative at c=1.As we see if we change the p value
to
bar_length
> > it works fine ..As it is a player issue not a driver issue. > > This is puzzling. > bar_length + 6 + 1 + p and thus 35 + 6 + 1 + 35 is max 77, that
fits
> easlity in 80. > > But wait: > > line[bar_length - p - 1] = '+'; > > p is max bar_length, so we would end up putting '+' in line[-1] > > Can you try this? > > > diff --git a/aplay/aplay.c b/aplay/aplay.c > index cc51dcb..9cfd52c 100644 > --- a/aplay/aplay.c > +++ b/aplay/aplay.c > @@ -1764,7 +1764,7 @@ static void print_vu_meter_stereo(int
*perc,
int
> *maxperc) > p = bar_length; > if (c) > line[bar_length + 6 + 1 + p] = '+'; > - else > + else if (p < bar_length) > line[bar_length - p - 1] = '+'; > if (ABS(maxperc[c]) > 99) > sprintf(tmp, "MAX"); >
Folkert van Heusden
-- Multitail es una herramienta flexible que permite visualizar los "log file" y seguir la ejecución de comandos. Permite filtrar, añadir colores, combinar archivos, la visualización de diferencias (diff- view), etc. http://www.vanheusden.com/multitail/
Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com
Folkert van Heusden
-- Multitail es una herramienta flexible que permite visualizar los "log file" y seguir la ejecución de comandos. Permite filtrar, añadir colores, combinar archivos, la visualización de diferencias (diff- view), etc. http://www.vanheusden.com/multitail/
Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com
Hi folkert,
Are you going to submit the fix .
Thanks Sujith
On Tue, Aug 24, 2021 at 6:45 AM sujith kumar reddy < sujithreddy6192@gmail.com> wrote:
Ok thank you folkert .
On Tue, 24 Aug, 2021, 1:46 AM folkert, folkert@vanheusden.com wrote:
p=0 is more correct I think
this is application only
On Tue, Aug 24, 2021 at 01:03:27AM +0530, sujith kumar reddy wrote:
Hi folkert,
The above you suggested p=0 is working . i tried like if (p > bar_length || p < 0) p = bar_length; This is also working.
Which is the perfect one we can use? Is there any impact of p with driver data or this is just a application calculated value.
Thanks Sujith
On Tue, Aug 24, 2021 at 12:39 AM folkert folkert@vanheusden.com
wrote:
:-)
If this also doesn't work, then I give up.
diff --git a/aplay/aplay.c b/aplay/aplay.c index cc51dcb..03a4f73 100644 --- a/aplay/aplay.c +++ b/aplay/aplay.c @@ -1753,8 +1753,10 @@ static void print_vu_meter_stereo(int *perc,
int
*maxperc) for (c = 0; c < 2; c++) { int p = perc[c] * bar_length / 100; char tmp[4];
if (p > bar_length)
p = bar_length;
if (p >= bar_length)
p = bar_length - 1;
if (p < 0)
p = 0; if (c) memset(line + bar_length + 6 + 1, '#', p); else
On Tue, Aug 24, 2021 at 12:36:05AM +0530, sujith kumar reddy wrote:
Hi Folkert,
Tried with the above code.This is also getting p value negative.
My point is p is negative it doesn't go to
if (p >= bar_length) p = bar_length - 1; it is going to memset second argument p,that is negative so
crashing.
logs: localhost ~ # ./sujith/arecord -D hw:1,2 -f S32_LE -r 48000 -c 2
1.wav
-V s
Sujith entry: main Recording WAVE '1.wav' : Signed 32 bit Little Endian, Rate 48000 Hz,
Stereo
print_vu_meter_stereo sujith 35 ////////////////////////// c=0
case
print_vu_meter_stereo sujith* -9227433* /////////////////////c=1
case p
value negative which is going to memset second argument.
Thanks Sujith
On Tue, Aug 24, 2021 at 12:17 AM folkert folkert@vanheusden.com
wrote:
Ah same bug. Please try this. The idea is that in both cases the extra '-1' breaks it.
diff --git a/aplay/aplay.c b/aplay/aplay.c index cc51dcb..47db7e7 100644 --- a/aplay/aplay.c +++ b/aplay/aplay.c @@ -1753,8 +1753,8 @@ static void print_vu_meter_stereo(int
*perc, int
*maxperc) for (c = 0; c < 2; c++) { int p = perc[c] * bar_length / 100; char tmp[4];
if (p > bar_length)
p = bar_length;
if (p >= bar_length)
p = bar_length - 1; if (c) memset(line + bar_length + 6 + 1, '#', p); else
On Tue, Aug 24, 2021 at 12:14:00AM +0530, sujith kumar reddy
wrote:
> Tried with the above code.This is also getting p value negative. > > snippet code: > > fprintf(stderr, _(" %s sujith %d \n"), __func__,p); > if (p > bar_length) > p = bar_length; > if (c) > memset(line + bar_length + 6 + 1, '#',
p);
> else > memset(line + bar_length - p - 1, '#',
p);
> > > logs.... > // c=0 case > > print_vu_meter_stereo sujith 35 ///value of p is 35 > c =1 case > > print_vu_meter_stereo sujith -9227433 ///value is negative// > > On Mon, Aug 23, 2021 at 10:33 PM folkert <
folkert@vanheusden.com>
wrote:
> > > > const int bar_length = 35; > > > char line[80]; > > ... > > > if (p > bar_length) > > > p = bar_length; > > > if (c) > > > memset(line + bar_length + 6 + 1,
'#',
p);
> > > ----------------//this is the line where it is
crashing.here p
value
is > > > becoming negative at c=1.As we see if we change the p value
to
bar_length > > > it works fine ..As it is a player issue not a driver issue. > > > > This is puzzling. > > bar_length + 6 + 1 + p and thus 35 + 6 + 1 + 35 is max 77,
that
fits
> > easlity in 80. > > > > But wait: > > > > line[bar_length - p - 1] = '+'; > > > > p is max bar_length, so we would end up putting '+' in
line[-1]
> > > > Can you try this? > > > > > > diff --git a/aplay/aplay.c b/aplay/aplay.c > > index cc51dcb..9cfd52c 100644 > > --- a/aplay/aplay.c > > +++ b/aplay/aplay.c > > @@ -1764,7 +1764,7 @@ static void print_vu_meter_stereo(int
*perc,
int
> > *maxperc) > > p = bar_length; > > if (c) > > line[bar_length + 6 + 1 + p] = '+'; > > - else > > + else if (p < bar_length) > > line[bar_length - p - 1] = '+'; > > if (ABS(maxperc[c]) > 99) > > sprintf(tmp, "MAX"); > >
Folkert van Heusden
-- Multitail es una herramienta flexible que permite visualizar los "log file" y seguir la ejecución de comandos. Permite filtrar, añadir colores, combinar archivos, la visualización de diferencias (diff- view), etc. http://www.vanheusden.com/multitail/
Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com
Folkert van Heusden
-- Multitail es una herramienta flexible que permite visualizar los "log file" y seguir la ejecución de comandos. Permite filtrar, añadir colores, combinar archivos, la visualización de diferencias (diff- view), etc. http://www.vanheusden.com/multitail/
Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com
On Mon, 23 Aug 2021 21:06:05 +0200, sujith kumar reddy wrote:
Hi Folkert,
Tried with the above code.This is also getting p value negative.
My point is p is negative it doesn't go to
if (p >= bar_length) p = bar_length - 1; it is going to memset second argument p,that is negative so crashing.
Gah, the code there contains lots of craps. A negative value must not have been passed there.
Below is a series of fixes. Please give it a try.
thanks,
Takashi
Hi Takashi,
With the above patches -V stereo is working fine.
Thanks sujith
On Tue, Aug 24, 2021 at 1:42 PM Takashi Iwai tiwai@suse.de wrote:
On Mon, 23 Aug 2021 21:06:05 +0200, sujith kumar reddy wrote:
Hi Folkert,
Tried with the above code.This is also getting p value negative.
My point is p is negative it doesn't go to
if (p >= bar_length) p = bar_length - 1; it is going to memset second argument p,that is negative so crashing.
Gah, the code there contains lots of craps. A negative value must not have been passed there.
Below is a series of fixes. Please give it a try.
thanks,
Takashi
participants (3)
-
folkert
-
sujith kumar reddy
-
Takashi Iwai