diff options
author | Viswanath L <viswanathl@nvidia.com> | 2014-10-31 13:07:39 +0530 |
---|---|---|
committer | Sumit Bhattacharya <sumitb@nvidia.com> | 2015-01-09 22:38:54 +0530 |
commit | 8c7e1114a3a07c3cb071df461d42e75b7ef3feae (patch) | |
tree | a6cb341306bcbde7c382ba44e69c63c39f55afa6 /modules | |
parent | 02e3094598ced8b05c9614d6070556d20328ef43 (diff) | |
download | hardware_libhardware-8c7e1114a3a07c3cb071df461d42e75b7ef3feae.zip hardware_libhardware-8c7e1114a3a07c3cb071df461d42e75b7ef3feae.tar.gz hardware_libhardware-8c7e1114a3a07c3cb071df461d42e75b7ef3feae.tar.bz2 |
usbaudio: Return 0 bytes on failure in capture
Return 0 bytes from in_read() in failure conditions so that invalid
data is not recorded.
Change-Id: I9a6294e4162fa642fd7e160a32d1ad16f255ff62
Diffstat (limited to 'modules')
-rw-r--r-- | modules/usbaudio/audio_hw.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/modules/usbaudio/audio_hw.c b/modules/usbaudio/audio_hw.c index 35f7705..78fa7c5 100644 --- a/modules/usbaudio/audio_hw.c +++ b/modules/usbaudio/audio_hw.c @@ -852,6 +852,8 @@ static ssize_t in_read(struct audio_stream_in *stream, void* buffer, size_t byte num_read_buff_bytes = convert_32_to_16(read_buff, num_read_buff_bytes / 4, out_buff); } else { + LOG_ALWAYS_FATAL("Unsupported format"); + num_read_buff_bytes = 0; goto err; } } @@ -875,6 +877,8 @@ static ssize_t in_read(struct audio_stream_in *stream, void* buffer, size_t byte /* no need to acquire in->dev->lock to read mic_muted here as we don't change its state */ if (num_read_buff_bytes > 0 && in->dev->mic_muted) memset(buffer, 0, num_read_buff_bytes); + } else { + num_read_buff_bytes = 0; } err: |