how to pause or start-stop voice exchange via PeerConnection

2,883 views
Skip to first unread message

Alexey Ovchinnikov

unread,
Jun 28, 2012, 4:25:31 AM6/28/12
to discuss-webrtc
Hello guys. How to pause or start-stop voice exchange via established
PeerConnection?
Alexey.

Brave Yao

unread,
Jun 29, 2012, 2:13:01 AM6/29/12
to discuss...@googlegroups.com
Hi,

There is a similar discussion before. Please refer this topic:  recommended way to pause sending of LocalMediaStream

/Brave

Alexey Ovchinnikov

unread,
Jun 29, 2012, 7:08:20 AM6/29/12
to discuss...@googlegroups.com
Thank you very much. But I don't understand. This feature still not work?
It's my sample:
http://82.146.58.238/doacall.html.
MuteVideo button must mute Video and Audio.
In code it's
camera.videoTracks[0].enabled = false;
camera.audioTracks[0].enabled = false;

stream1.videoTracks[0].enabled = false;
stream1.audioTracks[0].enabled = false;

stream2.videoTracks[0].enabled = false;
stream2.audioTracks[0].enabled = false;

I need stop sending RTP packets from source.

What I do wrong?

2012/6/29 Brave Yao <brav...@webrtc.org>:

Justin Uberti

unread,
Jun 29, 2012, 3:06:29 PM6/29/12
to discuss...@googlegroups.com
To stop sending of RTP packets, use a=inactive or a=recvonly.
1. createOffer
2. Set a=recvonly in the SDP
3. pc.setLocalDescription(OFFER, SDP)
4. pc.setRemoteDescription(ANSWER, pc.remoteDescription)

Bryan Donnovan

unread,
Jun 29, 2012, 4:40:24 PM6/29/12
to discuss...@googlegroups.com
Justin, 

Do you happen to know if this method will reset the RTP sequence number and roll-over count?

And if not, can you advise on the most expedient method to reset the SeqNum/ROC?

thanks

Dennis

unread,
Feb 27, 2013, 8:11:47 AM2/27/13
to discuss...@googlegroups.com
Did you ever figure out if this resets sequence numbers or roll-over count?  Also, when a stream is set to inactive, I am assuming that only the transmission of RTP & RTCP packets are halted, but the bi-directional ICE related packets continue to be generated and sent and replied to keep the connection alive, correct?  

Justin Uberti

unread,
Feb 27, 2013, 7:17:57 PM2/27/13
to discuss-webrtc
Correct, ICE continues even when media flow stops.

a=inactive will not reset SRTP. I think we do reset seqnum, but I'm not 100% positive. 

Is there a spec that indicates what the correct behavior is here?


--
 
---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Harald Alvestrand

unread,
Feb 28, 2013, 5:22:41 AM2/28/13
to discuss...@googlegroups.com
RTCP packets are also sent while an m-line is a=inactive. So the
crypto session will have to roll on as before.

RFC 4566 page 7:

a=inactive

This specifies that the tools should be started in inactive
mode. This is necessary for interactive conferences where
users can put other users on hold. No media is sent over an
inactive media stream. Note that an RTP-based system SHOULD
still send RTCP, even if started inactive. It can be either a
session or media-level attribute, and it is not dependent on
charset.

Dennis

unread,
Feb 28, 2013, 7:49:12 AM2/28/13
to discuss...@googlegroups.com
Great info - thanks!  Any chance either of you know more in depth answers to my other thread 'what is difference between 'localStream.videoTracks[0].enabled = false;' vs reapplying a=inactive' ?  I have a lot more detailed questions there about the difference between the two....thanks ;)

Harald Alvestrand

unread,
Feb 28, 2013, 8:55:56 AM2/28/13
to discuss...@googlegroups.com
On Thu, Feb 28, 2013 at 1:49 PM, Dennis <ddo...@gmail.com> wrote:
> Great info - thanks! Any chance either of you know more in depth answers to
> my other thread 'what is difference between
> 'localStream.videoTracks[0].enabled = false;' vs reapplying a=inactive' ? I
> have a lot more detailed questions there about the difference between the
> two....thanks ;)

At the moment, there is no specified relationships.

