google / google/oboe

Getting glitches when starting Oboe AAudio on Pixel 6a

Open
#1,842 9 comments 0 reactions 1 assignee Assigned to @robertwu1 View on GitHub
bug
Dominant language
C++
Stars
4.1k
Forks
639
Avg merge
2d 23h
Merged PRs (30d)
8

Description

Android version(s): 14
Android device(s): Pixel 6a
Oboe version: 1.7.0
App name used for testing: Mini Piano Lite
(Please try to reproduce the issue using the OboeTester or an Oboe sample.)

**Short description**
I noticed sometimes that when starting my app, I get a glitch in the (otherwise silent) audio. I could reproduce this more consistently by restarting my Oboe engine on button click. I don't get this on all devices, but on Pixel 6a with latest (beta) updates (Android 14), it is reproducible consistently.

It turns out that setting the `builder.setPerformanceMode(oboe::PerformanceMode::LowLatency)` causes the glitch. When set to `None` it doesn't happen anymore. I tested this with as much audio code disabled in my app, just supplying a zero filled buffer always.

I see in the Android Logcat of the device that when performance mode is LowLatency, there are some errors shown about MMAP when starting Oboe. With None mode it doesn't show up, but I am not sure that it is the cause.

```
AudioFlinger audioserver W Could not set MMAP stream volume: no volume callback!
audio_hw_output_stream android.hardware.audio.service E out_get_mmap_position: pcm_sync_ptr failed: File descriptor in bad state
StreamHAL android.hardware.audio.service W Error from HAL stream in function get_mmap_position: Operation not permitted
audio_hw_output_stream android.hardware.audio.service E out_get_mmap_position: invalid time stamp: File descriptor in bad state
StreamHAL android.hardware.audio.service W Error from HAL stream in function get_mmap_position: Operation not permitted
AAudioServ...dpointMMAP audioserver W getFreeRunningPosition(): getMmapPosition() has no position data available
audio_hw_output_stream android.hardware.audio.service W __out_pcm_mmap_standby: pcm has been NULL
```
So I am wondering, are glitches expected when starting Oboe with a zero filled buffer?

**Steps to reproduce**
I tested with Oboe Tester, but there it always glitches when starting/stopping, so I can't determine if this is expected. Also on device where it doesn't glitch, Oboe Tester still glitches at start/stop.

**Expected behavior**
When starting Oboe with only a zero filled audio input, no glitches are heard.

**Actual behavior**
It glitches often on Pixel 6a.

**Device**

Please list which devices have this bug.

```
ro.product.brand = google
ro.product.manufacturer = Google
ro.product.model = Pixel 6a
ro.product.device = bluejay
ro.product.cpu.abi = arm64-v8a
ro.build.description = bluejay_beta-user 14 UPB3.230519.014 10284690 release-keys
ro.hardware = bluejay
ro.hardware.chipname =
ro.arch =
| grep aaudio = [aaudio.hw_burst_min_usec]: [2000]
[aaudio.mmap_exclusive_policy]: [2]
[aaudio.mmap_policy]: [2]

```

**Any additional context**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.