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

Commit 626833dc authored by juyuchen's avatar juyuchen Committed by Gerrit - the friendly Code Review server
Browse files

audio: Use flag instead of negative size hack to indicate exclusive mode support



Bug: 131325988
Bug: 134634278
Test: use Oboetester_20190424.apk

Change-Id: Ic7dec7a38ee11e541cab6eccf1dd49a0d40d2533
Signed-off-by: default avatarjuyuchen <juyuchen@google.com>
(cherry picked from commit fc2ff82d9f20deee96448e5ba500dca0601f3e13)
Signed-off-by: default avatarAniket Kumar Lata <alata@codeaurora.org>
parent ee00824d
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -6393,6 +6393,8 @@ static int out_create_mmap_buffer(const struct audio_stream_out *stream,
        step = "begin";
        goto exit;
    }

    info->flags = 0;
    info->buffer_size_frames = pcm_get_buffer_size(out->pcm);
    buffer_size = pcm_frames_to_bytes(out->pcm, info->buffer_size_frames);
    info->burst_size_frames = out->config.period_size;
@@ -6411,8 +6413,7 @@ static int out_create_mmap_buffer(const struct audio_stream_out *stream,
            step = "mmap";
            goto exit;
        }
        // FIXME: indicate exclusive mode support by returning a negative buffer size
        info->buffer_size_frames *= -1;
        info->flags |= AUDIO_MMAP_APPLICATION_SHAREABLE;
    }
    memset(info->shared_memory_address, 0, pcm_frames_to_bytes(out->pcm,
                                                               info->buffer_size_frames));
@@ -7289,6 +7290,7 @@ static int in_create_mmap_buffer(const struct audio_stream_in *stream,
        goto exit;
    }

    info->flags = 0;
    info->buffer_size_frames = pcm_get_buffer_size(in->pcm);
    buffer_size = pcm_frames_to_bytes(in->pcm, info->buffer_size_frames);
    info->burst_size_frames = in->config.period_size;
@@ -7307,8 +7309,7 @@ static int in_create_mmap_buffer(const struct audio_stream_in *stream,
            step = "mmap";
            goto exit;
        }
        // FIXME: indicate exclusive mode support by returning a negative buffer size
        info->buffer_size_frames *= -1;
        info->flags |= AUDIO_MMAP_APPLICATION_SHAREABLE;
    }

    memset(info->shared_memory_address, 0, buffer_size);