Adds a "synchronized" to complete the synchronization of the access to a field (which never really manifested into a problem for me but just for the sake of completeness).

cusax-fix
Lyubomir Marinov 17 years ago
parent 61196ca711
commit fd85c0542d

@ -59,8 +59,8 @@ public class AudioMixerMediaDevice
= new Vector<SoundLevelListener>();
/**
* 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<Long,Integer> lev = new HashMap<Long, Integer>();
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<SoundLevelListener> listeners;
synchronized (stSoundLevelListeners)
{
listeners = new ArrayList<SoundLevelListener>(
stSoundLevelListeners);
listeners
= new ArrayList<SoundLevelListener>(
stSoundLevelListeners);
}
for (Iterator<SoundLevelListener> listenerIter
= listeners.iterator(); listenerIter.hasNext();)
{
listenerIter.next().soundLevelChanged(soundLevelEvent);
}
for (SoundLevelListener listener : listeners)
listener.soundLevelChanged(soundLevelEvent);
lastLevel = newLevel;
}

@ -163,7 +163,7 @@ public class MediaDeviceSession
private MediaDirection startedDirection = MediaDirection.INACTIVE;
/**
* The <tt>MediaStream</tt> that creates us.
* The <tt>MediaStream</tt> that created us.
*/
private MediaStream parentStream = null;
@ -1420,7 +1420,7 @@ private static boolean waitForState(Processor processor, int state)
}
/**
* Sets the parent <tt>MediaStream</tt> that creates us.
* Sets the parent <tt>MediaStream</tt> that created us.
*
* @param parentStream the parentStream to set
*/
@ -1430,7 +1430,8 @@ public void setParentStream(MediaStream parentStream)
}
/**
* Retrurns the parent <tt>MediaStream</tt> that creates us.
* Returns the parent <tt>MediaStream</tt> that created us.
*
* @return the parentStream that created us.
*/
public MediaStream getParentStream()

Loading…
Cancel
Save