rosettadrone icon indicating copy to clipboard operation
rosettadrone copied to clipboard

Implement WebRTC streaming

Open kripper opened this issue 2 years ago • 1 comments

Is your feature request related to a problem? Please describe.

The h264 streaming only works on some models. See: https://github.com/RosettaDrone/rosettadrone/issues/131

Describe the solution you'd like

Implement webRTC streaming. See: https://github.com/Andreas1331/android-webrtc-dji/issues/1#issuecomment-1635249369

Describe alternatives you've considered

No response

Additional context

No response

kripper avatar Aug 13 '23 06:08 kripper

Can you give us an update on this? I would very much like to get the video stream going with the Mini 2.

ricardohalfeld avatar Jun 14 '24 16:06 ricardohalfeld

No one is working on this. Feel free to implement and share a pull request. Shouldn't be that difficult. Current video streaming code should be deprecated after implementing this issue.

kripper avatar Jul 21 '24 22:07 kripper

Any idea how to start? I'm new in Android development.

angel-ayala avatar Jul 22 '24 01:07 angel-ayala

  1. Test the code from https://github.com/Andreas1331/android-webrtc-dji (test receiving in the browser).
  2. Adapt the code to work inside RD, ideally using the plugin interface to keep things clean.

For testing, I would suggest to receive the stream in the same way they do in https://github.com/Andreas1331/android-webrtc-dji. I'm afraid the current video streaming code should be kept in parallel until we confirm the webrtc implemenation supports all the same drone models.

kripper avatar Jul 22 '24 02:07 kripper

I am also not too familiar with Android development but I'll give a go.

ricardohalfeld avatar Jul 23 '24 13:07 ricardohalfeld

I'm still looking at the code and implementing a test case, have you any idea on how implement in the plugin the signaling server and the client, pointed out in the https://github.com/Andreas1331/android-webrtc-dji repo

angel-ayala avatar Jul 29 '24 18:07 angel-ayala

The README on this repo seems to explains how to setup the servers and clients.

kripper avatar Jul 30 '24 00:07 kripper

Yes @kripper, indeed, my question was more based on the RD code in terms of classes. I don't exactly understand the plugin hierarchy.

angel-ayala avatar Jul 30 '24 00:07 angel-ayala

Ok. That's quite easy:

  • PluginManager.java class: distributes some specific calls to all enabled plugins, ie. the main code invokes the methods of the manager, and the manager invokes the methods on all enabled plugins.
  • Plugin.java class: must be extended by plugins.
  • RawVideoStreamer.java class: an example of a plugin used to "stream" raw video frames (in an inefficient and non-standard format). Only usefull as a plugin implementation example, not as a video streaming implementation.

To keep code clean, you should:

  • create a WebRTCStreaming.java plugin with all your video streaming code.
  • move all the current buggy video streaming implementation from the main code to a LegacyVideoStreaming.java plugin.

I think for developing and testing, it's ok to start changing the code directly on the main code (without moving the code into plugins), but at the end, before doing a pull request, it would be better to move the new and old video streaming code into plugins to avoid cluttering the base code.

kripper avatar Jul 30 '24 01:07 kripper

@angel-ayala, I haven't been able to find the time to look into this, but if you share your branch I try my best to stay in the loop and bounce ideas with you.

ricardohalfeld avatar Aug 01 '24 17:08 ricardohalfeld

All my changes are on the main branch.

kripper avatar Aug 01 '24 18:08 kripper

Hi,

I did some test with a simple WebRTC server-client examples and I'm trying to hook up RD into the networking. I implemented a really simple structure here just to check how a plugin should works. So far, so good. Nevertheless, when I add 'io.getstream:stream-webrtc-android:1.1.3' to the build.gradle file, I gets:

2024-08-07 19:05:00.126 15016-15016 libc                    sq.rogue.rosettadrone                A  Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 15016 (ue.rosettadrone), pid 15016 (ue.rosettadrone)

and I don't know why. If I comment that line, the code works again.

The idea now is to implement the SocketConnection class to work with the underlying code of DJIStreamer.

What do you think @kripper?

angel-ayala avatar Aug 07 '24 22:08 angel-ayala

The error is thrown during the grade build process or during execution? Maybe it requires other dependencies.

kripper avatar Aug 08 '24 01:08 kripper

Sorry my bad, I was adding a wrong library, here is a updated first draft. I need to test yet, but at least is able to connect to my local signaling server.

angel-ayala avatar Aug 08 '24 03:08 angel-ayala