Connext DDS is a next generation communications platform that leverages a powerful data-centric approach to address the challenges of big data in motion, Machine-to-Machine (M2M) communication and system of systems integration to meet the needs of the Internet of Things. For what's fixed in 5.3.1 and 5.3.0, see the RTI Connext DDS Core Libraries. X64 gcc 4.9.2. Ubuntu 16.04.
An Android application that uses RTI Connext DDS and the open sourcegstreamer multimedia framework to send a live video stream from oneAndroid device to another.
You can get the project for this demo with a precompiled .apk fromgithub, https://github.com/rticommunity.
This demo is also compatible with the Distributed Video Demo thatshows video streaming on a PC using RTI Connext. That demo isavailable fromhttp://www.rti.com/resources/usecases/streaming-video.html.
NOTE: This demo uses GStreamer 1.0 to encode (compress) the raw videostream received from the Android device's camera using VP8. VP8 isthe compression method that is used by WebM, which is use byHTML5. http://www.webmproject.org/.
NOTE: You will see a noticeable delay in the capture of the video onone device to the display on another device. The source of this delayis entirely within the VP8 encoding/decoding done entirely byGStreamer 1.0 VP8 software plugins. There is no delay due to the useof DDS itself.
If the demo was modified to take advantage of the hardware videoprocessing capability offered by many modern video devices (phone andPC web cameras), there would be noticeable decrease in the delay.However, this demo was created to run on any generic Android deviceand does not require specific hardware video-processing support.
Installing rtivideodemo-android.apk
on a real Android Device
It will show as the 'Connext Video Demo' icon.
A. Attach your Device via USB (to a PC where you have the .apk file)
B. Enable your Device to install apps from unknown sources.On Device, use Settings -> Security -> Unknown Sources,check the checkbox
C. Optional, enable your Device to allow debugging over USBOn Device, use Settings -> Developer options -> USB debugging,check the checkbox.NOTE: You may need to enable the Developer options menu optionon some devices. e.g., on Nexus 7, use Settings -> About tablet-> Build number, select Build number 10 times (or so)
D. Installing the .apk
Using Eclipse
From the toolbar use Run -> Run . This will automatically build theproject (so project must successfully build, see #Building below)
The dialog, Android Device Chooser, may popup and show your deviceif you have more than 1 Android device connected via USB.
If an Android device emulator pops up or if your device is notshown as 'online', you probably need to go to the Device itselfwhich has popped up a dialog asking you for permission to allowyour computer to connect via USB for debugging. (note, while thedemo will start in an emulator, it will not be able to connect toanother device since the emulator's network setup is not the sameas a real device)
Select your device in the Android Device Chooser if needed.
The rtivideodemo-android.apk
will automatically be installed andstarted.
You can use the CDT Build Console and the Android Console tomonitor the build/installation process. You can open a LogCatconsole to see the debug messages coming from thertivideodemo-android application.
'Connext Video Demo' is configured to work using Android's WiFinetwork interface, so your device should be connected to a WiFinetwork.
NOTE: The demo uses RTI Connext DDS to send a video stream toanother Android device or to a PC via the WiFi. This means thatyour device must be able to connect to another device (or a PC) viathe WiFi. If you are on a WiFi that requires a login via a webpage after initial connection (for example at a hotel or conferencehall, or using a roaming service such as Boingo), those types ofconnections actually don't allow one device connected to the WiFifrom directly connecting to another device on the same WiFi. Sothis demo will not work in that setup.
It will work on a local WiFi router (even if the WiFi connectionrequires a WEP or WPA authentication key).
NOTE: If your Android devices support WiFfi-Direct (for examplea Nexus 7), http://en.wikipedia.org/wiki/Wi-Fi_Direct, you can usethis to connect your devices directly to each other via WiFi andhave the demo stream from one device to another.
You will need at least 2 devices running 'Connext Video Demo' or acompatible video demo on a PC, for example fromhttp://www.rti.com/resources/usecases/streaming-video.html.
Start the 'Connext Video Demo' on both devices. By default, thedemo will start in Publish mode, which means that it will attach tothe video camera of the device and publish a video stream via RTIConnext DDS. So, you will have to change one of the devices toSubscribe mode so that it will receive and display the video streamfrom the other device.
In the app, select 'Sub'. Wait until the app switches to 'Sub' andthen hit the 'Start' button which will subscribe to the datastream. To view the stream, you will have to hit the 'Play' arrowbutton.
You may need to start the publishing app by hitting the 'Start'button as well as the 'Play' arrow to begin streaming.
See Troubleshooting section below if you can't get a video streamfrom one app to the another.
These instructions are for a Windows development host.
You need to have Eclipse and the Android ADT plugin installed. TheAndroid ADT plugin depends on the Android SDK. You can:
A. Install the Eclipse ADT Bundle, which has Eclipse with ADT in asingle installer.
B. Install the ADT plugin and Android SDK separately.
C. After installation, if in Eclipse, you don't see the Android SDK,manager and Android Virtual Device Manager menu options underthe Window toolbar menu,then open Window -> Customize Perspective -> Command GroupsAvailability tab, check Android SDK and AVD Manager.
Use the Android SDK Manager to install the Android platforms forwhich you want to build (e.g., Android 4.1.2, Android 4.2.2,Android 4.3, etc.). Make use that you run the Android SDK Managerwith Adminstrator Priviledges if on Windows, or else you won't be ableto install any of the SDKs.
Install the Android NDK (native cross-compiler for Android/ARMv7).Needed to compile C/C++ code invoked through JNI on Android.
NDK 9 or higher is required.
Go to http://developer.android.com/tools/sdk/ndk/index.html andfollow [these instructions](http://tools.android.com/recent/usingthendkplugin).Note that you don't need the legacy NDK toolchains.
Install RTI Connext DDS (and Android target libraries)
You'll need to get this from your local RTI representative. [email protected] to find out who this is.
Download and install GStreamer libraries for Android
rtivideodemo-android works with gstreamer 1.3.90 and higher.
Open rtivideodemo-android project in Eclipse
A. Start Eclipse
B. Use File -> Import -> Existing Projects into Workspace
C. Select the directory where the project rtivideodemo-android islocated.
Customize the project to reflect your environment.
A. Right click on rtivideodemo-android folder in Project Explorer,
Open Properties -> C/C++ Build -> Environment
B. Change the value of NDDSHOME and GSTREAMER_SDK_ROOT_ANDROID toreflect where you installed RTI Connext DDS and GGtreamer
C. If you haven't done so already, you also need to make sure thatEclipse knows where your Android NDK is installed.
Open Window -> Preferences -> Android -> NDK, and edit NDK Location
Build Project
Use Project -> Build Project. The Output in the (CDT Build) Consoleshould look like:
13:42:24 **** Incremental Build of configuration Default forproject rtivideodemo-android ****
'C:Appsandroid-ndk-r9ndk-build.cmd' allGStreamer : [GEN] => gst-build-armeabi-v7a/gstreamer_android.cGStreamer : [COMPILE] => gst-build-armeabi-v7a/gstreamer_android.cGStreamer : [LINK] => gst-build-armeabi-v7a/libgstreamer_android.soPrebuilt : libgstreamer_android.so <= gst-build-armeabi-v7a/Install : libgstreamer_android.so => libs/armeabi-v7a/libgstreamer_android.soInstall : libnddsc.so => libs/armeabi-v7a/libnddsc.soInstall : libnddscore.so => libs/armeabi-v7a/libnddscore.soInstall : libnddscpp.so => libs/armeabi-v7a/libnddscpp.so'Compile++ thumb : rti_android_videodemo <= ConnextGstreamer.cxxSharedLibrary : librti_android_videodemo.soInstall : librti_android_videodemo.so => libs/armeabi-v7a/librti_android_videodemo.soInstall : libgnustl_shared.so => libs/armeabi-v7a/libgnustl_shared.so
13:42:43 Build Finished (took 18s.243ms)
Install APK and run on Android device
Use Run -> Run from the Eclipse toolbar, or right click on theproject and use Run As -> Android Application. This will kick offa build and then automatically install the .apk on to your Androiddevice and start the app.
If you have more than one Android device plugged in, you may need toselect the device that you want to run on from the Android DeviceChooser that will pop up.
If your device does not show up, or Eclipse starts an AndroidEmulator, it is likely that you need to configure your device toallow for USB debugging and likely to select 'Allow' on your devicewhen your device detects your computer trying to establish a USBdebug session.
NOTE: While the demo will start in an Android emulator, it will notbe able to connect to another device since the emulator's networksetup is not the same as a real device.
You can use the CDT Build Console and the Android Console tomonitor the build/installation process. You can open a LogCatconsole to see the debug messages coming from thertivideodemo-android application.
Example Android Console output:
[2014-08-11 14:09:36 - rtivideodemo-android] ------------------------------[2014-08-11 14:09:36 - rtivideodemo-android] Android Launch![2014-08-11 14:09:36 - rtivideodemo-android] adb is running normally.[2014-08-11 14:09:36 - rtivideodemo-android] Performing com.rti.android.videodemo.MainActivity activity launch[2014-08-11 14:09:36 - rtivideodemo-android] Automatic Target Mode: using device 'SH18JT501845'[2014-08-11 14:09:36 - rtivideodemo-android] Uploading rtivideodemo-android.apk onto device 'SH18JT501845'[2014-08-11 14:09:39 - rtivideodemo-android] Installing rtivideodemo-android.apk...[2014-08-11 14:10:12 - rtivideodemo-android] Success![2014-08-11 14:10:12 - rtivideodemo-android] Starting activity com.rti.android.videodemo.MainActivity on device SH18JT501845[2014-08-11 14:10:16 - rtivideodemo-android] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.rti.android.videodemo/.MainActivity }
rtivideodemo-android doesn't seem to connect (you don't see a livevideo feed sent from one device to another)
If your Android devices on are different subnets or multicast is notsupported on the WiFi network, then you should useNDDS_DISCOVERY_PEERS
environment variable to set the IP addressesof the devices as the initial peers for discovery.
An Android device IP address on WiFi can be found using Settings-> WiFi -> < whatever WiFi network is connected >
.
You can set the IP address in the Peer List for the demo on theAndroid device using the '...' (3 dots menu) -> Settings -> DDSPeer List preferences menu option.
NOTE: If the Android devices are connected to a WiFi that requiresa login (I don't mean a password for WEP or WPA/PSK WiFi security),then it is likely that your two devices will not be able to connectto each other. This is true for most conference center, hotel orroaming WiFi services like Boingo. Those WiFi services simplydon't allow you to directly connect two devices on their network.
Build problems?
A. Make sure that Eclipse knows where your NDK is located
B. Your build never completes...and you have to kill Eclipse (orat least kill the build processes that were spawned by Eclipse).
C. After disabling your Scanner Configuration Builder, yourproject now complains that there are errors in the code after abuild and now refuses to create, install and run an .apk. Sincedisabling the Scanner now prevents the Eclipse editor fromsuccessfuly verifying the syntax of your C/C++ code, it nowflags unknown variable types and such as errors (which reallyaren't since the compiler is the one will work fine).
'src/com/rti/android/videodemo/MainActivity.java' - The mainAndroid activity for rtivideodemo-android. Handles all of the buttonactions that switches between video camera and video display modes.
'src/com/rti/android/videodemo/VideoCamera.java' - Class that runsthe demo when in Camera (Pub) mode. Connects the device camera tothe underlying Connext DDS/GStreamer processing pipeline.
'src/com/rti/android/videodemo/VideoDisplay.java' - Class that runsthe demo when in Display (Sub) mode. Connects the underlyingConnext DDS/GStreamer processing pipeline to a display surface todisplay the incoming video stream.
'src/com/rti/android/videodemo/VideoControlSurface.java' - Abstractclass that serves as the base class for VideoCamera andVideoDisplay. Allows buttons in the MainActivity to functioncorrectly independently of the mode that the demo is in.
'src/com/rti/android/videodemo/VideoStreamConnext.java' - Class thatwraps the underlying C functions provided by theConnextGstreamer.cxx file into equivalent Java methods via JNI.
'src/com/rti/android/videodemo/Settings.java' - Android Activity usedto create 'Settings' option menu.
'src/com/rti/android/videodemo/util/EditTextPreferenceWithValue.java' -Useful class so that when a preference (setting/option) is changedby the user, the new value is automatically reflected in thepreferences menu.
'jni/ConnextGstreamer.cxx' - Wrapper using RTI Connext DDS and GStreamerinvoked via JNI interface. The wrapper creates DDS entities such asDDSParticipants, DDSDataWriters, DDSDataReaders as well as createsthe GStreamer video processing pipelines. You would modify thisfile if you want to try different video compression algorithms ortry to use a device's onboard video encoding/decoding hardware.
'jni/VideoData*.*' - Support files for data type use by DDS. Generatedwith 'rtiddsgen VideoDemo.idl' using rtiddsgen distributed with RTI Connext DDS.
'jni/Android.mk', 'jni/Application.mk' - Defines the build process andexternal libraries needed by the native code (RTI Connext DDS andGStreamer) supporting the demo.
'VideoData.idl' - Defines the data structure used by DDS to stream video framesover a network.
'AndroidManifest.xml' - Main definition file for rtivideodemo-android appincluding which Activity to start on startup.
'res/layout/activity_main.xml' - Main layout of the graphics elements ofthe application. Open this file to modify the graphical elements of theapplication.
'res/layout/preferences_with_value.xml' - Utility used to define a layoutwhere the current value of a preference are displayed on the same line asthe preference.
'res/menu/menu.xml' - Defines the layout of the Android options menu.
'res/xml/settings.xml' - Defines the preferences that can be set by theSettings option submen.