Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 04cd0186 authored by Glenn Kasten's avatar Glenn Kasten
Browse files

getMinFrameCount error handling

Convention is for "get" APIs that directly return status_t and indirectly
return a value via a pointer, to return BAD_VALUE if the pointer is NULL.
Also indirectly return 0 for other errors.

Change-Id: I1599f20ecb26e9723f9fb384ffbf911ff3a2ce1c
parent 5f0033d2
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -41,6 +41,11 @@ status_t AudioRecord::getMinFrameCount(
        audio_format_t format,
        audio_channel_mask_t channelMask)
{
    if (frameCount == NULL) return BAD_VALUE;

    // default to 0 in case of error
    *frameCount = 0;

    size_t size = 0;
    if (AudioSystem::getInputBufferSize(sampleRate, format, channelMask, &size)
            != NO_ERROR) {
+5 −0
Original line number Diff line number Diff line
@@ -54,6 +54,11 @@ status_t AudioTrack::getMinFrameCount(
        audio_stream_type_t streamType,
        uint32_t sampleRate)
{
    if (frameCount == NULL) return BAD_VALUE;

    // default to 0 in case of error
    *frameCount = 0;

    // FIXME merge with similar code in createTrack_l(), except we're missing
    //       some information here that is available in createTrack_l():
    //          audio_io_handle_t output