diff --git a/src/net/java/sip/communicator/impl/neomedia/device/AudioMixerMediaDevice.java b/src/net/java/sip/communicator/impl/neomedia/device/AudioMixerMediaDevice.java index 72dd1db04..24960be62 100644 --- a/src/net/java/sip/communicator/impl/neomedia/device/AudioMixerMediaDevice.java +++ b/src/net/java/sip/communicator/impl/neomedia/device/AudioMixerMediaDevice.java @@ -59,8 +59,8 @@ public class AudioMixerMediaDevice = new Vector(); /** - * The dispatcher of the events, handle the calculation and the - * evnent firing in different thread. + * The dispatcher of the events, handle the calculation and the event firing + * in a different thread. */ private LocalSliEventDispatcher localEventsDispatcher = null; @@ -221,20 +221,23 @@ protected void read( else if (dataSource instanceof ReceiveStreamPushBufferDataSource) { - ReceiveStream receiveStream - = ((ReceiveStreamPushBufferDataSource) dataSource) - .getReceiveStream(); /* * The audio of a ReceiveStream to be contributed to the * mix. */ - StreamSliEventDispatcher stEvDispatch = - streamSoundLevelListeners.get(receiveStream); + ReceiveStream receiveStream + = ((ReceiveStreamPushBufferDataSource) dataSource) + .getReceiveStream(); + StreamSliEventDispatcher stEvDispatch; - if(stEvDispatch != null) + synchronized (streamSoundLevelListeners) { - stEvDispatch.addData(buffer); + stEvDispatch + = streamSoundLevelListeners.get(receiveStream); } + + if(stEvDispatch != null) + stEvDispatch.addData(buffer); } } }; @@ -677,7 +680,6 @@ public void setParentStream(MediaStream parentStream) audioMixerMediaDeviceSession.setParentStream(parentStream); } - /** * Returns the list of SSRC identifiers that are directly contributing * to the media flows that we are sending out. Note that since this is @@ -909,27 +911,26 @@ public void run() lastLevel); Map lev = new HashMap(); + MediaStream parentStream = deviceSession.getParentStream(); + + lev.put(parentStream.getRemoteSourceID(), newLevel); - lev.put(deviceSession.getParentStream().getRemoteSourceID(), - newLevel); SoundLevelChangeEvent soundLevelEvent = new SoundLevelChangeEvent( - deviceSession.getParentStream(), - lev); + parentStream, + lev); List listeners; synchronized (stSoundLevelListeners) { - listeners = new ArrayList( - stSoundLevelListeners); + listeners + = new ArrayList( + stSoundLevelListeners); } - for (Iterator listenerIter - = listeners.iterator(); listenerIter.hasNext();) - { - listenerIter.next().soundLevelChanged(soundLevelEvent); - } + for (SoundLevelListener listener : listeners) + listener.soundLevelChanged(soundLevelEvent); lastLevel = newLevel; } diff --git a/src/net/java/sip/communicator/impl/neomedia/device/MediaDeviceSession.java b/src/net/java/sip/communicator/impl/neomedia/device/MediaDeviceSession.java index 9628e2328..c8574d807 100644 --- a/src/net/java/sip/communicator/impl/neomedia/device/MediaDeviceSession.java +++ b/src/net/java/sip/communicator/impl/neomedia/device/MediaDeviceSession.java @@ -163,7 +163,7 @@ public class MediaDeviceSession private MediaDirection startedDirection = MediaDirection.INACTIVE; /** - * The MediaStream that creates us. + * The MediaStream that created us. */ private MediaStream parentStream = null; @@ -1420,7 +1420,7 @@ private static boolean waitForState(Processor processor, int state) } /** - * Sets the parent MediaStream that creates us. + * Sets the parent MediaStream that created us. * * @param parentStream the parentStream to set */ @@ -1430,7 +1430,8 @@ public void setParentStream(MediaStream parentStream) } /** - * Retrurns the parent MediaStream that creates us. + * Returns the parent MediaStream that created us. + * * @return the parentStream that created us. */ public MediaStream getParentStream()