diff --git a/examples/androidapp/src/org/appspot/apprtc/CpuMonitor.java b/examples/androidapp/src/org/appspot/apprtc/CpuMonitor.java index 9113042a4b..e90dd04c14 100644 --- a/examples/androidapp/src/org/appspot/apprtc/CpuMonitor.java +++ b/examples/androidapp/src/org/appspot/apprtc/CpuMonitor.java @@ -180,6 +180,8 @@ class CpuMonitor { scheduleCpuUtilizationTask(); } + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void reset() { if (executor != null) { Log.d(TAG, "reset"); @@ -188,14 +190,20 @@ class CpuMonitor { } } + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized int getCpuUsageCurrent() { return doubleToPercent(userCpuUsage.getCurrent() + systemCpuUsage.getCurrent()); } + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized int getCpuUsageAverage() { return doubleToPercent(userCpuUsage.getAverage() + systemCpuUsage.getAverage()); } + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized int getFrequencyScaleAverage() { return doubleToPercent(frequencyScale.getAverage()); } diff --git a/examples/androidtests/src/org/appspot/apprtc/test/PeerConnectionClientTest.java b/examples/androidtests/src/org/appspot/apprtc/test/PeerConnectionClientTest.java index 3c64b3022b..cae09e0d42 100644 --- a/examples/androidtests/src/org/appspot/apprtc/test/PeerConnectionClientTest.java +++ b/examples/androidtests/src/org/appspot/apprtc/test/PeerConnectionClientTest.java @@ -100,12 +100,16 @@ public class PeerConnectionClientTest implements PeerConnectionEvents { } // Resets render to wait for new amount of video frames. + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void reset(int expectedFrames) { renderFrameCalled = false; doneRendering = new CountDownLatch(expectedFrames); } @Override + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void renderFrame(VideoRenderer.I420Frame frame) { if (!renderFrameCalled) { if (rendererName != null) { @@ -143,12 +147,16 @@ public class PeerConnectionClientTest implements PeerConnectionEvents { } // Resets render to wait for new amount of video frames. + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void reset(int expectedFrames) { renderFrameCalled = false; doneRendering = new CountDownLatch(expectedFrames); } @Override + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void onFrame(VideoFrame frame) { if (!renderFrameCalled) { if (rendererName != null) { diff --git a/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioManager.java b/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioManager.java index 730d443c06..12b2fad129 100644 --- a/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioManager.java +++ b/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioManager.java @@ -48,6 +48,8 @@ public class WebRtcAudioManager { // specified in WebRtcAudioUtils.BLACKLISTED_OPEN_SL_ES_MODELS. // Allows an app to take control over which devices to exclude from using // the OpenSL ES audio output path + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public static synchronized void setBlacklistDeviceForOpenSLESUsage(boolean enable) { blacklistDeviceForOpenSLESUsageIsOverridden = true; blacklistDeviceForOpenSLESUsage = enable; @@ -55,18 +57,28 @@ public class WebRtcAudioManager { // Call these methods to override the default mono audio modes for the specified direction(s) // (input and/or output). + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public static synchronized void setStereoOutput(boolean enable) { Logging.w(TAG, "Overriding default output behavior: setStereoOutput(" + enable + ')'); useStereoOutput = enable; } + + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public static synchronized void setStereoInput(boolean enable) { Logging.w(TAG, "Overriding default input behavior: setStereoInput(" + enable + ')'); useStereoInput = enable; } + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public static synchronized boolean getStereoOutput() { return useStereoOutput; } + + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public static synchronized boolean getStereoInput() { return useStereoInput; } diff --git a/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioTrack.java b/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioTrack.java index 15b9a0d597..ae7a16f8f0 100644 --- a/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioTrack.java +++ b/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioTrack.java @@ -50,6 +50,8 @@ public class WebRtcAudioTrack { // This method overrides the default usage attribute and allows the user // to set it to something else than AudioAttributes.USAGE_VOICE_COMMUNICATION. // NOTE: calling this method will most likely break existing VoIP tuning. + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public static synchronized void setAudioTrackUsageAttribute(int usage) { Logging.w(TAG, "Default usage attribute is changed from: " + DEFAULT_USAGE + " to " + usage); diff --git a/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioUtils.java b/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioUtils.java index 5689d20ef5..e55d738c2c 100644 --- a/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioUtils.java +++ b/modules/audio_device/android/java/src/org/webrtc/voiceengine/WebRtcAudioUtils.java @@ -60,30 +60,46 @@ public final class WebRtcAudioUtils { // Call these methods if any hardware based effect shall be replaced by a // software based version provided by the WebRTC stack instead. + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public static synchronized void setWebRtcBasedAcousticEchoCanceler(boolean enable) { useWebRtcBasedAcousticEchoCanceler = enable; } + + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public static synchronized void setWebRtcBasedNoiseSuppressor(boolean enable) { useWebRtcBasedNoiseSuppressor = enable; } + + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public static synchronized void setWebRtcBasedAutomaticGainControl(boolean enable) { // TODO(henrika): deprecated; remove when no longer used by any client. Logging.w(TAG, "setWebRtcBasedAutomaticGainControl() is deprecated"); } + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public static synchronized boolean useWebRtcBasedAcousticEchoCanceler() { if (useWebRtcBasedAcousticEchoCanceler) { Logging.w(TAG, "Overriding default behavior; now using WebRTC AEC!"); } return useWebRtcBasedAcousticEchoCanceler; } + + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public static synchronized boolean useWebRtcBasedNoiseSuppressor() { if (useWebRtcBasedNoiseSuppressor) { Logging.w(TAG, "Overriding default behavior; now using WebRTC NS!"); } return useWebRtcBasedNoiseSuppressor; } + // TODO(henrika): deprecated; remove when no longer used by any client. + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public static synchronized boolean useWebRtcBasedAutomaticGainControl() { // Always return true here to avoid trying to use any built-in AGC. return true; @@ -110,15 +126,21 @@ public final class WebRtcAudioUtils { // Call this method if the default handling of querying the native sample // rate shall be overridden. Can be useful on some devices where the // available Android APIs are known to return invalid results. + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public static synchronized void setDefaultSampleRateHz(int sampleRateHz) { isDefaultSampleRateOverridden = true; defaultSampleRateHz = sampleRateHz; } + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public static synchronized boolean isDefaultSampleRateOverridden() { return isDefaultSampleRateOverridden; } + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public static synchronized int getDefaultSampleRateHz() { return defaultSampleRateHz; } diff --git a/rtc_base/java/src/org/webrtc/Logging.java b/rtc_base/java/src/org/webrtc/Logging.java index 347d495429..fdde0bc7b1 100644 --- a/rtc_base/java/src/org/webrtc/Logging.java +++ b/rtc_base/java/src/org/webrtc/Logging.java @@ -104,6 +104,8 @@ public class Logging { // Enable diagnostic logging for messages of |severity| to the platform debug // output. On Android, the output will be directed to Logcat. // Note: this function starts collecting the output of the LOG() macros. + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public static synchronized void enableLogToDebugOutput(Severity severity) { if (!loadNativeLibrary()) { fallbackLogger.log(Level.WARNING, "Cannot enable logging because native lib not loaded."); diff --git a/sdk/android/api/org/webrtc/EglRenderer.java b/sdk/android/api/org/webrtc/EglRenderer.java index 22e1a4cff0..8eb1928cef 100644 --- a/sdk/android/api/org/webrtc/EglRenderer.java +++ b/sdk/android/api/org/webrtc/EglRenderer.java @@ -55,11 +55,15 @@ public class EglRenderer implements VideoRenderer.Callbacks, VideoSink { private class EglSurfaceCreation implements Runnable { private Object surface; + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void setSurface(Object surface) { this.surface = surface; } @Override + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void run() { if (surface != null && eglBase != null && !eglBase.hasSurface()) { if (surface instanceof Surface) { diff --git a/sdk/android/api/org/webrtc/ScreenCapturerAndroid.java b/sdk/android/api/org/webrtc/ScreenCapturerAndroid.java index 08d34dda8a..8b69a5123d 100644 --- a/sdk/android/api/org/webrtc/ScreenCapturerAndroid.java +++ b/sdk/android/api/org/webrtc/ScreenCapturerAndroid.java @@ -77,6 +77,8 @@ public class ScreenCapturerAndroid } @Override + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void initialize(final SurfaceTextureHelper surfaceTextureHelper, final Context applicationContext, final VideoCapturer.CapturerObserver capturerObserver) { checkNotDisposed(); @@ -96,6 +98,8 @@ public class ScreenCapturerAndroid } @Override + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void startCapture( final int width, final int height, final int ignoredFramerate) { checkNotDisposed(); @@ -115,6 +119,8 @@ public class ScreenCapturerAndroid } @Override + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void stopCapture() { checkNotDisposed(); ThreadUtils.invokeAtFrontUninterruptibly(surfaceTextureHelper.getHandler(), new Runnable() { @@ -140,6 +146,8 @@ public class ScreenCapturerAndroid } @Override + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void dispose() { isDisposed = true; } @@ -153,6 +161,8 @@ public class ScreenCapturerAndroid * @param ignoredFramerate ignored */ @Override + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void changeCaptureFormat( final int width, final int height, final int ignoredFramerate) { checkNotDisposed(); diff --git a/sdk/android/instrumentationtests/src/org/webrtc/EglRendererTest.java b/sdk/android/instrumentationtests/src/org/webrtc/EglRendererTest.java index 3005f56ae9..6ba9168ee1 100644 --- a/sdk/android/instrumentationtests/src/org/webrtc/EglRendererTest.java +++ b/sdk/android/instrumentationtests/src/org/webrtc/EglRendererTest.java @@ -70,6 +70,8 @@ public class EglRendererTest { Bitmap storedBitmap; @Override + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void onFrame(Bitmap bitmap) { if (bitmapReceived) { fail("Unexpected bitmap was received."); @@ -80,6 +82,8 @@ public class EglRendererTest { notify(); } + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized boolean waitForBitmap(int timeoutMs) throws InterruptedException { final long endTimeMs = System.currentTimeMillis() + timeoutMs; while (!bitmapReceived) { @@ -92,6 +96,8 @@ public class EglRendererTest { return true; } + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized Bitmap resetAndGetBitmap() { bitmapReceived = false; return storedBitmap; diff --git a/sdk/android/instrumentationtests/src/org/webrtc/FileVideoCapturerTest.java b/sdk/android/instrumentationtests/src/org/webrtc/FileVideoCapturerTest.java index f13a6a0e4b..f3b7902eb6 100644 --- a/sdk/android/instrumentationtests/src/org/webrtc/FileVideoCapturerTest.java +++ b/sdk/android/instrumentationtests/src/org/webrtc/FileVideoCapturerTest.java @@ -40,6 +40,8 @@ public class FileVideoCapturerTest { } @Override + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void onByteBufferFrameCaptured( byte[] data, int width, int height, int rotation, long timeStamp) { // Empty on purpose. @@ -52,11 +54,15 @@ public class FileVideoCapturerTest { } @Override + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void onFrameCaptured(VideoFrame frame) { frames.add(frame); notify(); } + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized ArrayList getMinimumFramesBlocking(int minFrames) throws InterruptedException { while (frames.size() < minFrames) { diff --git a/sdk/android/instrumentationtests/src/org/webrtc/PeerConnectionTest.java b/sdk/android/instrumentationtests/src/org/webrtc/PeerConnectionTest.java index da5c136c7c..c7c3f7b6be 100644 --- a/sdk/android/instrumentationtests/src/org/webrtc/PeerConnectionTest.java +++ b/sdk/android/instrumentationtests/src/org/webrtc/PeerConnectionTest.java @@ -92,6 +92,8 @@ public class PeerConnectionTest { this.name = name; } + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void setDataChannel(DataChannel dataChannel) { assertNull(this.dataChannel); this.dataChannel = dataChannel; @@ -99,11 +101,15 @@ public class PeerConnectionTest { assertNotNull(this.dataChannel); } + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void expectIceCandidates(int count) { expectedIceCandidates += count; } @Override + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void onIceCandidate(IceCandidate candidate) { --expectedIceCandidates; @@ -119,16 +125,22 @@ public class PeerConnectionTest { @Override public void onIceCandidatesRemoved(IceCandidate[] candidates) {} + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void setExpectedResolution(int width, int height) { expectedWidth = width; expectedHeight = height; } + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void expectFramesDelivered(int count) { expectedFramesDelivered += count; } @Override + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void renderFrame(VideoRenderer.I420Frame frame) { assertTrue(expectedWidth > 0); assertTrue(expectedHeight > 0); @@ -138,20 +150,28 @@ public class PeerConnectionTest { VideoRenderer.renderFrameDone(frame); } + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void expectSignalingChange(SignalingState newState) { expectedSignalingChanges.add(newState); } @Override + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void onSignalingChange(SignalingState newState) { assertEquals(expectedSignalingChanges.removeFirst(), newState); } + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void expectIceConnectionChange(IceConnectionState newState) { expectedIceConnectionChanges.add(newState); } @Override + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void onIceConnectionChange(IceConnectionState newState) { // TODO(bemasc): remove once delivery of ICECompleted is reliable // (https://code.google.com/p/webrtc/issues/detail?id=3021). @@ -168,15 +188,21 @@ public class PeerConnectionTest { } @Override + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void onIceConnectionReceivingChange(boolean receiving) { System.out.println(name + "Got an ICE connection receiving change " + receiving); } + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void expectIceGatheringChange(IceGatheringState newState) { expectedIceGatheringChanges.add(newState); } @Override + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void onIceGatheringChange(IceGatheringState newState) { // It's fine to get a variable number of GATHERING messages before // COMPLETE fires (depending on how long the test runs) so we don't assert @@ -190,11 +216,15 @@ public class PeerConnectionTest { assertEquals(expectedIceGatheringChanges.removeFirst(), newState); } + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void expectAddStream(String label) { expectedAddStreamLabels.add(label); } @Override + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void onAddStream(MediaStream stream) { assertEquals(expectedAddStreamLabels.removeFirst(), stream.label()); for (AudioTrack track : stream.audioTracks) { @@ -209,11 +239,15 @@ public class PeerConnectionTest { gotRemoteStreams.add(stream); } + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void expectRemoveStream(String label) { expectedRemoveStreamLabels.add(label); } @Override + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void onRemoveStream(MediaStream stream) { assertEquals(expectedRemoveStreamLabels.removeFirst(), stream.label()); WeakReference renderer = renderers.remove(stream); @@ -224,40 +258,56 @@ public class PeerConnectionTest { gotRemoteStreams.remove(stream); } + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void expectDataChannel(String label) { expectedRemoteDataChannelLabels.add(label); } @Override + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void onDataChannel(DataChannel remoteDataChannel) { assertEquals(expectedRemoteDataChannelLabels.removeFirst(), remoteDataChannel.label()); setDataChannel(remoteDataChannel); assertEquals(DataChannel.State.CONNECTING, dataChannel.state()); } + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void expectRenegotiationNeeded() { ++expectedRenegotiations; } @Override + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void onRenegotiationNeeded() { assertTrue(--expectedRenegotiations >= 0); } + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void expectAddTrack(int expectedTracksAdded) { this.expectedTracksAdded = expectedTracksAdded; } @Override + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void onAddTrack(RtpReceiver receiver, MediaStream[] mediaStreams) { expectedTracksAdded--; } + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void expectMessage(ByteBuffer expectedBuffer, boolean expectedBinary) { expectedBuffers.add(new DataChannel.Buffer(expectedBuffer, expectedBinary)); } @Override + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void onMessage(DataChannel.Buffer buffer) { DataChannel.Buffer expected = expectedBuffers.removeFirst(); assertEquals(expected.binary, buffer.binary); @@ -265,21 +315,29 @@ public class PeerConnectionTest { } @Override + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void onBufferedAmountChange(long previousAmount) { assertFalse(previousAmount == dataChannel.bufferedAmount()); } @Override + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void onStateChange() { assertEquals(expectedStateChanges.removeFirst(), dataChannel.state()); } + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void expectStateChange(DataChannel.State state) { expectedStateChanges.add(state); } // Old getStats callback. @Override + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void onComplete(StatsReport[] reports) { if (--expectedOldStatsCallbacks < 0) { throw new RuntimeException("Unexpected stats report: " + Arrays.toString(reports)); @@ -289,6 +347,8 @@ public class PeerConnectionTest { // New getStats callback. @Override + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void onStatsDelivered(RTCStatsReport report) { if (--expectedNewStatsCallbacks < 0) { throw new RuntimeException("Unexpected stats report: " + report); @@ -296,6 +356,8 @@ public class PeerConnectionTest { } @Override + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void onFirstPacketReceived(MediaStreamTrack.MediaType mediaType) { if (mediaType == MediaStreamTrack.MediaType.MEDIA_TYPE_AUDIO) { expectedFirstAudioPacket--; @@ -307,19 +369,27 @@ public class PeerConnectionTest { } } + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void expectFirstPacketReceived() { expectedFirstAudioPacket = 1; expectedFirstVideoPacket = 1; } + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void expectOldStatsCallback() { ++expectedOldStatsCallbacks; } + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void expectNewStatsCallback() { ++expectedNewStatsCallbacks; } + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized LinkedList takeStatsReports() { LinkedList got = gotStatsReports; gotStatsReports = new LinkedList(); @@ -328,6 +398,8 @@ public class PeerConnectionTest { // Return a set of expectations that haven't been satisfied yet, possibly // empty if no such expectations exist. + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized TreeSet unsatisfiedExpectations() { TreeSet stillWaitingForExpectations = new TreeSet(); if (expectedIceCandidates > 0) { // See comment in onIceCandidate. @@ -447,6 +519,8 @@ public class PeerConnectionTest { } @Override + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void renderFrame(VideoRenderer.I420Frame frame) { // Because different camera devices (fake & physical) produce different // resolutions, we only sanity-check the set sizes, diff --git a/sdk/android/instrumentationtests/src/org/webrtc/SurfaceTextureHelperTest.java b/sdk/android/instrumentationtests/src/org/webrtc/SurfaceTextureHelperTest.java index eec9eb2bd2..563336b984 100644 --- a/sdk/android/instrumentationtests/src/org/webrtc/SurfaceTextureHelperTest.java +++ b/sdk/android/instrumentationtests/src/org/webrtc/SurfaceTextureHelperTest.java @@ -48,6 +48,8 @@ public class SurfaceTextureHelperTest { } @Override + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void onTextureFrameAvailable( int oesTextureId, float[] transformMatrix, long timestampNs) { if (expectedThread != null && Thread.currentThread() != expectedThread) { @@ -62,6 +64,8 @@ public class SurfaceTextureHelperTest { /** * Wait indefinitely for a new frame. */ + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void waitForNewFrame() throws InterruptedException { while (!hasNewFrame) { wait(); @@ -73,6 +77,8 @@ public class SurfaceTextureHelperTest { * Wait for a new frame, or until the specified timeout elapses. Returns true if a new frame was * received before the timeout. */ + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized boolean waitForNewFrame(final long timeoutMs) throws InterruptedException { final long startTimeMs = SystemClock.elapsedRealtime(); long timeRemainingMs = timeoutMs; diff --git a/sdk/android/instrumentationtests/src/org/webrtc/SurfaceViewRendererOnMeasureTest.java b/sdk/android/instrumentationtests/src/org/webrtc/SurfaceViewRendererOnMeasureTest.java index 78e372a641..ca89d147f4 100644 --- a/sdk/android/instrumentationtests/src/org/webrtc/SurfaceViewRendererOnMeasureTest.java +++ b/sdk/android/instrumentationtests/src/org/webrtc/SurfaceViewRendererOnMeasureTest.java @@ -134,6 +134,8 @@ public class SurfaceViewRendererOnMeasureTest { private int frameHeight; private int rotation; + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void waitForFrameSize(int frameWidth, int frameHeight, int rotation) throws InterruptedException { while (this.frameWidth != frameWidth || this.frameHeight != frameHeight @@ -146,6 +148,8 @@ public class SurfaceViewRendererOnMeasureTest { public void onFirstFrameRendered() {} @Override + // TODO(bugs.webrtc.org/8491): Remove NoSynchronizedMethodCheck suppression. + @SuppressWarnings("NoSynchronizedMethodCheck") public synchronized void onFrameResolutionChanged( int frameWidth, int frameHeight, int rotation) { this.frameWidth = frameWidth;