From d0a429733247c9aee602d28387dd2e4289bf2bdd Mon Sep 17 00:00:00 2001 From: Boris Grozev Date: Mon, 5 Aug 2013 12:50:45 +0300 Subject: [PATCH] Handles local hold when a videobridge is in use --- .../CallPeerMediaHandlerJabberImpl.java | 48 +++++++++++++++++-- .../protocol/media/CallPeerMediaHandler.java | 4 +- 2 files changed, 46 insertions(+), 6 deletions(-) diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/CallPeerMediaHandlerJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/CallPeerMediaHandlerJabberImpl.java index 3906113f5..06babe3ef 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/CallPeerMediaHandlerJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/CallPeerMediaHandlerJabberImpl.java @@ -1880,10 +1880,10 @@ public void setRemotelyOnHold(boolean onHold) * need to ask the videobridge to change the stream * direction on behalf of us. */ + ColibriConferenceIQ.Channel channel + = getColibriChannel(mediaType); if(remotelyOnHold) { - ColibriConferenceIQ.Channel channel - = getColibriChannel(mediaType); getPeer().getCall().setChannelDirection( channel.getID(), mediaType, @@ -1892,8 +1892,6 @@ public void setRemotelyOnHold(boolean onHold) else { //TODO: does SENDRECV always make sense? - ColibriConferenceIQ.Channel channel - = getColibriChannel(mediaType); getPeer().getCall().setChannelDirection( channel.getID(), mediaType, @@ -2152,6 +2150,48 @@ public boolean isRemotelyOnHold() return remotelyOnHold; } + /** + * {@inheritDoc} + * + * Handles the case when a videobridge is in use. + * + * @param locallyOnHold true if we are to make our streams + * stop transmitting and false if we are to start transmitting + */ + @Override + public void setLocallyOnHold(boolean locallyOnHold) + { + if (!getPeer().isJitsiVideoBridge()) + { + super.setLocallyOnHold(locallyOnHold); + } + else + { + this.locallyOnHold = locallyOnHold; + + if (!locallyOnHold + && CallPeerState.ON_HOLD_MUTUALLY.equals(getPeer().getState())) + return; + + for (MediaType mediaType : MediaType.values()) + { + ColibriConferenceIQ.Channel channel + = getColibriChannel(mediaType); + if (channel == null) + continue; + + MediaDirection direction + = locallyOnHold + ? MediaDirection.INACTIVE + : MediaDirection.SENDRECV; + + getPeer().getCall().setChannelDirection( + channel.getID(), + mediaType, + direction); + } + } + } } diff --git a/src/net/java/sip/communicator/service/protocol/media/CallPeerMediaHandler.java b/src/net/java/sip/communicator/service/protocol/media/CallPeerMediaHandler.java index 887d0bf71..ab87b52c5 100644 --- a/src/net/java/sip/communicator/service/protocol/media/CallPeerMediaHandler.java +++ b/src/net/java/sip/communicator/service/protocol/media/CallPeerMediaHandler.java @@ -134,7 +134,7 @@ public boolean requestKeyFrame() /** * Determines whether we have placed the call on hold locally. */ - private boolean locallyOnHold = false; + protected boolean locallyOnHold = false; /** * The listener that the CallPeer registered for local user audio @@ -1534,7 +1534,7 @@ public void setLocalAudioTransmissionEnabled(boolean enabled) * (according to the value of locallyOnHold). This would also be * taken into account when the next update offer is generated. * - * @param locallyOnHold true if we are to make our audio stream + * @param locallyOnHold true if we are to make our streams * stop transmitting and false if we are to start transmitting * again. */