Skip to content

webrtc: add android webrtcsrc example

This MR adds an Android webrtcsrc based example with the following features:

  • A first view allows retrieving the producer list from the signaller (peer ids are uuids which are too long to tap, especially using an onscreen keyboard).
  • Selecting a producer opens a second view. The first available video stream is rendered on a native Surface. All the audio streams are rendered using autoaudiosink.

Available Settings:

  • Signaller URI.
  • A toggle to prefer hardware decoding for OPUS, otherwise the app defaults to raising opusdec's rank. Hardware decoding was moved aside since it was found to crash the app on all tested devices (2 smartphones, 1 tv).

Warning: in order to ease testing, this demonstration application enables unencrypted network communication. See AndroidManifest.xml.

The application uses the technologies currenlty proposed by Android Studio when creating a new project:

  • Kotlin as the default language, which is fully interoperable with Java and uses the same SDK.
  • gradle 8.6.
  • kotlin dialect for gradle. The structure is mostly the same as the previously preferred dialect, for which examples can be found online readily.
  • However, JNI code generation still uses Makefiles (instead of CMake) due to the need to call gstreamer-1.0.mk for gstreamer_android generation. I'll update the example when cerbero!1466 (closed) & gstreamer!6881 (merged) are merged.

Current limitations:

  • x86 support is currently discarded as gstreamer_android libs generation fails (observed with gstreamer-1.0-android-universal-1.24.3).
  • A selector could be added to let the user chose the video streams and possibly decide whether to render all audio streams or just select one.

Nice to have:

  • Support for the synchronization features of the webrtc-precise-sync-recv example (NTP clock, RFC 7273).
  • It could be nice to use Rust for the specific native code.
Edited by François Laignel

Merge request reports

Loading