Can't use the microphone in android Gstreamer "Internal data stream error"

0

I am making an Android app to stream audio with Gstreamer the pipeline I am using is:

"openslessrc ! decodebin !
audioconvert ! audioresample ! audiobuffersplit alignment-threshold=20
strict-buffer-size=true ! mulawenc ! rtppcmupay ! udpsink host=192.1.1.1
port=50002 bind-address=" + ip 

I have also used audiotestsrc, and it works.

I have tired several combinations of gradle ndk and gstreamer and the problem is the same with gstreamer-1.0-android-universal-1.17 and gstreamer-1.0-android-universal-1.16,

the one used here is:

5.6.4 android plugin 3.6.3, ndk/21.3.6528147, gstreamer-1.0-android-universal-1.17, minSdkVersion 22, targetSdkVersion 28

The error appears as:

W/libOpenSLES: Conversion from OpenSL ES positional channel mask 0x4 to
Android mask 0 loses channels
I/libOpenSLES: Emulating old channel mask behavior (ignoring positional mask
0x4, using default mask 0x10 based on channel count of 1)
E/AudioRecord: AudioFlinger could not create record track, status: -1
E/libOpenSLES: android_audioRecorder_realize(0x78982c8000) error creating
AudioRecord object; status -1
W/libOpenSLES: Leaving Object::Realize (SL_RESULT_CONTENT_UNSUPPORTED)
E/GStreamer+opensles_ringbuffer: 0:00:01.534980729 0x7892aea770
../sys/opensles/openslesringbuffer.c:176:_opensles_recorder_acquire:<openslesringbuffer1>
recorder.Realize failed(0x00000009)
W/GStreamer+basesrc: 0:00:01.535117187 0x7892aea770
../libs/gst/base/gstbasesrc.c:3070:gst_base_src_loop:<autoaudiosrc0-actual-src-opensle>
error: Internal data stream error.
    0:00:01.535154166 0x7892aea770
../libs/gst/base/gstbasesrc.c:3070:gst_base_src_loop:<autoaudiosrc0-actual-src-opensle>
error: streaming stopped, reason not-negotiated (-4)
W/GStreamer+typefind: 0:00:01.535521875 0x7892aea770
../plugins/elements/gsttypefindelement.c:988:gst_type_find_element_chain_do_typefinding:<typefind>
error: Stream doesn't contain enough data.
    0:00:01.535606771 0x7892aea770
../plugins/elements/gsttypefindelement.c:988:gst_type_find_element_chain_do_typefinding:<typefind>
error: Can't typefind stream
E/libOpenSLES: Object::Destroy(0x78a9385400) for engine ignored; 1 total
active objects
    Object::Destroy(0x78a9385400) for engine ignored; active object ID 2 at
0x78982c8000
android
gstreamer
audio-recording
opensl
asked on Stack Overflow Jul 22, 2020 by Julian Hernandez • edited Jul 22, 2020 by Long Luong

1 Answer

0

All I had to do was grant it user permission to use the microphone, I didn't know the manifest permissions weren't enough.

I'm new in android development and had only used emulators.

answered on Stack Overflow Jul 22, 2020 by Julian Hernandez

User contributions licensed under CC BY-SA 3.0