From f6fb5d5ae6756e427d54b60c182d412035edba89 Mon Sep 17 00:00:00 2001 From: Damian Minkov Date: Fri, 13 Feb 2015 11:50:15 +0200 Subject: [PATCH] Removes duplicate code and reuse createVideoCall. --- ...perationSetDesktopStreamingJabberImpl.java | 16 +++----- .../OperationSetVideoTelephonySipImpl.java | 38 ++++++++++++++----- 2 files changed, 35 insertions(+), 19 deletions(-) diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetDesktopStreamingJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetDesktopStreamingJabberImpl.java index 3a46b9952..4df00ad12 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetDesktopStreamingJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetDesktopStreamingJabberImpl.java @@ -92,7 +92,7 @@ public Call createVideoCall(String uri, MediaDevice mediaDevice) * @return CallPeer the CallPeer that will represented by the * specified uri. All following state change events will be delivered * through that call peer. The Call that this peer is a member - * of could be retrieved from the CallParticipatn instance with the use + * of could be retrieved from the CallParticipant instance with the use * of the corresponding method. * @throws OperationFailedException with the corresponding code if we fail * to create the video call. @@ -111,7 +111,7 @@ public Call createVideoCall(Contact callee, MediaDevice mediaDevice) * @return CallPeer the CallPeer that will represented by the * specified uri. All following state change events will be delivered * through that call peer. The Call that this peer is a member - * of could be retrieved from the CallParticipatn instance with the use + * of could be retrieved from the CallParticipant instance with the use * of the corresponding method. * @throws OperationFailedException with the corresponding code if we fail * to create the video call. @@ -136,20 +136,16 @@ public Call createVideoCall(String uri) * @return CallPeer the CallPeer that will represented by the * specified uri. All following state change events will be delivered * through that call peer. The Call that this peer is a member - * of could be retrieved from the CallParticipatn instance with the use + * of could be retrieved from the CallParticipant instance with the use * of the corresponding method. * @throws OperationFailedException with the corresponding code if we fail * to create the video call. */ @Override - public Call createVideoCall(Contact callee) throws OperationFailedException + public Call createVideoCall(Contact callee) + throws OperationFailedException { - Call call = createOutgoingVideoCall(callee.getAddress()); - MediaDevice device - = ((MediaAwareCall) call).getDefaultDevice(MediaType.VIDEO); - size = (((VideoMediaFormat)device.getFormat()).getSize()); - origin = getOriginForMediaDevice(device); - return call; + return createVideoCall(callee.getAddress()); } /** diff --git a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetVideoTelephonySipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetVideoTelephonySipImpl.java index bf5208a74..154e2846c 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetVideoTelephonySipImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetVideoTelephonySipImpl.java @@ -64,8 +64,8 @@ public OperationSetVideoTelephonySipImpl( super(basicTelephony); parentProvider.registerMethodProcessor( - Request.INFO, - new PictureFastUpdateMethodProcessor()); + Request.INFO, + new PictureFastUpdateMethodProcessor()); } /** @@ -153,8 +153,33 @@ public Call createVideoCall(Contact callee) public Call createVideoCall(String uri, QualityPreset qualityPreferences) throws OperationFailedException, ParseException { - Address toAddress = parentProvider.parseAddressString(uri); + return createVideoCall( + parentProvider.parseAddressString(uri), qualityPreferences); + } + /** + * Create a new video call and invite the specified CallPeer to it. + * + * @param toAddress the address of the callee that we should invite to a new + * call. + * @param qualityPreferences the quality preset we will use establishing + * the video call, and we will expect from the other side. When establishing + * call we don't have any indications whether remote part supports quality + * presets, so this setting can be ignored. + * @return CallPeer the CallPeer that will represented by the + * specified uri. All following state change events will be delivered + * through that call peer. The Call that this peer is a member + * of could be retrieved from the CallParticipatn instance with the use + * of the corresponding method. + * @throws OperationFailedException with the corresponding code if we fail + * to create the video call. + * @throws ParseException if callee is not a valid sip address + * string. + */ + private Call createVideoCall(Address toAddress, + QualityPreset qualityPreferences) + throws OperationFailedException + { CallSipImpl call = basicTelephony.createOutgoingCall(); call.setLocalVideoAllowed(true, getMediaUseCase()); call.setInitialQualityPreferences(qualityPreferences); @@ -198,12 +223,7 @@ public Call createVideoCall(Contact callee, throw new IllegalArgumentException(ex.getMessage()); } - CallSipImpl call = basicTelephony.createOutgoingCall(); - call.setLocalVideoAllowed(true, getMediaUseCase()); - call.setInitialQualityPreferences(qualityPreferences); - call.invite(toAddress, null); - - return call; + return createVideoCall(toAddress, qualityPreferences); } /**