From 3599df57ec7bcb1beea76f2af8dc6ad2bc433fe3 Mon Sep 17 00:00:00 2001 From: Lyubomir Marinov Date: Thu, 20 Aug 2009 18:15:59 +0000 Subject: [PATCH] Applies the idea of Carlos Alexandre for fixing the slow call hang-up on Linux reported by him. --- .../communicator/impl/media/MediaControl.java | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/net/java/sip/communicator/impl/media/MediaControl.java b/src/net/java/sip/communicator/impl/media/MediaControl.java index 3b385fc3a..a0c105bca 100644 --- a/src/net/java/sip/communicator/impl/media/MediaControl.java +++ b/src/net/java/sip/communicator/impl/media/MediaControl.java @@ -286,7 +286,7 @@ else if (videoDataSource != null) } /** - * Allows this instance to dispose of any state which is to reinitialized by + * Allows this instance to dispose of any state which is reinitialized by * {@link #initCaptureDevices()}. For example, a vital requirement is to * invoke {@link Controller#close()} on sourceProcessor * regardless of the fact that it is soon to not be referenced at all or it @@ -296,7 +296,27 @@ else if (videoDataSource != null) private void disposeBeforeInitCaptureDevices() { if (avDataSource != null) + { + /* + * As reported by Carlos Alexandre, stopping before disconnecting + * resolves a slow disconnect on Linux. + */ + try + { + avDataSource.stop(); + } + catch (IOException ex) + { + /* + * We cannot do much about the exception because we're not + * really interested in the stopping but rather in calling + * DataSource#disconnect() anyway. + */ + logger.error("Failed to properly stop avDataSource.", ex); + } + avDataSource.disconnect(); + } if (sourceProcessor != null) { sourceProcessor.stop(); @@ -587,8 +607,8 @@ public void closeCaptureDevices() if(avDataSource != null) avDataSource.stop(); } catch (IOException exc) { - logger.error("Failed to close a capture date source.", exc); - throw new MediaException("Failed to close a capture date source." + logger.error("Failed to close a capture data source.", exc); + throw new MediaException("Failed to close a capture data source." , MediaException.INTERNAL_ERROR , exc); }