The folks at the IETF are not yet agreed on how video tracks should be
assigned to m-lines (one per m-line or multiple tracks on one m-line).
Until then, it's impossible to state what the relationship should be.

So until then - "enabled" is a local property only.

Justin Uberti

unread,
Feb 28, 2013, 1:09:28 PM2/28/13
to discuss-webrtc
.enabled currently mutes audio and blacks out video; in other words, media is still being sent, but the input is all zeroes.

a=inactives stops the transmission of RTP altogether. I'm not sure if RTCP BYE is sent, but based on Harald's note, it sounds like it shouldn't be.

Tom

unread,
Apr 8, 2013, 9:35:19 AM4/8/13
to discuss...@googlegroups.com
Are there any uptodate demos of this functionality around? This demo doesn't work at all in Chrome 26 and I'm not sure if it really shows 'pausing' of a stream in the same way.

Vikas

unread,
Apr 8, 2013, 1:18:03 PM4/8/13
to discuss-webrtc
Hi Tom,

We will be updating the pranswer.html demo to work on Chrome 26. There
is a bug in the tracker. See issue https://code.google.com/p/webrtc/issues/detail?id=1432

/Vikas

On Apr 8, 6:35 am, Tom <tom.m...@gmail.com> wrote:
> Are there any uptodate demos of this functionality around? This demo
> doesn't work at all in Chrome 26 and I'm not sure if it really shows
> 'pausing' of a stream in the same way.
>
>
>
>
>
>
>
> On Friday, 29 June 2012 20:06:29 UTC+1, Justin Uberti wrote:
>
> > To stop sending of RTP packets, use a=inactive or a=recvonly.
> > 1. createOffer
> > 2. Set a=recvonly in the SDP
> > 3. pc.setLocalDescription(OFFER, SDP)
> > 4. pc.setRemoteDescription(ANSWER, pc.remoteDescription)
>
> > Seehttps://webrtc-demos.appspot.com/html/pranswer.htmlfor a similar
> > example.
>
> > On Fri, Jun 29, 2012 at 4:08 AM, Alexey Ovchinnikov <ovch...@gmail.com<javascript:>
> > > wrote:
>
> >> Thank you very much. But I don't understand. This feature still not work?
> >> It's my sample:
> >>http://82.146.58.238/doacall.html.
> >> MuteVideo button must mute Video and Audio.
> >> In code it's
> >>                camera.videoTracks[0].enabled = false;
> >>                camera.audioTracks[0].enabled = false;
>
> >>                stream1.videoTracks[0].enabled = false;
> >>                stream1.audioTracks[0].enabled = false;
>
> >>                stream2.videoTracks[0].enabled = false;
> >>                stream2.audioTracks[0].enabled = false;
>
> >> I need stop sending RTP packets from source.
>
> >> What I do wrong?
>
> >> 2012/6/29 Brave Yao <brav...@webrtc.org <javascript:>>:

Tom

unread,
Apr 8, 2013, 1:57:25 PM4/8/13
to discuss...@googlegroups.com
Thats good to know Vikas,

Do you have any thoughts on the issue at this moment? I'm not familiar with the old API's in these demos but I need to achieve pausing the media stream. All the advice i've read points to changing the SDP to a=inactive - however doing this with setLocalDescription always results in state errors such as:

"SetLocalDescription failed: Called with type in wrong state, type: answer state: STATE_INPROGRESS"
"SetLocalDescription failed: Failed to update session state."

I'm at a loss as to what I need to do for the connection to allow me to renegotiate / change the descriptions.

Cheers,

Vikas Marwaha

unread,
Apr 8, 2013, 2:20:29 PM4/8/13
to discuss...@googlegroups.com
Thanks Tom for the feedback, i think Justin's suggestion below for setting a =recvonly or a=inactive should work fine to stop sending RTP packets. You need to renegotiate with an offer-answer for the modified sdp. I will see if i can recreate the errors you see.

/Vikas


--
Message has been deleted

Vikas

unread,
Apr 8, 2013, 5:47:42 PM4/8/13
to discuss-webrtc
Hi Tom,

I have updated the pranswer.html demo. You can take a look at the demo
code.
webrtc-demos.appspot.com/html/pranswer.html

/Vikas

