8000 Use ConcurrentHashMap to store callback so that iterations are thread… · next-coder/flutter-webrtc@b25d741 · GitHub
[go: up one dir, main page]

Skip to content 8000

Commit b25d741

Browse files
committed
Use ConcurrentHashMap to store callback so that iterations are thread safe.
1 parent 096b2bc commit b25d741

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

android/src/main/java/com/cloudwebrtc/webrtc/record/AudioSamplesInterceptor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import org.webrtc.audio.JavaAudioDeviceModule.SamplesReadyCallback;
77
import org.webrtc.audio.JavaAudioDeviceModule.AudioSamples;
88

9-
import java.util.HashMap;
9+
import java.util.concurrent.ConcurrentHashMap;
1010

1111
/** JavaAudioDeviceModule allows attaching samples callback only on building
1212
* We don't want to instantiate VideoFileRenderer and codecs at this step
@@ -17,7 +17,7 @@ public class AudioSamplesInterceptor implements SamplesReadyCallback {
1717
private int _id;
1818
private static final String TAG = "AudioSamplesInterceptor";
1919
@SuppressLint("UseSparseArrays")
20-
protected final HashMap<Integer, SamplesReadyCallback> callbacks = new HashMap<>();
20+
protected final ConcurrentHashMap<Integer, SamplesReadyCallback> callbacks = new ConcurrentHashMap<>();
2121

2222
public AudioSamplesInterceptor() {
2323
this._id = id++;

0 commit comments

Comments
 (0)
0