diff options
| author | Jindong <jindong.yue@nxp.com> | 2020-06-04 19:04:44 +0800 |
|---|---|---|
| committer | Jindong <jindong.yue@nxp.com> | 2020-06-05 11:11:07 +0800 |
| commit | 8681eabddfe073ad5981ab5972eb786bc55f9e48 (patch) | |
| tree | 9e63193fbe10f68fcd366da8c5a385cbd399b951 /include | |
| parent | 76f174cfe4d52a2788e74cd47367d8fa4e896319 (diff) | |
| download | platform_hardware_libhardware-8681eabddfe073ad5981ab5972eb786bc55f9e48.tar.gz platform_hardware_libhardware-8681eabddfe073ad5981ab5972eb786bc55f9e48.tar.bz2 platform_hardware_libhardware-8681eabddfe073ad5981ab5972eb786bc55f9e48.zip | |
audio_alsaops: fix format conversion error handling bug
Returns a invalid format after fatal error,
instead of "0", which equals to PCM_FORMAT_S16_LE or
AUDIO_FORMAT_DEFAULT.
Also fix below build error:
hardware/libhardware/include/hardware/audio_alsaops.h:63:16:
error: cannot initialize return object of type 'enum pcm_format' with an rvalue of type 'int'
return 0;
hardware/libhardware/include/hardware/audio_alsaops.h:97:16:
error: cannot initialize return object of type 'audio_format_t' with an rvalue of type 'int'
return 0;
Signed-off-by: Jindong <jindong.yue@nxp.com>
Change-Id: Iabf5ae106d9c371c00ad5236326c6f38d1a9f116
Diffstat (limited to 'include')
| -rw-r--r-- | include/hardware/audio_alsaops.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/hardware/audio_alsaops.h b/include/hardware/audio_alsaops.h index 6a17a351..476c311f 100644 --- a/include/hardware/audio_alsaops.h +++ b/include/hardware/audio_alsaops.h @@ -60,7 +60,7 @@ static inline enum pcm_format pcm_format_from_audio_format(audio_format_t format case AUDIO_FORMAT_PCM_FLOAT: /* there is no equivalent for float */ default: LOG_ALWAYS_FATAL("pcm_format_from_audio_format: invalid audio format %#x", format); - return 0; + return PCM_FORMAT_INVALID; /* doesn't get here, assert called above */ } } @@ -94,7 +94,7 @@ static inline audio_format_t audio_format_from_pcm_format(enum pcm_format format #endif default: LOG_ALWAYS_FATAL("audio_format_from_pcm_format: invalid pcm format %#x", format); - return 0; + return AUDIO_FORMAT_INVALID; /* doesn't get here, assert called above */ } } |
