Fix/suppress new warnings introduced in Chromium roll.
TBR=henrika@webrtc.org Bug: webrtc:6597 Change-Id: Id26945a7be05250673b58de8220f78bc62886688 Reviewed-on: https://webrtc-review.googlesource.com/16860 Commit-Queue: Sami Kalliomäki <sakal@webrtc.org> Reviewed-by: Magnus Jedvert <magjed@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20477}
This commit is contained in:
committed by
Commit Bot
parent
1d4c152a38
commit
bde473e4fa
@ -179,14 +179,11 @@ public class AppRTCAudioManager {
|
||||
// Create and initialize the proximity sensor.
|
||||
// Tablet devices (e.g. Nexus 7) does not support proximity sensors.
|
||||
// Note that, the sensor will not be active until start() has been called.
|
||||
proximitySensor = AppRTCProximitySensor.create(context, new Runnable() {
|
||||
// This method will be called each time a state change is detected.
|
||||
// Example: user holds his hand over the device (closer than ~5 cm),
|
||||
// or removes his hand from the device.
|
||||
public void run() {
|
||||
onProximitySensorChangedState();
|
||||
}
|
||||
});
|
||||
proximitySensor = AppRTCProximitySensor.create(context,
|
||||
// This method will be called each time a state change is detected.
|
||||
// Example: user holds his hand over the device (closer than ~5 cm),
|
||||
// or removes his hand from the device.
|
||||
this ::onProximitySensorChangedState);
|
||||
|
||||
Log.d(TAG, "defaultAudioDevice: " + defaultAudioDevice);
|
||||
AppRTCUtils.logDeviceInfo(TAG);
|
||||
|
||||
@ -47,7 +47,7 @@ public class CaptureQualityController implements SeekBar.OnSeekBarChangeListener
|
||||
int firstFps = calculateFramerate(targetBandwidth, first);
|
||||
int secondFps = calculateFramerate(targetBandwidth, second);
|
||||
|
||||
if (firstFps >= FRAMERATE_THRESHOLD && secondFps >= FRAMERATE_THRESHOLD
|
||||
if ((firstFps >= FRAMERATE_THRESHOLD && secondFps >= FRAMERATE_THRESHOLD)
|
||||
|| firstFps == secondFps) {
|
||||
// Compare resolution.
|
||||
return first.width * first.height - second.width * second.height;
|
||||
|
||||
@ -535,6 +535,7 @@ public class ConnectActivity extends Activity {
|
||||
.setCancelable(false)
|
||||
.setNeutralButton(R.string.ok,
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
dialog.cancel();
|
||||
}
|
||||
|
||||
@ -17,9 +17,13 @@ import android.os.BatteryManager;
|
||||
import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Arrays;
|
||||
import java.util.Scanner;
|
||||
import java.util.concurrent.Executors;
|
||||
@ -68,7 +72,6 @@ import java.util.concurrent.TimeUnit;
|
||||
* correct value, and then returns to back to correct reading. Both when
|
||||
* jumping up and back down we might create faulty CPU load readings.
|
||||
*/
|
||||
|
||||
class CpuMonitor {
|
||||
private static final String TAG = "CpuMonitor";
|
||||
private static final int MOVING_AVERAGE_SAMPLES = 5;
|
||||
@ -224,9 +227,10 @@ class CpuMonitor {
|
||||
}
|
||||
|
||||
private void init() {
|
||||
try (FileReader fin = new FileReader("/sys/devices/system/cpu/present")) {
|
||||
BufferedReader reader = new BufferedReader(fin);
|
||||
Scanner scanner = new Scanner(reader).useDelimiter("[-\n]");
|
||||
try (FileInputStream fin = new FileInputStream("/sys/devices/system/cpu/present");
|
||||
InputStreamReader streamReader = new InputStreamReader(fin, Charset.forName("UTF-8"));
|
||||
BufferedReader reader = new BufferedReader(streamReader);
|
||||
Scanner scanner = new Scanner(reader).useDelimiter("[-\n]");) {
|
||||
scanner.nextInt(); // Skip leading number 0.
|
||||
cpusPresent = 1 + scanner.nextInt();
|
||||
scanner.close();
|
||||
@ -432,7 +436,9 @@ class CpuMonitor {
|
||||
*/
|
||||
private long readFreqFromFile(String fileName) {
|
||||
long number = 0;
|
||||
try (BufferedReader reader = new BufferedReader(new FileReader(fileName))) {
|
||||
try (FileInputStream stream = new FileInputStream(fileName);
|
||||
InputStreamReader streamReader = new InputStreamReader(stream, Charset.forName("UTF-8"));
|
||||
BufferedReader reader = new BufferedReader(streamReader)) {
|
||||
String line = reader.readLine();
|
||||
number = parseLong(line);
|
||||
} catch (FileNotFoundException e) {
|
||||
@ -463,7 +469,9 @@ class CpuMonitor {
|
||||
long userTime = 0;
|
||||
long systemTime = 0;
|
||||
long idleTime = 0;
|
||||
try (BufferedReader reader = new BufferedReader(new FileReader("/proc/stat"))) {
|
||||
try (FileInputStream stream = new FileInputStream("/proc/stat");
|
||||
InputStreamReader streamReader = new InputStreamReader(stream, Charset.forName("UTF-8"));
|
||||
BufferedReader reader = new BufferedReader(streamReader)) {
|
||||
// line should contain something like this:
|
||||
// cpu 5093818 271838 3512830 165934119 101374 447076 272086 0 0 0
|
||||
// user nice system idle iowait irq softirq
|
||||
|
||||
@ -17,6 +17,7 @@ import android.util.Log;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
@ -1261,6 +1262,7 @@ public class PeerConnectionClient {
|
||||
return;
|
||||
|
||||
dc.registerObserver(new DataChannel.Observer() {
|
||||
@Override
|
||||
public void onBufferedAmountChange(long previousAmount) {
|
||||
Log.d(TAG, "Data channel buffered amount changed: " + dc.label() + ": " + dc.state());
|
||||
}
|
||||
@ -1279,7 +1281,7 @@ public class PeerConnectionClient {
|
||||
ByteBuffer data = buffer.data;
|
||||
final byte[] bytes = new byte[data.capacity()];
|
||||
data.get(bytes);
|
||||
String strData = new String(bytes);
|
||||
String strData = new String(bytes, Charset.forName("UTF-8"));
|
||||
Log.d(TAG, "Got msg: " + strData + " over " + dc);
|
||||
}
|
||||
});
|
||||
|
||||
@ -11,24 +11,24 @@
|
||||
package org.appspot.apprtc;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import org.webrtc.ThreadUtils;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.PrintWriter;
|
||||
import java.net.InetAddress;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.net.UnknownHostException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import org.webrtc.ThreadUtils;
|
||||
|
||||
/**
|
||||
* Replacement for WebSocketChannelClient for direct communication between two IP addresses. Handles
|
||||
* the signaling between the two clients using a TCP connection.
|
||||
*
|
||||
* <p>All public methods should be called from a looper executor thread
|
||||
* <p>
|
||||
* All public methods should be called from a looper executor thread
|
||||
* passed in a constructor, otherwise exception will be thrown.
|
||||
* All events are dispatched on the same thread.
|
||||
*/
|
||||
@ -56,8 +56,8 @@ public class TCPChannelClient {
|
||||
* that IP. If not, instead connects to the IP.
|
||||
*
|
||||
* @param eventListener Listener that will receive events from the client.
|
||||
* @param ip IP address to listen on or connect to.
|
||||
* @param port Port to listen on or connect to.
|
||||
* @param ip IP address to listen on or connect to.
|
||||
* @param port Port to listen on or connect to.
|
||||
*/
|
||||
public TCPChannelClient(
|
||||
ExecutorService executor, TCPChannelEvents eventListener, String ip, int port) {
|
||||
@ -132,6 +132,7 @@ public class TCPChannelClient {
|
||||
* @return Socket connection, null if connection failed.
|
||||
*/
|
||||
public abstract Socket connect();
|
||||
|
||||
/** Returns true if sockets is a server rawSocket. */
|
||||
public abstract boolean isServer();
|
||||
|
||||
@ -165,8 +166,10 @@ public class TCPChannelClient {
|
||||
}
|
||||
|
||||
try {
|
||||
out = new PrintWriter(rawSocket.getOutputStream(), true);
|
||||
in = new BufferedReader(new InputStreamReader(rawSocket.getInputStream()));
|
||||
out = new PrintWriter(
|
||||
new OutputStreamWriter(rawSocket.getOutputStream(), Charset.forName("UTF-8")), true);
|
||||
in = new BufferedReader(
|
||||
new InputStreamReader(rawSocket.getInputStream(), Charset.forName("UTF-8")));
|
||||
} catch (IOException e) {
|
||||
reportError("Failed to open IO on rawSocket: " + e.getMessage());
|
||||
return;
|
||||
@ -218,9 +221,7 @@ public class TCPChannelClient {
|
||||
disconnect();
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the rawSocket if it is still open. Also fires the onTCPClose event.
|
||||
*/
|
||||
/** Closes the rawSocket if it is still open. Also fires the onTCPClose event. */
|
||||
public void disconnect() {
|
||||
try {
|
||||
synchronized (rawSocketLock) {
|
||||
|
||||
@ -37,6 +37,7 @@ public class UnhandledExceptionHandler implements Thread.UncaughtExceptionHandle
|
||||
this.activity = activity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uncaughtException(Thread unusedThread, final Throwable e) {
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
|
||||
@ -50,12 +50,7 @@ public class AsyncHttpURLConnection {
|
||||
}
|
||||
|
||||
public void send() {
|
||||
Runnable runHttp = new Runnable() {
|
||||
public void run() {
|
||||
sendHttpMessage();
|
||||
}
|
||||
};
|
||||
new Thread(runHttp).start();
|
||||
new Thread(this ::sendHttpMessage).start();
|
||||
}
|
||||
|
||||
private void sendHttpMessage() {
|
||||
|
||||
@ -11,9 +11,9 @@
|
||||
package org.appspot.apprtc;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.doCallRealMethod;
|
||||
import static org.mockito.Mockito.mock;
|
||||
@ -119,7 +119,7 @@ public class BluetoothManagerTest {
|
||||
protected boolean hasPermission(Context context, String permission) {
|
||||
Log.d(TAG, "hasPermission(" + permission + ")");
|
||||
// Ensure that the client asks for Bluetooth permission.
|
||||
return (permission == android.Manifest.permission.BLUETOOTH);
|
||||
return android.Manifest.permission.BLUETOOTH.equals(permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -113,6 +113,7 @@ public class WebRtcAudioManager {
|
||||
this.maxVoiceCallVolume = maxVoiceCallVolume;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
final int mode = audioManager.getMode();
|
||||
if (mode == AudioManager.MODE_RINGTONE) {
|
||||
|
||||
@ -15,6 +15,7 @@ import android.os.SystemClock;
|
||||
import java.io.IOException;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@ -90,6 +91,7 @@ public class FileVideoCapturer implements VideoCapturer {
|
||||
Logging.d(TAG, "frame dim: (" + w + ", " + h + ")");
|
||||
}
|
||||
|
||||
@Override
|
||||
public VideoFrame getNextFrame() {
|
||||
final long captureTimeNs = TimeUnit.MILLISECONDS.toNanos(SystemClock.elapsedRealtime());
|
||||
final JavaI420Buffer buffer = JavaI420Buffer.allocate(frameWidth, frameHeight);
|
||||
@ -110,7 +112,7 @@ public class FileVideoCapturer implements VideoCapturer {
|
||||
throw new RuntimeException("Error looping video");
|
||||
}
|
||||
}
|
||||
String frameDelimStr = new String(frameDelim);
|
||||
String frameDelimStr = new String(frameDelim, Charset.forName("US-ASCII"));
|
||||
if (!frameDelimStr.equals(Y4M_FRAME_DELIMETER + "\n")) {
|
||||
throw new RuntimeException(
|
||||
"Frames should be delimited by FRAME plus newline, found delimter was: '"
|
||||
@ -127,6 +129,7 @@ public class FileVideoCapturer implements VideoCapturer {
|
||||
return new VideoFrame(buffer, 0 /* rotation */, captureTimeNs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
try {
|
||||
mediaFileStream.close();
|
||||
|
||||
@ -35,6 +35,7 @@ public class IceCandidate {
|
||||
this.serverUrl = serverUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return sdpMid + ":" + sdpMLineIndex + ":" + sdp + ":" + serverUrl;
|
||||
}
|
||||
|
||||
@ -36,6 +36,7 @@ public class MediaConstraints {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return key + ": " + value;
|
||||
}
|
||||
@ -77,6 +78,7 @@ public class MediaConstraints {
|
||||
return builder.append("]").toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "mandatory: " + stringifyKeyValuePairList(mandatory) + ", optional: "
|
||||
+ stringifyKeyValuePairList(optional);
|
||||
|
||||
@ -88,6 +88,7 @@ public class MediaStream {
|
||||
return nativeLabel(nativeStream);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[" + label() + ":A=" + audioTracks.size() + ":V=" + videoTracks.size() + "]";
|
||||
}
|
||||
|
||||
@ -171,6 +171,7 @@ public class PeerConnection {
|
||||
this.tlsEllipticCurves = tlsEllipticCurves;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return urls + " [" + username + ":" + password + "] [" + tlsCertPolicy + "] [" + hostname
|
||||
+ "] [" + tlsAlpnProtocols + "] [" + tlsEllipticCurves + "]";
|
||||
|
||||
@ -67,6 +67,7 @@ public class RTCStats {
|
||||
return members;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("{ timestampUs: ")
|
||||
|
||||
@ -37,6 +37,7 @@ public class RTCStatsReport {
|
||||
return stats;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("{ timestampUs: ").append(timestampUs).append(", stats: [\n");
|
||||
|
||||
@ -22,6 +22,7 @@ public class StatsReport {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("[").append(name).append(": ").append(value).append("]");
|
||||
@ -42,6 +43,7 @@ public class StatsReport {
|
||||
this.values = values;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("id: ")
|
||||
|
||||
@ -15,6 +15,7 @@ import android.os.HandlerThread;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
@ -57,7 +58,7 @@ public class VideoFileRenderer implements VideoRenderer.Callbacks {
|
||||
videoOutFile = new FileOutputStream(outputFile);
|
||||
videoOutFile.write(
|
||||
("YUV4MPEG2 C420 W" + outputFileWidth + " H" + outputFileHeight + " Ip F30:1 A1:1\n")
|
||||
.getBytes());
|
||||
.getBytes(Charset.forName("US-ASCII")));
|
||||
|
||||
renderThread = new HandlerThread(TAG);
|
||||
renderThread.start();
|
||||
@ -149,7 +150,7 @@ public class VideoFileRenderer implements VideoRenderer.Callbacks {
|
||||
ThreadUtils.awaitUninterruptibly(cleanupBarrier);
|
||||
try {
|
||||
for (ByteBuffer buffer : rawFrames) {
|
||||
videoOutFile.write("FRAME\n".getBytes());
|
||||
videoOutFile.write("FRAME\n".getBytes(Charset.forName("US-ASCII")));
|
||||
|
||||
byte[] data = new byte[outputFrameSize];
|
||||
buffer.get(data);
|
||||
|
||||
@ -62,6 +62,7 @@ public class VideoTrack extends MediaStreamTrack {
|
||||
renderer.dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
while (!renderers.isEmpty()) {
|
||||
removeRenderer(renderers.getFirst());
|
||||
|
||||
@ -64,7 +64,7 @@ public class EglRendererTest {
|
||||
private final static ByteBuffer[][] TEST_FRAMES =
|
||||
copyTestDataToDirectByteBuffers(TEST_FRAMES_DATA);
|
||||
|
||||
private class TestFrameListener implements EglRenderer.FrameListener {
|
||||
private static class TestFrameListener implements EglRenderer.FrameListener {
|
||||
final private ArrayList<Bitmap> bitmaps = new ArrayList<Bitmap>();
|
||||
boolean bitmapReceived;
|
||||
Bitmap storedBitmap;
|
||||
|
||||
@ -26,7 +26,7 @@ import org.junit.runner.RunWith;
|
||||
|
||||
@RunWith(BaseJUnit4ClassRunner.class)
|
||||
public class FileVideoCapturerTest {
|
||||
public class MockCapturerObserver implements VideoCapturer.CapturerObserver {
|
||||
public static class MockCapturerObserver implements VideoCapturer.CapturerObserver {
|
||||
private final ArrayList<VideoFrame> frames = new ArrayList<VideoFrame>();
|
||||
|
||||
@Override
|
||||
|
||||
@ -83,6 +83,7 @@ public class HardwareVideoEncoderTest {
|
||||
static class MockEncoderCallback implements VideoEncoder.Callback {
|
||||
private BlockingQueue<EncodedImage> frameQueue = new LinkedBlockingQueue<>();
|
||||
|
||||
@Override
|
||||
public void onEncodedFrame(EncodedImage frame, VideoEncoder.CodecSpecificInfo info) {
|
||||
assertNotNull(frame);
|
||||
assertNotNull(info);
|
||||
@ -247,6 +248,7 @@ public class HardwareVideoEncoderTest {
|
||||
private int referencedFrames = 0;
|
||||
|
||||
private Runnable releaseFrameCallback = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
synchronized (referencedFramesLock) {
|
||||
--referencedFrames;
|
||||
|
||||
@ -142,8 +142,10 @@ public class SurfaceViewRendererOnMeasureTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFirstFrameRendered() {}
|
||||
|
||||
@Override
|
||||
public synchronized void onFrameResolutionChanged(
|
||||
int frameWidth, int frameHeight, int rotation) {
|
||||
this.frameWidth = frameWidth;
|
||||
|
||||
@ -293,7 +293,7 @@ class Camera2Session implements CameraSession {
|
||||
}
|
||||
}
|
||||
|
||||
private class CameraCaptureCallback extends CameraCaptureSession.CaptureCallback {
|
||||
private static class CameraCaptureCallback extends CameraCaptureSession.CaptureCallback {
|
||||
@Override
|
||||
public void onCaptureFailed(
|
||||
CameraCaptureSession session, CaptureRequest request, CaptureFailure failure) {
|
||||
|
||||
@ -24,6 +24,7 @@ import android.view.Surface;
|
||||
* Holds EGL state and utility methods for handling an EGL14 EGLContext, an EGLDisplay,
|
||||
* and an EGLSurface.
|
||||
*/
|
||||
@SuppressWarnings("ReferenceEquality") // We want to compare to EGL14 constants.
|
||||
@TargetApi(18)
|
||||
class EglBase14 extends EglBase {
|
||||
private static final String TAG = "EglBase14";
|
||||
|
||||
Reference in New Issue
Block a user