Failed to create audio device on Android

242 views
Skip to first unread message

CrIcKeT

unread,
Sep 13, 2023, 8:00:08 AM9/13/23
to discuss-webrtc
Hello.
I just started learning WebRTС and am studying the examples that come with the source code. androidvoip has no problems launching, everything works fine, but launching androidnativeapi causes the application to crash. The crash occurs after this line: 

pcf_deps.media_engine = cricket::CreateMediaEngine(std::move(media_deps));

In logcat I see the next messages:

09-13 11:08:13.512 12290 12318 I webrtc_voice_engine.cc: (line 362): WebRtcVoiceEngine::WebRtcVoiceEngine
09-13 11:08:13.512 12290 12318 I webrtc_video_engine.cc: (line 753): WebRtcVideoEngine::WebRtcVideoEngine()
09-13 11:08:13.512 12290 12318 I android_call_client.cc: (line 169): Media engine created: d160fcb0
09-13 11:08:13.512 12290 12320 I webrtc_voice_engine.cc: (line 384): WebRtcVoiceEngine::Init
09-13 11:08:13.512 12290 12320 I audio_device_impl.cc: (line 67): Create
09-13 11:08:13.512 12290 12320 I audio_device_impl.cc: (line 75): CreateForTest
09-13 11:08:13.513 12290 12320 I audio_device_buffer.cc: (line 66): AudioDeviceBuffer::ctor
09-13 11:08:13.513 12290 12320 I audio_device_impl.cc: (line 120): AudioDeviceModuleImpl
09-13 11:08:13.513 12290 12320 I audio_device_impl.cc: (line 135): CheckPlatform
09-13 11:08:13.513 12290 12320 I audio_device_impl.cc: (line 143): current platform is Android
09-13 11:08:13.513 12290 12320 I audio_device_impl.cc: (line 168): CreatePlatformSpecificObjects
09-13 11:08:13.513 12290 12320 I audio_device_impl.cc: (line 905): PlatformAudioLayer
09-13 11:08:13.513 12290 12320 E audio_device_impl.cc: (line 264): Failed to create the platform specific ADM implementation.
09-13 11:08:13.513 12290 12320 I audio_device_impl.cc: (line 278): ~AudioDeviceModuleImpl
09-13 11:08:13.513 12290 12320 I audio_device_buffer.cc: (line 80): AudioDeviceBuffer::~dtor
09-13 11:08:13.513 12290 12320 E rtc     : #
09-13 11:08:13.513 12290 12320 E rtc     : # Fatal error in: ../../media/engine/webrtc_voice_engine.cc, line 706
09-13 11:08:13.513 12290 12320 E rtc     : # last system error: 0
09-13 11:08:13.513 12290 12320 E rtc     : # Check failed: adm_
09-13 11:08:13.513 12290 12320 E rtc     : #
09-13 11:08:13.513 12290 12320 F libc    : Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 12320 (worker_thread), pid 12290 (ndroidnativeapi)


After reviewing the audio_device_buffer.cc, I did not see the implementation of an audio device for android. So this is reason why audio_device_ is not valid. Are there any ways to run this application with audio dummy or to fix this? androidnativeapi runs on a real device on Android 11.

Henrik Andreasson

unread,
Sep 13, 2023, 9:33:09 AM9/13/23
to discuss...@googlegroups.com
Can you build and run and use audio in the AppRTCMobile application on Android: https://webrtc.googlesource.com/src/+/master/examples/androidapp/README?

If so, perhaps you can track how the ADM is injected there. I think that the Android ADM now lives under sdk/ and not modules/

--
This list falls under the WebRTC Code of Conduct - https://webrtc.org/support/code-of-conduct.
---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/b0592a7c-cf9d-4f06-abf8-0ae5e7ced790n%40googlegroups.com.

CrIcKeT

unread,
Sep 18, 2023, 2:42:25 AM9/18/23
to discuss-webrtc
I accidentally sent my answer in PM, so I’ll duplicate it.

The AppRTCMobile requires creating a room on the https://appr.tc.
As I understand it, this site has not been operational for a long time.
Is it possible to use example "peerconnection/server" as a server for the AppRTCMobile?
In addition, the androidnativeapi uses sdk sources.

среда, 13 сентября 2023 г. в 16:33:09 UTC+3, Henrik Andreasson:

Henrik Andreasson

unread,
Sep 18, 2023, 3:39:57 AM9/18/23
to discuss...@googlegroups.com
I don't think the "peerconnection/server" is updated to support mobile platforms. The AppRTCMobile app should still serve as an example of how to inject an ADM in Java even if you can't run the application. It might also work in loopback.

CrIcKeT

unread,
Sep 20, 2023, 8:13:16 AM9/20/23
to discuss-webrtc
I was able to run the androidnativeapi as follows: I passed the context from Java to C++ and then called the media_deps.adm = webrtc::CreateJavaAudioDeviceModule(env, appContext). Now the application has stopped crashing and after granting permissions to the camera I got a working example.

понедельник, 18 сентября 2023 г. в 10:39:57 UTC+3, Henrik Andreasson:

Henrik Andreasson

unread,
Sep 20, 2023, 9:05:01 AM9/20/23
to discuss...@googlegroups.com
Sounds like great work. Would it be possible to upload the change for review so that others can use it as well? 




CrIcKeT

unread,
Sep 30, 2023, 4:11:46 AM9/30/23
to discuss-webrtc
Yup, I'll do that a little later.

среда, 20 сентября 2023 г. в 16:05:01 UTC+3, Henrik Andreasson:
Reply all
Reply to author
Forward
0 new messages