Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webrtc (dtls+srtp) server for recordering stream #315

Open
publicocean0 opened this issue Jun 4, 2017 · 7 comments
Open

webrtc (dtls+srtp) server for recordering stream #315

publicocean0 opened this issue Jun 4, 2017 · 7 comments

Comments

@publicocean0
Copy link

publicocean0 commented Jun 4, 2017

Hi
i m searching a library for creating a java server for connecting from a browser to a server(as a peer node) for recordering video stream using webrtc stream from client. Can this library help me?
Is there a example or a manual or another way for learning how to use this code(if i have to develop a server is not a problem .... the problem for me is the dtls+srtp protocol very complex ... i dont know so much about it )?

@jitsi-developers
Copy link
Contributor

jitsi-developers commented Jun 4, 2017 via email

@publicocean0
Copy link
Author

publicocean0 commented Jun 4, 2017

sorry but it seams a library in python ... i m ready to suicide me :)
My software is in java and my server is a web server where i m developping a page where there is a video component html from camera , this video can be saved in the webserver (db or file).
but with this library is not possible to receive a videostream from a browser?

@bgrozev
Copy link
Member

bgrozev commented Jun 5, 2017

I'm afraid there's not much documentation. Take a look at RecorderRtpImpl (it supports only VP8). The library does not take care of signaling or connectivity establishment (ICE), so you would have to implement these parts (it does DTLS, though). It expects input through a set of sockets.

@publicocean0
Copy link
Author

publicocean0 commented Jun 5, 2017

Ok for Ice it is not a problem i can use my websocket For VP8 no problem.
RecorderRtpImpl receives a RTPTranslator converting rtp in mediastream. Navigating a bit in the classes it seams RTPTranslator is generated by a factory in other classes. I think there is a main class for establishing a connection receiving sdp string . i found


            MediaDevice device
                = mediaService.getDefaultDevice(mediaType, MediaUseCase.CALL);
            MediaStream mediaStream = mediaService.createMediaStream(device);

     
            mediaStream.setDirection(MediaDirection.RECVONLY);

        
            byte dynamicRTPPayloadType;

            switch (device.getMediaType())
            {
            case AUDIO:
                encoding = "PCMU";
                clockRate = 8000;
                /* PCMU has a static RTP payload type number assigned. */
                dynamicRTPPayloadType = -1;
                break;
            case VIDEO:
                encoding = "VP8";
                clockRate = MediaFormatFactory.CLOCK_RATE_NOT_SPECIFIED;
            
                dynamicRTPPayloadType = 99;
                break;
            default:
                encoding = null;
                clockRate = MediaFormatFactory.CLOCK_RATE_NOT_SPECIFIED;
                dynamicRTPPayloadType = -1;
            }

            if (encoding != null)
            {
                MediaFormat format
                    = mediaService.getFormatFactory().createMediaFormat(
                            encoding,
                            clockRate);

           
                if (dynamicRTPPayloadType != -1)
                {
                    mediaStream.addDynamicRTPPayloadType(
                            dynamicRTPPayloadType,
                            format);
                }

                mediaStream.setFormat(format);
            }

            StreamConnector connector= new DefaultStreamConnector(
                            new DatagramSocket(localRTPPort),
                            new DatagramSocket(localRTCPPort));
              mediaStream.setConnector(connector);

      
            mediaStream.setTarget(
                    new MediaStreamTarget(
                            new InetSocketAddress(remoteAddr, remoteRTPPort),
                            new InetSocketAddress(remoteAddr, remoteRTCPPort)));

  but myabe it is sufficient 
new RecorderRtpImp(new  RTPTranslatorImpl())

i didnt know webrtc opens so many ports for trasferring video/audio. Maybe it could be a security problem for a server . I m thinking about if my solution for recording is valid.
Sorry for my question , maybe is stupid ... but i m a bit confused now: localRTPPort and localRTCPPort works as server port (the same for all peers) right?

@bgrozev
Copy link
Member

bgrozev commented Jun 5, 2017

You would create a MediaStream, configure its input with setConnector, etc., set an RTPTranslator with setRTPTranslator, and then create a recorder for the same RTPTranslator instance.

In jitsi-videobridge/ice4j we avoid using multiple ports by multiplexing ICE sessions (while providing a DatagramSocket API for libjitsi).

@publicocean0
Copy link
Author

publicocean0 commented Jul 21, 2017

i tried to assign this task to different developers but they cant to do ... for missing documentations. i think it would be usefull if this library opensource could be used also by other developers for helping the opensource community ... at least with documentation or a examples

@shierro
Copy link

shierro commented Jan 10, 2018

Hi guys, agree with @publicocean0 . It will be highly appreciated if we can improve the README & add a few examples

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants