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

The issue of performance #17

Open
stallman opened this issue Apr 24, 2013 · 10 comments
Open

The issue of performance #17

stallman opened this issue Apr 24, 2013 · 10 comments

Comments

@stallman
Copy link

Is it possible to reduce the load on the processor in the video? What affects the load? Can be a great camera resolution? If more than three parties becomes very slow.

@muaz-khan
Copy link
Owner

It is possible to use media constraints like minFrameRate, bandwidth etc. But preferred solution is to use peer-to-server model.

Remember, I’ve not experimented peer-2-server yet. If you’re interested, here is my idea:

First phase

Peer connection is opened between session initiator and media server. Handshake is completed and RTP packets are flowing from browser to server.

Here, media server played the role of another peer.

Server can access/read those DTLS/SRTP packets as byte-streams or something else.

Server can broadcast them over all other connected peers however, for broadcasting: server must use RTP (SRTP) ports.

Second phase

Peer connection is established between a participant and the media server.

Same DTLS/SRTP packets are received.

Server can either record them or further broadcast them over room initiator’s peer.

It means that the entire complex job is done by the server. Only one peer connection is opened between each participant (including room initiator) and the server.

Server can mix/transcode videos and transmit them over single peer i.e. over room initiator’s or each participant’s 2-incoming-RTP ports.

2-incoming-RTP ports means the connection between a peer and server must be 2-way.

In a simple one-to-one peer connection (i.e. video-session); about 4-RTP ports are opened by the browser. 2 for outgoing audio/video RTP streams and 2 for incoming.

Now, question arises; “Is it possible to open peer-to-server connection”?

Simple answer is: it could be possible only if target media server is smart enough to generate right SDP. ICE can be gathered by the server; it is optional however preferred.

Personally I think 1-way streaming i.e. peer-to-server is easier to be implemented however 2-way streaming will be a big challenge.

Mozilla planned to implement multiple-streaming per peer connection; chrome is already supporting it however none of them is planning to allow single peer to be connected with multiple peers.

Defining multiple “m=” lines is easier however each line points a unique peer is a little bit complex. That’s why this feature is being ignored. (Maybe they think it is useless!!).

Well, it is a reality that with every model (except peer-to-server) we need to open same number of RTP ports like we’re already doing. So, performance issues will be still there.

In the below image, you can see that only-one peer connection is opened for each user. 2 RTP streams are flowing toward server and two RTP ports are used for incoming streams.

Server can use those 2-incoming-ports to transmit multiple streams. Remember, multi-streaming feature is already supported by chrome; and firefox will implement it in a few months.

@stallman
Copy link
Author

Thanks a lot.
Where are using these params (bandwidth, framerate) ?
As far as I know, the html5 video does not contain such settings.

@muaz-khan
Copy link
Owner

You can set minFrameRate or bandwidth like this:

bandwidth = {
    bandwidth: 1000
};

video_constraints = {
    mandatory: {
        minFrameRate: 30
    },
    optional: [bandwidth]
};

constraints = {
    audio: true,
    video: video_constraints
};

navigator.webkitGetUserMedia(constraints, success, failure);

Reference

@stallman
Copy link
Author

Thanks.

@ajaybodhe
Copy link

HI Muaz,

There is already an implementation of this sort, lynckia,
http://lynckia.com/index.html

I have tested this & it works well.

What it does is it has a smart signaling server which acts as a peer to
every peerconnection request of a participant & handles SDP, ICE stuffs.

Then it adds one stream for each participant to other participants
remotestream.

Right now they forward media from each participant to every other
participant without any mixing/transcoding,

But because of this bandwidth requirement of server is pretty high

I am planning to read about mixing & transcoding & try implementing it on
top of lynckia.

But unsure of how exactly these things work.

Can you provide some leads/pointers on how to proceed on this?

Also is this the viable solution going forward to support many
participants(at least 30-40) in a Webrtc conference.

is there other media server(may be licensed/open sourced) already doing
this for webrtc
or any altogether different solution for reducing bandwidth requirement
that you can think of?

Thanks,
Ajay

On Wed, Apr 24, 2013 at 8:26 PM, rsh notifications@github.com wrote:

Thanks.


Reply to this email directly or view it on GitHubhttps://github.com//issues/17#issuecomment-16936092
.

@stallman
Copy link
Author

wow, "lynckia" is cool )

@hdf
Copy link

hdf commented Apr 25, 2013

Gross, needs a server, and no windows support, it is nothing like this project.

@epexa
Copy link

epexa commented Jul 15, 2013

Muaz Khan, you can add RTCMultiConnection opportunity ustanavilvat the following parameters:

var video_constraints = {
    mandatory: {
        minWidth: 640,
        maxWidth: 640,
        minHeight: 480,
        maxHeight: 480,
        minFrameRate: 30
    },
    optional: []
};

Example: connection.mandatory.maxWidth = 1080;

@muaz-khan
Copy link
Owner

What you think about this:

// getUserMedia constraints
connection.mediaConstraints.mandatory.minFrameRate = 10;
connection.mediaConstraints.mandatory = {
    minWidth: 640,
    maxWidth: 640,
    minHeight: 480,
    maxHeight: 480,
    minFrameRate: 30
};

// sdp constraints
connection.sdpConstraints.optional.IceRestart = true;
connection.sdpConstraints.mandatory = {
    OfferToReceiveAudio: true,
    OfferToReceiveVideo: true,
    VoiceActivityDetection: true,
    IceRestart = true;
};

@epexa
Copy link

epexa commented Jul 15, 2013

Very good!

muaz-khan added a commit that referenced this issue Jul 21, 2013
Mute only "remote" media streams:
connection.streams.mute({
—— audio: true,
—— video: true,
—— type: 'remote'
});

Mute all:
connection.streams.mute();

connection.mediaConstraints.mandatory = {
—— minWidth: 640,
—— maxWidth: 640,
—— minHeight: 480,
—— maxHeight: 480,
—— minFrameRate: 30
};

See #68 and #17 for further details.
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

5 participants