aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/service/protocol/media/CallPeerMediaHandler.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/java/sip/communicator/service/protocol/media/CallPeerMediaHandler.java')
-rw-r--r--src/net/java/sip/communicator/service/protocol/media/CallPeerMediaHandler.java122
1 files changed, 74 insertions, 48 deletions
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 d7585e5..507b3e2 100644
--- a/src/net/java/sip/communicator/service/protocol/media/CallPeerMediaHandler.java
+++ b/src/net/java/sip/communicator/service/protocol/media/CallPeerMediaHandler.java
@@ -504,11 +504,12 @@ public abstract class CallPeerMediaHandler
MediaDirection newValue = videoDirectionUserPreference;
- /* we do not send an event here if video is enabled because we have to
- * wait video stream starts to have correct MediaDevice set in
- * VideoMediaDeviceSession
+ /*
+ * Do not send an event here if the local video is enabled because the
+ * video stream needs to start before the correct MediaDevice is set in
+ * VideoMediaDeviceSession.
*/
- if(!enabled)
+ if (!enabled)
{
firePropertyChange(
OperationSetVideoTelephony.LOCAL_VIDEO_STREAMING,
@@ -709,48 +710,21 @@ public abstract class CallPeerMediaHandler
}
/**
- * Gets local visual <tt>Component</tt> of the local peer.
+ * Gets the visual <tt>Component</tt>, if any, depicting the video streamed
+ * from the local peer to the remote peer.
*
- * @return visual <tt>Component</tt>
+ * @return the visual <tt>Component</tt> depicting the local video if local
+ * video is actually being streamed from the local peer to the remote peer;
+ * otherwise, <tt>null</tt>
*/
- public Component createLocalVisualComponent()
+ public Component getLocalVisualComponent()
{
- boolean flipLocalVideoDisplay = true;
- OperationSetDesktopSharingServer desktopOpSet
- = peer.getCall().getProtocolProvider().getOperationSet(
- OperationSetDesktopSharingServer.class);
- // If the call video is a desktop sharing stream, then do not flip the
- // local video display.
- if (desktopOpSet != null
- && desktopOpSet.isLocalVideoAllowed(peer.getCall()))
- {
- flipLocalVideoDisplay = false;
- }
-
MediaStream videoStream = getStream(MediaType.VIDEO);
return
((videoStream == null) || !isLocalVideoTransmissionEnabled())
? null
- : ((VideoMediaStream) videoStream).createLocalVisualComponent(
- flipLocalVideoDisplay);
- }
-
- /**
- * Disposes of a specific local visual <tt>Component</tt> of the local peer.
- *
- * @param component the local visual <tt>Component</tt> of the local peer to
- * dispose of
- */
- public void disposeLocalVisualComponent(Component component)
- {
- MediaStream videoStream = getStream(MediaType.VIDEO);
-
- if (videoStream != null)
- {
- ((VideoMediaStream) videoStream).disposeLocalVisualComponent(
- component);
- }
+ : ((VideoMediaStream) videoStream).getLocalVisualComponent();
}
/**
@@ -919,15 +893,31 @@ public abstract class CallPeerMediaHandler
* @throws OperationFailedException if creating the stream fails for any
* reason (like, for example, accessing the device or setting the format).
*/
- protected MediaStream initStream(StreamConnector connector,
- MediaDevice device,
- MediaFormat format,
- MediaStreamTarget target,
- MediaDirection direction,
- List<RTPExtension> rtpExtensions,
- boolean masterStream)
+ protected MediaStream initStream(StreamConnector connector,
+ MediaDevice device,
+ MediaFormat format,
+ MediaStreamTarget target,
+ MediaDirection direction,
+ List<RTPExtension> rtpExtensions,
+ boolean masterStream)
throws OperationFailedException
{
+ MediaType mediaType = device.getMediaType();
+
+ /*
+ * Do make sure that no unintentional streaming of media generated by
+ * the user without prior consent will happen.
+ */
+ direction = direction.and(getDirectionUserPreference(mediaType));
+ if (device != null)
+ {
+ /*
+ * If the device does not support a direction, there is really
+ * nothing to be done at this point to make it use it.
+ */
+ direction = direction.and(device.getDirection());
+ }
+
MediaStream stream
= mediaHandler.initStream(
this,
@@ -939,7 +929,7 @@ public abstract class CallPeerMediaHandler
rtpExtensions,
masterStream);
- switch (device.getMediaType())
+ switch (mediaType)
{
case AUDIO:
audioStream = (AudioMediaStream) stream;
@@ -1310,8 +1300,7 @@ public abstract class CallPeerMediaHandler
*/
firePropertyChange(
OperationSetVideoTelephony.LOCAL_VIDEO_STREAMING,
- null,
- this.videoDirectionUserPreference);
+ null, videoDirectionUserPreference);
if(!stream.isStarted())
{
@@ -1586,4 +1575,41 @@ public abstract class CallPeerMediaHandler
conferenceMember));
}
}
+
+ /**
+ * Determines whether RTP translation is enabled for the <tt>CallPeer</tt>
+ * represented by this <tt>CallPeerMediaHandler</tt>.
+ * <p>
+ * For the sake of simplicity at the time of this writing, the current
+ * implementation presumes the <tt>MediaType</tt> is <tt>VIDEO</tt>.
+ * </p>
+ *
+ * @return <tt>true</tt> if RTP translation is enabled for the
+ * <tt>CallPeer</tt> represented by this <tt>CallPeerMediaHandler</tt>;
+ * otherwise, <tt>false</tt>
+ */
+ public boolean isRTPTranslationEnabled()
+ {
+ T peer = getPeer();
+ MediaAwareCall<?,?,?> call = peer.getCall();
+
+ if ((call != null)
+ && call.isConferenceFocus()
+ && !call.isLocalVideoStreaming())
+ {
+ Iterator<?> callPeerIt = call.getCallPeers();
+
+ while (callPeerIt.hasNext())
+ {
+ MediaAwareCallPeer<?,?,?> callPeer
+ = (MediaAwareCallPeer<?,?,?>) callPeerIt.next();
+ MediaStream videoMediaStream
+ = callPeer.getMediaHandler().getStream(MediaType.VIDEO);
+
+ if (videoMediaStream != null)
+ return true;
+ }
+ }
+ return false;
+ }
}