apache / apache/cordova-plugin-media

Android: Crash and asserts because of missing buffer (buffer == NULL)

Open
#175 0 comments 1 reaction 0 assignees View on GitHub
platform: android
Dominant language
JavaScript
Stars
391
Forks
762
PR merge metrics
No merged PRs in 30d

Description

Hi there,

I noticed asserts when playing audio: `buffer == NULL`

As long as I play local files only, no crashes occur. But if I stream audio using an unstable network connection (cellular data), the App starts crashing from time to time.

Update vom 3.0.1 to 5.0.2 did not help.

The asserts can be reproduced - example with android emulator:

```
I20180824-13:03:10.106(2)? 08-24 13:03:10.037 4801 4807 F AudioTrackShared: Assertion failed: buffer == NULL || buffer->mFrameCount == 0
I20180824-13:03:10.112(2)? 08-24 13:03:10.037 4801 4807 F libc : Fatal signal 6 (SIGABRT), code -6 in tid 4807 (FastMixer)
I20180824-13:03:10.113(2)? 08-24 13:03:10.039 1359 1359 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I20180824-13:03:10.113(2)? 08-24 13:03:10.040 1359 1359 F DEBUG : Build fingerprint: 'Android/sdk_google_phone_x86/generic_x86:6.0/MASTER/4729342:userdebug/test-keys'
I20180824-13:03:10.113(2)? 08-24 13:03:10.040 1359 1359 F DEBUG : Revision: '0'
I20180824-13:03:10.114(2)? 08-24 13:03:10.040 1359 1359 F DEBUG : ABI: 'x86'
I20180824-13:03:10.114(2)? 08-24 13:03:10.040 1359 1359 F DEBUG : pid: 4801, tid: 4807, name: FastMixer >>> /system/bin/mediaserver <<<
I20180824-13:03:10.114(2)? 08-24 13:03:10.040 1359 1359 F DEBUG : signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
I20180824-13:03:10.115(2)? 08-24 13:03:10.046 1359 1359 F DEBUG : Abort message: 'Assertion failed: buffer == NULL || buffer->mFrameCount == 0'
I20180824-13:03:10.117(2)? 08-24 13:03:10.046 1359 1359 F DEBUG : eax 00000000 ebx 000012c1 ecx 000012c7 edx 00000006
I20180824-13:03:10.120(2)? 08-24 13:03:10.046 1359 1359 F DEBUG : esi b41ff980 edi 00000000
I20180824-13:03:10.121(2)? 08-24 13:03:10.046 1359 1359 F DEBUG : xcs 00000073 xds 0000007b xes 0000007b xfs 00000000 xss 0000007b
I20180824-13:03:10.121(2)? 08-24 13:03:10.046 1359 1359 F DEBUG : eip b6f4ba56 ebp 000012c7 esp b41fee80 flags 00200202
I20180824-13:03:10.121(2)? 08-24 13:03:10.050 1359 1359 F DEBUG :
I20180824-13:03:10.122(2)? 08-24 13:03:10.050 1359 1359 F DEBUG : backtrace:
I20180824-13:03:10.122(2)? 08-24 13:03:10.051 1359 1359 F DEBUG : #00 pc 00083a56 /system/lib/libc.so (tgkill+22)
I20180824-13:03:10.122(2)? 08-24 13:03:10.051 1359 1359 F DEBUG : #01 pc 00081608 /system/lib/libc.so (pthread_kill+70)
I20180824-13:03:10.122(2)? 08-24 13:03:10.051 1359 1359 F DEBUG : #02 pc 00027205 /system/lib/libc.so (raise+36)
I20180824-13:03:10.123(2)? 08-24 13:03:10.051 1359 1359 F DEBUG : #03 pc 000209e4 /system/lib/libc.so (abort+80)
I20180824-13:03:10.123(2)? 08-24 13:03:10.051 1359 1359 F DEBUG : #04 pc 0000cbc3 /system/lib/libcutils.so (__android_log_assert+128)
I20180824-13:03:10.123(2)? 08-24 13:03:10.051 1359 1359 F DEBUG : #05 pc 0008353d /system/lib/libmedia.so (android::ServerProxy::obtainBuffer(android::Proxy::Buffer*, bool)+669)
I20180824-13:03:10.124(2)? 08-24 13:03:10.051 1359 1359 F DEBUG : #06 pc 00053af7 /system/lib/libaudioflinger.so
I20180824-13:03:10.124(2)? 08-24 13:03:10.051 1359 1359 F DEBUG : #07 pc 00066155 /system/lib/libaudioflinger.so
I20180824-13:03:10.124(2)? 08-24 13:03:10.051 1359 1359 F DEBUG : #08 pc 0002630a /system/lib/libaudioflinger.so
I20180824-13:03:10.125(2)? 08-24 13:03:10.051 1359 1359 F DEBUG : #09 pc 00026d42 /system/lib/libaudioflinger.so
I20180824-13:03:10.125(2)? 08-24 13:03:10.051 1359 1359 F DEBUG : #10 pc 00025e93 /system/lib/libaudioflinger.so
I20180824-13:03:10.126(2)? 08-24 13:03:10.051 1359 1359 F DEBUG : #11 pc 0006c19a /system/lib/libaudioflinger.so
I20180824-13:03:10.126(2)? 08-24 13:03:10.051 1359 1359 F DEBUG : #12 pc 0006d88f /system/lib/libaudioflinger.so
I20180824-13:03:10.126(2)? 08-24 13:03:10.051 1359 1359 F DEBUG : #13 pc 00014aac /system/lib/libutils.so (android::Thread::_threadLoop(void*)+418)
I20180824-13:03:10.127(2)? 08-24 13:03:10.052 1359 1359 F DEBUG : #14 pc 000141cf /system/lib/libutils.so (thread_data_t::trampoline(thread_data_t const*)+122)
I20180824-13:03:10.127(2)? 08-24 13:03:10.052 1359 1359 F DEBUG : #15 pc 00080ab3 /system/lib/libc.so (__pthread_start(void*)+56)
I20180824-13:03:10.127(2)? 08-24 13:03:10.052 1359 1359 F DEBUG : #16 pc 00021952 /system/lib/libc.so (__start_thread+25)
I20180824-13:03:10.128(2)? 08-24 13:03:10.052 1359 1359 F DEBUG : #17 pc 000170b6 /system/lib/libc.so (__bionic_clone+70)
I20180824-13:03:10.231(2)? 08-24 13:03:10.162 1359 1359 F DEBUG :
I20180824-13:03:10.232(2)? 08-24 13:03:10.162 1359 1359 F DEBUG : Tombstone written to: /data/tombstones/tombstone_05
I20180824-13:03:14.317(2)? 08-24 13:03:14.245 4119 4119 I chromium: [INFO:CONSOLE(1377)] "Media Error Code 100", source: http://localhost:12128/app/app.js?hash=727c3461de63aa79ea38d941e57c1c7c13d6e8fc (1377)
I20180824-13:03:14.322(2)? 08-24 13:03:14.251 4119 4119 I chromium: [INFO:CONSOLE(1378)] "cdvfile://localhost/persistent/z9RBuHyxn2NPgbNKi.m4a", source: http://localhost:12128/app/app.js?hash=727c3461de63aa79ea38d941e57c1c7c13d6e8fc (1378)
I20180824-13:03:14.382(2)? 08-24 13:03:14.310 4824 4830 F AudioTrackShared: Assertion failed: buffer == NULL || buffer->mFrameCount == 0
I20180824-13:03:14.383(2)? 08-24 13:03:14.310 4824 4830 F libc : Fatal signal 6 (SIGABRT), code -6 in tid 4830 (FastMixer)
I20180824-13:03:14.384(2)? 08-24 13:03:14.314 1359 1359 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing streaming playback on the Android emulator with an unstable cellular-style connection, using the crash output and the media error reported from app/app.js as entry points. Trace the Android media path responsible for the AudioTrackShared assertion and verify that the same scenario no longer crashes or aborts playback.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, javascript
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.