As you may know, we use janus.js in the implementation of jangouts[1].
We are researching about a new "mode" to lower the CPU and bandwidth usage on the clients. We were wondering if this can be achieved:
- All the publishers publish video + audio + data
- Powerful clients behave like they do now, subscribing to all the channels for each publisher
- Less powerful clients subscribe only to audio + data, ignoring the video stream
Is that possible? Right now, if the publisher offers video the subscribers always get it. It seems there is no way to refuse.
We tried adding a "videoRecv: false" to the "media" parameter of createAnswer during subscription, but it didn't do the trick.
Il giorno martedì 30 giugno 2015 14:56:22 UTC+2, Ancor Gonzalez Sosa ha scritto:As you may know, we use janus.js in the implementation of jangouts[1].
We are researching about a new "mode" to lower the CPU and bandwidth usage on the clients. We were wondering if this can be achieved:
- All the publishers publish video + audio + data
- Powerful clients behave like they do now, subscribing to all the channels for each publisher
- Less powerful clients subscribe only to audio + data, ignoring the video stream
Is that possible? Right now, if the publisher offers video the subscribers always get it. It seems there is no way to refuse.
We tried adding a "videoRecv: false" to the "media" parameter of createAnswer during subscription, but it didn't do the trick.Passing videoRecv:false should actually work, as, at least in principle, it should have the browser reject the video track Janus is offering (m=video 0) while only keeping audio. If it's not working, it's either a bug in the janus.js library, or something is not working as it's supposed to in the core. I'm more inclined towards the former, because if the SDP contains "m=video 0", the browser itself will dump any incoming video packet (or at least it should).Can you share an offer/answer in such a case?
El martes, 30 de junio de 2015, 15:13:06 (UTC+2), Lorenzo Miniero escribió:Il giorno martedì 30 giugno 2015 14:56:22 UTC+2, Ancor Gonzalez Sosa ha scritto:As you may know, we use janus.js in the implementation of jangouts[1].
We are researching about a new "mode" to lower the CPU and bandwidth usage on the clients. We were wondering if this can be achieved:
- All the publishers publish video + audio + data
- Powerful clients behave like they do now, subscribing to all the channels for each publisher
- Less powerful clients subscribe only to audio + data, ignoring the video stream
Is that possible? Right now, if the publisher offers video the subscribers always get it. It seems there is no way to refuse.
We tried adding a "videoRecv: false" to the "media" parameter of createAnswer during subscription, but it didn't do the trick.Passing videoRecv:false should actually work, as, at least in principle, it should have the browser reject the video track Janus is offering (m=video 0) while only keeping audio. If it's not working, it's either a bug in the janus.js library, or something is not working as it's supposed to in the core. I'm more inclined towards the former, because if the SDP contains "m=video 0", the browser itself will dump any incoming video packet (or at least it should).Can you share an offer/answer in such a case?
Indeed, it looks like a bug in janus.js.
This is the affected line in jangouts (in its current form, without video ignoring) https://github.com/jangouts/jangouts/blob/master/src/app/components/room/room.service.js#L293
These are the sdps when using "video: false" in the "media" part of the call above. http://paste.opensuse.org/32557767
These are the sdps when using more explicit "videoRecv: false, videoSend: false". http://paste.opensuse.org/27143960
In both cases it's actually requesting the video, so you were right about the culprit.
Il giorno martedì 30 giugno 2015 16:00:34 UTC+2, Ancor Gonzalez Sosa ha scritto:El martes, 30 de junio de 2015, 15:13:06 (UTC+2), Lorenzo Miniero escribió:Il giorno martedì 30 giugno 2015 14:56:22 UTC+2, Ancor Gonzalez Sosa ha scritto:As you may know, we use janus.js in the implementation of jangouts[1].
We are researching about a new "mode" to lower the CPU and bandwidth usage on the clients. We were wondering if this can be achieved:
- All the publishers publish video + audio + data
- Powerful clients behave like they do now, subscribing to all the channels for each publisher
- Less powerful clients subscribe only to audio + data, ignoring the video stream
Is that possible? Right now, if the publisher offers video the subscribers always get it. It seems there is no way to refuse.
We tried adding a "videoRecv: false" to the "media" parameter of createAnswer during subscription, but it didn't do the trick.Passing videoRecv:false should actually work, as, at least in principle, it should have the browser reject the video track Janus is offering (m=video 0) while only keeping audio. If it's not working, it's either a bug in the janus.js library, or something is not working as it's supposed to in the core. I'm more inclined towards the former, because if the SDP contains "m=video 0", the browser itself will dump any incoming video packet (or at least it should).Can you share an offer/answer in such a case?
Indeed, it looks like a bug in janus.js.
This is the affected line in jangouts (in its current form, without video ignoring) https://github.com/jangouts/jangouts/blob/master/src/app/components/room/room.service.js#L293
These are the sdps when using "video: false" in the "media" part of the call above. http://paste.opensuse.org/32557767
These are the sdps when using more explicit "videoRecv: false, videoSend: false". http://paste.opensuse.org/27143960
In both cases it's actually requesting the video, so you were right about the culprit.
Have you checked in the log where it says "Creating answer (iceDone=" which constraint is being passed to createAnswer? Looking at the code they should be right, and the constraints are printed at:that is immediately after the line I mentioned. You may want to add some additional debug line to identify the viewer you're interested in, of course, as the same line will be printed for every PeerConnection you'll create.
As for Firefox, I guess it's not digesting the constraints properly. IIRC they're either deprecated or spelled differently now, and so Firefox may be expecting something different, not sure about that. I'll have a look tomorrow.
This patch:fixes the behaviour in the core when media are not available, and adds some additional options when creating listeners too. More specifically, when you create a listener, you can now also pass any of these boolean variables (audio, video, data), to instruct the plugin into whether or not the related medium should be sent to that specific listener no matter the source. For instance:var listen = { "request": "join", "room": 1234, "ptype": "listener", "feed": id, "video": false };remoteFeed.send({"message": listen});will make sure the new listener will not receive video frames even if video has been negotiated or the publisher is sending it.
As to the janus.js bugs, it's only partially a bug in our JavaScript library. As I recalled, the syntax in Firefox is indeed different as the spec changed:Old syntax: {'mandatory': {'OfferToReceiveAudio': true, ...
New syntax: {'offerToReceiveAudio': true, 'offerToReceiveVideo': true}I changed my local janus.js to use the correct version when Firefox is being used but, while this works for publishers (which are sendonly as expected), this still doesn't work for rejecting a medium. If I pass {'offerToReceiveAudio': true, 'offerToReceiveVideo': false} to a recvonly PeerConnection, video should be rejected as we're not going to send it and we also don't want to receive it: instead, the video is still negotiated. This is probably a bug in Firefox (at least in Firefox stable, haven't checked Nightly) so I'll notify this on the mozill.dev.media group.
That said, for now for what you need the new boolean parameters to the listener creation should do the trick.
You're right, pause completely pauses all streams. And no, we don't support renegotiation as of yet (which is why you're getting that error when sending a new SDP).To do what you need, it's just the matter of implementing a simple request that only manipulates the new audio/video/data flags, according to what's being requested, as they're the ones responsible for choosing what to provide a listener with. I guess something as a per-listener configure would do the trick.I'll try and so something like this by the end of the week.
Cheers.
Can you open an issue on github with the feature request? Otherwise I'll probably forget about this again...
Yes, configure is an asynchronous message, so what you said is right. The bug still needed to be fixed anyway, as people might be interested in when a response is received, whether it is definitive or temporary.
El lunes, 24 de agosto de 2015, 12:27:54 (UTC+2), Lorenzo Miniero escribió:Yes, configure is an asynchronous message, so what you said is right. The bug still needed to be fixed anyway, as people might be interested in when a response is received, whether it is definitive or temporary.
Ok. I'm implementing it in the right way now, listening to the "configured:ok" message.
When subscribing to a new feed, in the success callback of CreateAnswer(), I'm sending a "start" request followed by a "configure" request. As a result, I'm getting a "started:ok" event and TWO "configured:ok" events. I have checked and I'm completely sure I'm only sending one configure request. Looking at the source code I see no reason to get two events as a reply. Any clue?
Check the transaction ID of those notifications, as they'll match the original request. If they differ, it's two different requests.
Got event on session 4168335901Object {janus: "event", session_id: 4168335901, sender: 4187426773, transaction: "M7lQtDLf91Bi", plugindata: Object}-- Event is coming from 4187426773 (janus.plugin.videoroom)Object {videoroom: "event", room: 1234, started: "ok"}Notifying application...::: Got a message (listener) :::{"videoroom":"event","room":1234,"started":"ok"}Event: eventLong poll...Got event on session 4168335901Object {janus: "event", session_id: 4168335901, sender: 4187426773, transaction: "M7lQtDLf91Bi", plugindata: Object}
Just fixed this: https://github.com/meetecho/janus-gateway/commit/f1b79cd549c656b357dfd7c8e3d61661999fad20We were not breaking the loop when receiving an answer. This definitely fixed the double "started" event. I couldn't replicate this for configured, instead: that's always sent once, just as it should.