2015-03-31 13:13:16

by Prabhu Chawandi

[permalink] [raw]
Subject: Crash in android/hal-sco.c

Hi,

I was trying to do SCO read using haltest but I was getting FPERROR.

So further I went debug coredump


static ssize_t in_read(struct audio_stream_in *stream, void *buffer,
size_t bytes)
{
struct sco_stream_in *in = (struct sco_stream_in *) stream;
#if ANDROID_VERSION >= PLATFORM_VER(5, 0, 0)
size_t frame_size = audio_stream_in_frame_size(&in->stream);
#else
size_t frame_size = audio_stream_frame_size(&stream->common);
#endif

size_t frame_num = bytes / frame_size; ===> Floating point error.

size_t input_frame_num = frame_num;


I am getting channel number as 1 from audio_channel_count_from_in_mask

which is reserved for future hence I am getting zero as return which
leading to the crash

manyThanks,
Prabhu


2015-03-31 15:06:14

by Szymon Janc

[permalink] [raw]
Subject: Re: Crash in android/hal-sco.c

Hi,

On Tuesday 31 of March 2015 18:43:16 Prabhu Chawandi wrote:
> Hi,
>
> I was trying to do SCO read using haltest but I was getting FPERROR.
>
> So further I went debug coredump
>
>
> static ssize_t in_read(struct audio_stream_in *stream, void *buffer,
> size_t
> bytes) {
> struct sco_stream_in *in = (struct sco_stream_in *) stream;
> #if ANDROID_VERSION >= PLATFORM_VER(5, 0, 0)
> size_t frame_size = audio_stream_in_frame_size(&in->stream);
> #else
> size_t frame_size = audio_stream_frame_size(&stream->common);
> #endif
>
> size_t frame_num = bytes / frame_size; ===> Floating point error.
>
> size_t input_frame_num = frame_num;
>
>
> I am getting channel number as 1 from audio_channel_count_from_in_mask
>
> which is reserved for future hence I am getting zero as return which
> leading to the crash

Thanks for reporting.
I've just send a patch "android/hal-sco: Fix divide by zero". This should fix
the crash so please test.

--
BR
Szymon Janc

2015-04-01 03:43:21

by Prabhu Chawandi

[permalink] [raw]
Subject: Re: Crash in android/hal-sco.c

Hi,

Thank you for the patch. I am getting channel number as 1 for input
stream and 2 for output stream, but in the code I am seeing channel
Zero is valid, comment says for compatibility.

Any ways I can force the channel to be Zero in my case ??

manyThanks,
Prabhu

On Tue, Mar 31, 2015 at 8:36 PM, Szymon Janc <[email protected]> wrote:
> Hi,
>
> On Tuesday 31 of March 2015 18:43:16 Prabhu Chawandi wrote:
>> Hi,
>>
>> I was trying to do SCO read using haltest but I was getting FPERROR.
>>
>> So further I went debug coredump
>>
>>
>> static ssize_t in_read(struct audio_stream_in *stream, void *buffer,
>> size_t
>> bytes) {
>> struct sco_stream_in *in = (struct sco_stream_in *) stream;
>> #if ANDROID_VERSION >= PLATFORM_VER(5, 0, 0)
>> size_t frame_size = audio_stream_in_frame_size(&in->stream);
>> #else
>> size_t frame_size = audio_stream_frame_size(&stream->common);
>> #endif
>>
>> size_t frame_num = bytes / frame_size; ===> Floating point error.
>>
>> size_t input_frame_num = frame_num;
>>
>>
>> I am getting channel number as 1 from audio_channel_count_from_in_mask
>>
>> which is reserved for future hence I am getting zero as return which
>> leading to the crash
>
> Thanks for reporting.
> I've just send a patch "android/hal-sco: Fix divide by zero". This should fix
> the crash so please test.
>
> --
> BR
> Szymon Janc