Processing video captured using WebRTC (Socket.IO) on a C ++ server

I am trying to find a better way to do the following:

(A) Capturing video frames on a client PC using a web browser (e.g. Chrome / Chromium).

(B) Send them to the server machine running the C ++ processing algorithm (for example, the procedure for detecting mutant proteins based on OpenCV).

(C) Send the processing results back to the browser on the client PC to show them (in real time it would be nice, but the expected overall delay, of course, was expected).

What I have discovered so far is that WebRTC is great for doing (A) (getUserMedia (), etc.) and, theoretically, (B) , My problems arise when it comes to sending data to the server C ++. I searched for the basics of WebRTC (including examples for P2P communication and the Native C ++ API documentation), but I still don't know how to start building my server and sending data from the browser. Although I have little experience with Javascript, I have already worked in similar scenarios (Javascript Client ↔ C ++ Server with webSockets), but although the webRTC solution should be even easier to implement.

Am I using webRTC correctly for this scenario? Am I missing something? Is there any tutorial or example covering my script that I missed?

+5
4

, , WebRTC C RTCPeerConnection C- . RTCPeerConnection.

C/++, : https://github.com/mozilla/webrtc-standalone, , .

+2

, , , Webrtc, - ++.

( ++) . .

libwebsocket .

, , - , IP- ..

peerConnection new RTCPeerConnection(configuration); creatOffer() createAnswer().

, .

? ( )

/ ++.

1) 1 2

var websocket = new WebSocket('ws://127.0.0.1:9000', 'echo');

2) 1 ( 2)

websocket.send("createOfferForVideo");

3)

2.

printf("received data: %s\n", (char *) in);

4) 2 ( 1 )

websocket.onmessage = function (message){
   if(messageAboutCreateOffer){
       websocket.send("createAnswerForVideo");
   }
}

, .

WEBRTC

libwebsocket ++ -.

1, 2

0

RTCPeer webRTC . NAT (Stun and Turn servers), , .

, websockets.

0

, ++ (), , peer2peer, . .

Javascript data processing and face recognition (and much more) are client-side, and there are many libraries that do this. Take a look at webrtc.io modules and they have rtc-videoproc ect for data processing.

can use the plugin to use C ++ in the browser (slow loading).

0
source

Source: https://habr.com/ru/post/1530981/


All Articles