On Apr 8, 11:20 am, Vikas Marwaha <vikasmarw...@webrtc.org> wrote:
> Thanks Tom for the feedback, i think Justin's suggestion below for setting
> a =recvonly or a=inactive should work fine to stop sending RTP packets. You
> need to renegotiate with an offer-answer for the modified sdp. I will see
> if i can recreate the errors you see.
>
> /Vikas
>
>
>
>
>
>
>
> On Mon, Apr 8, 2013 at 10:57 AM, Tom <tom.m...@gmail.com> wrote:
> > Thats good to know Vikas,
>
> > Do you have any thoughts on the issue at this moment? I'm not familiar
> > with the old API's in these demos but I need to achieve pausing the media
> > stream. All the advice i've read points to changing the SDP to a=inactive -
> > however doing this with setLocalDescription always results in state errors
> > such as:
>
> > "SetLocalDescription failed: Called with type in wrong state, type: answer
> > state: STATE_INPROGRESS"
> > "SetLocalDescription failed: Failed to update session state."
>
> > I'm at a loss as to what I need to do for the connection to allow me to
> > renegotiate / change the descriptions.
>
> > Cheers,
>
> > On Monday, 8 April 2013 18:18:03 UTC+1, Vikas wrote:
>
> >> Hi Tom,
>
> >> We will be updating the pranswer.html demo to work on Chrome 26. There
> >> is a bug in the tracker. See issuehttps://code.google.com/p/**
> >> webrtc/issues/detail?id=1432<https://code.google.com/p/webrtc/issues/detail?id=1432>
>
> >> /Vikas
>
> >> On Apr 8, 6:35 am, Tom <tom.m...@gmail.com> wrote:
> >> > Are there any uptodate demos of this functionality around? This demo
> >> > doesn't work at all in Chrome 26 and I'm not sure if it really shows
> >> > 'pausing' of a stream in the same way.
>
> >> > On Friday, 29 June 2012 20:06:29 UTC+1, Justin Uberti wrote:
>
> >> > > To stop sending of RTP packets, use a=inactive or a=recvonly.
> >> > > 1. createOffer
> >> > > 2. Set a=recvonly in the SDP
> >> > > 3. pc.setLocalDescription(OFFER, SDP)
> >> > > 4. pc.setRemoteDescription(**ANSWER, pc.remoteDescription)
>
> >> > > Seehttps://webrtc-demos.**appspot.com/html/pranswer.**htmlfor<http://webrtc-demos.appspot.com/html/pranswer.htmlfor>a similar
> >> > > example.
>
> >> > > On Fri, Jun 29, 2012 at 4:08 AM, Alexey Ovchinnikov <
> >> ovch...@gmail.com<javascript:**>
> >> > > > wrote:
>
> >> > >> Thank you very much. But I don't understand. This feature still not
> >> work?
> >> > >> It's my sample:
> >> > >>http://82.146.58.238/**doacall.html<http://82.146.58.238/doacall.html>.
>
> >> > >> MuteVideo button must mute Video and Audio.
> >> > >> In code it's
> >> > >>                camera.videoTracks[0].enabled = false;
> >> > >>                camera.audioTracks[0].enabled = false;
>
> >> > >>                stream1.videoTracks[0].**enabled = false;
> >> > >>                stream1.audioTracks[0].**enabled = false;
>
> >> > >>                stream2.videoTracks[0].**enabled = false;
> >> > >>                stream2.audioTracks[0].**enabled = false;

Vikas Marwaha

unread,
Apr 10, 2013, 6:16:24 PM4/10/13
to discuss...@googlegroups.com
Hi Tom,

This sounds similar to issue 1510, i added some test code to the issue tracker. https://code.google.com/p/webrtc/issues/detail?id=1510

/Vikas


On Mon, Apr 8, 2013 at 11:43 AM, Tom <tom....@gmail.com> wrote:
Thanks Vikas,

Appreciated, possibility that im being dumb here but all other aspects of communication are working without a hitch. Essentially, i'm doing the following:

pc.removeStream() -> pc.onnegotiationneeded() -> pc.createOffer() -> pc.setLocalDescription(offer)

And then i see the errors you have above.

Best,
Reply all
Reply to author
Forward
0 new messages