Fix some Android lint warnings in AppRTCMobile.
Bug: webrtc:6597 Change-Id: I73e304ff03a5fcb166ff7bca61319904ef495426 Reviewed-on: https://webrtc-review.googlesource.com/15322 Reviewed-by: Magnus Jedvert <magjed@webrtc.org> Commit-Queue: Sami Kalliomäki <sakal@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20439}
This commit is contained in:
committed by
Commit Bot
parent
68e56a5951
commit
2729c16143
@ -28,7 +28,6 @@ import org.webrtc.ThreadUtils;
|
|||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -54,7 +53,7 @@ public class AppRTCAudioManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Selected audio device change event. */
|
/** Selected audio device change event. */
|
||||||
public static interface AudioManagerEvents {
|
public interface AudioManagerEvents {
|
||||||
// Callback fired once audio device is changed or list of available audio devices changed.
|
// Callback fired once audio device is changed or list of available audio devices changed.
|
||||||
void onAudioDeviceChanged(
|
void onAudioDeviceChanged(
|
||||||
AudioDevice selectedAudioDevice, Set<AudioDevice> availableAudioDevices);
|
AudioDevice selectedAudioDevice, Set<AudioDevice> availableAudioDevices);
|
||||||
@ -101,7 +100,7 @@ public class AppRTCAudioManager {
|
|||||||
|
|
||||||
// Contains a list of available audio devices. A Set collection is used to
|
// Contains a list of available audio devices. A Set collection is used to
|
||||||
// avoid duplicate elements.
|
// avoid duplicate elements.
|
||||||
private Set<AudioDevice> audioDevices = new HashSet<AudioDevice>();
|
private Set<AudioDevice> audioDevices = new HashSet<>();
|
||||||
|
|
||||||
// Broadcast receiver for wired headset intent broadcasts.
|
// Broadcast receiver for wired headset intent broadcasts.
|
||||||
private BroadcastReceiver wiredHeadsetReceiver;
|
private BroadcastReceiver wiredHeadsetReceiver;
|
||||||
@ -154,7 +153,7 @@ public class AppRTCAudioManager {
|
|||||||
hasWiredHeadset = (state == STATE_PLUGGED);
|
hasWiredHeadset = (state == STATE_PLUGGED);
|
||||||
updateAudioDeviceState();
|
updateAudioDeviceState();
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
/** Construction. */
|
/** Construction. */
|
||||||
static AppRTCAudioManager create(Context context) {
|
static AppRTCAudioManager create(Context context) {
|
||||||
@ -225,7 +224,7 @@ public class AppRTCAudioManager {
|
|||||||
// logging for now.
|
// logging for now.
|
||||||
@Override
|
@Override
|
||||||
public void onAudioFocusChange(int focusChange) {
|
public void onAudioFocusChange(int focusChange) {
|
||||||
String typeOfChange = "AUDIOFOCUS_NOT_DEFINED";
|
final String typeOfChange;
|
||||||
switch (focusChange) {
|
switch (focusChange) {
|
||||||
case AudioManager.AUDIOFOCUS_GAIN:
|
case AudioManager.AUDIOFOCUS_GAIN:
|
||||||
typeOfChange = "AUDIOFOCUS_GAIN";
|
typeOfChange = "AUDIOFOCUS_GAIN";
|
||||||
@ -388,7 +387,7 @@ public class AppRTCAudioManager {
|
|||||||
/** Returns current set of available/selectable audio devices. */
|
/** Returns current set of available/selectable audio devices. */
|
||||||
public Set<AudioDevice> getAudioDevices() {
|
public Set<AudioDevice> getAudioDevices() {
|
||||||
ThreadUtils.checkIsOnMainThread();
|
ThreadUtils.checkIsOnMainThread();
|
||||||
return Collections.unmodifiableSet(new HashSet<AudioDevice>(audioDevices));
|
return Collections.unmodifiableSet(new HashSet<>(audioDevices));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the currently selected audio device. */
|
/** Returns the currently selected audio device. */
|
||||||
@ -560,7 +559,7 @@ public class AppRTCAudioManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update selected audio device.
|
// Update selected audio device.
|
||||||
AudioDevice newAudioDevice = selectedAudioDevice;
|
final AudioDevice newAudioDevice;
|
||||||
|
|
||||||
if (bluetoothManager.getState() == AppRTCBluetoothManager.State.SCO_CONNECTED) {
|
if (bluetoothManager.getState() == AppRTCBluetoothManager.State.SCO_CONNECTED) {
|
||||||
// If a Bluetooth is connected, then it should be used as output audio
|
// If a Bluetooth is connected, then it should be used as output audio
|
||||||
|
|||||||
@ -187,7 +187,7 @@ public class AppRTCBluetoothManager {
|
|||||||
}
|
}
|
||||||
Log.d(TAG, "onReceive done: BT state=" + bluetoothState);
|
Log.d(TAG, "onReceive done: BT state=" + bluetoothState);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
/** Construction. */
|
/** Construction. */
|
||||||
static AppRTCBluetoothManager create(Context context, AppRTCAudioManager audioManager) {
|
static AppRTCBluetoothManager create(Context context, AppRTCAudioManager audioManager) {
|
||||||
|
|||||||
@ -185,11 +185,9 @@ public class CallActivity extends Activity implements AppRTCClient.SignalingEven
|
|||||||
private SurfaceViewRenderer pipRenderer;
|
private SurfaceViewRenderer pipRenderer;
|
||||||
private SurfaceViewRenderer fullscreenRenderer;
|
private SurfaceViewRenderer fullscreenRenderer;
|
||||||
private VideoFileRenderer videoFileRenderer;
|
private VideoFileRenderer videoFileRenderer;
|
||||||
private final List<VideoRenderer.Callbacks> remoteRenderers =
|
private final List<VideoRenderer.Callbacks> remoteRenderers = new ArrayList<>();
|
||||||
new ArrayList<VideoRenderer.Callbacks>();
|
|
||||||
private Toast logToast;
|
private Toast logToast;
|
||||||
private boolean commandLineRun;
|
private boolean commandLineRun;
|
||||||
private int runTimeMs;
|
|
||||||
private boolean activityRunning;
|
private boolean activityRunning;
|
||||||
private RoomConnectionParameters roomConnectionParameters;
|
private RoomConnectionParameters roomConnectionParameters;
|
||||||
private PeerConnectionParameters peerConnectionParameters;
|
private PeerConnectionParameters peerConnectionParameters;
|
||||||
@ -226,8 +224,8 @@ public class CallActivity extends Activity implements AppRTCClient.SignalingEven
|
|||||||
signalingParameters = null;
|
signalingParameters = null;
|
||||||
|
|
||||||
// Create UI controls.
|
// Create UI controls.
|
||||||
pipRenderer = (SurfaceViewRenderer) findViewById(R.id.pip_video_view);
|
pipRenderer = findViewById(R.id.pip_video_view);
|
||||||
fullscreenRenderer = (SurfaceViewRenderer) findViewById(R.id.fullscreen_video_view);
|
fullscreenRenderer = findViewById(R.id.fullscreen_video_view);
|
||||||
callFragment = new CallFragment();
|
callFragment = new CallFragment();
|
||||||
hudFragment = new HudFragment();
|
hudFragment = new HudFragment();
|
||||||
|
|
||||||
@ -348,7 +346,7 @@ public class CallActivity extends Activity implements AppRTCClient.SignalingEven
|
|||||||
intent.getBooleanExtra(EXTRA_ENABLE_LEVEL_CONTROL, false),
|
intent.getBooleanExtra(EXTRA_ENABLE_LEVEL_CONTROL, false),
|
||||||
intent.getBooleanExtra(EXTRA_DISABLE_WEBRTC_AGC_AND_HPF, false), dataChannelParameters);
|
intent.getBooleanExtra(EXTRA_DISABLE_WEBRTC_AGC_AND_HPF, false), dataChannelParameters);
|
||||||
commandLineRun = intent.getBooleanExtra(EXTRA_CMDLINE, false);
|
commandLineRun = intent.getBooleanExtra(EXTRA_CMDLINE, false);
|
||||||
runTimeMs = intent.getIntExtra(EXTRA_RUNTIME, 0);
|
int runTimeMs = intent.getIntExtra(EXTRA_RUNTIME, 0);
|
||||||
|
|
||||||
Log.d(TAG, "VIDEO_FILE: '" + intent.getStringExtra(EXTRA_VIDEO_FILE_AS_CAMERA) + "'");
|
Log.d(TAG, "VIDEO_FILE: '" + intent.getStringExtra(EXTRA_VIDEO_FILE_AS_CAMERA) + "'");
|
||||||
|
|
||||||
@ -714,7 +712,7 @@ public class CallActivity extends Activity implements AppRTCClient.SignalingEven
|
|||||||
}
|
}
|
||||||
|
|
||||||
private VideoCapturer createVideoCapturer() {
|
private VideoCapturer createVideoCapturer() {
|
||||||
VideoCapturer videoCapturer = null;
|
final VideoCapturer videoCapturer;
|
||||||
String videoFileAsCamera = getIntent().getStringExtra(EXTRA_VIDEO_FILE_AS_CAMERA);
|
String videoFileAsCamera = getIntent().getStringExtra(EXTRA_VIDEO_FILE_AS_CAMERA);
|
||||||
if (videoFileAsCamera != null) {
|
if (videoFileAsCamera != null) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -26,9 +26,7 @@ import org.webrtc.RendererCommon.ScalingType;
|
|||||||
* Fragment for call control.
|
* Fragment for call control.
|
||||||
*/
|
*/
|
||||||
public class CallFragment extends Fragment {
|
public class CallFragment extends Fragment {
|
||||||
private View controlView;
|
|
||||||
private TextView contactView;
|
private TextView contactView;
|
||||||
private ImageButton disconnectButton;
|
|
||||||
private ImageButton cameraSwitchButton;
|
private ImageButton cameraSwitchButton;
|
||||||
private ImageButton videoScalingButton;
|
private ImageButton videoScalingButton;
|
||||||
private ImageButton toggleMuteButton;
|
private ImageButton toggleMuteButton;
|
||||||
@ -52,16 +50,16 @@ public class CallFragment extends Fragment {
|
|||||||
@Override
|
@Override
|
||||||
public View onCreateView(
|
public View onCreateView(
|
||||||
LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
controlView = inflater.inflate(R.layout.fragment_call, container, false);
|
View controlView = inflater.inflate(R.layout.fragment_call, container, false);
|
||||||
|
|
||||||
// Create UI controls.
|
// Create UI controls.
|
||||||
contactView = (TextView) controlView.findViewById(R.id.contact_name_call);
|
contactView = controlView.findViewById(R.id.contact_name_call);
|
||||||
disconnectButton = (ImageButton) controlView.findViewById(R.id.button_call_disconnect);
|
ImageButton disconnectButton = controlView.findViewById(R.id.button_call_disconnect);
|
||||||
cameraSwitchButton = (ImageButton) controlView.findViewById(R.id.button_call_switch_camera);
|
cameraSwitchButton = controlView.findViewById(R.id.button_call_switch_camera);
|
||||||
videoScalingButton = (ImageButton) controlView.findViewById(R.id.button_call_scaling_mode);
|
videoScalingButton = controlView.findViewById(R.id.button_call_scaling_mode);
|
||||||
toggleMuteButton = (ImageButton) controlView.findViewById(R.id.button_call_toggle_mic);
|
toggleMuteButton = controlView.findViewById(R.id.button_call_toggle_mic);
|
||||||
captureFormatText = (TextView) controlView.findViewById(R.id.capture_format_text_call);
|
captureFormatText = controlView.findViewById(R.id.capture_format_text_call);
|
||||||
captureFormatSlider = (SeekBar) controlView.findViewById(R.id.capture_format_slider_call);
|
captureFormatSlider = controlView.findViewById(R.id.capture_format_slider_call);
|
||||||
|
|
||||||
// Add buttons click events.
|
// Add buttons click events.
|
||||||
disconnectButton.setOnClickListener(new View.OnClickListener() {
|
disconnectButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
|||||||
@ -47,48 +47,21 @@ public class ConnectActivity extends Activity {
|
|||||||
private static final int REMOVE_FAVORITE_INDEX = 0;
|
private static final int REMOVE_FAVORITE_INDEX = 0;
|
||||||
private static boolean commandLineRun = false;
|
private static boolean commandLineRun = false;
|
||||||
|
|
||||||
private ImageButton connectButton;
|
|
||||||
private ImageButton addFavoriteButton;
|
private ImageButton addFavoriteButton;
|
||||||
private EditText roomEditText;
|
private EditText roomEditText;
|
||||||
private ListView roomListView;
|
private ListView roomListView;
|
||||||
private SharedPreferences sharedPref;
|
private SharedPreferences sharedPref;
|
||||||
private String keyprefVideoCallEnabled;
|
|
||||||
private String keyprefScreencapture;
|
|
||||||
private String keyprefCamera2;
|
|
||||||
private String keyprefResolution;
|
private String keyprefResolution;
|
||||||
private String keyprefFps;
|
private String keyprefFps;
|
||||||
private String keyprefCaptureQualitySlider;
|
|
||||||
private String keyprefVideoBitrateType;
|
private String keyprefVideoBitrateType;
|
||||||
private String keyprefVideoBitrateValue;
|
private String keyprefVideoBitrateValue;
|
||||||
private String keyprefVideoCodec;
|
|
||||||
private String keyprefAudioBitrateType;
|
private String keyprefAudioBitrateType;
|
||||||
private String keyprefAudioBitrateValue;
|
private String keyprefAudioBitrateValue;
|
||||||
private String keyprefAudioCodec;
|
|
||||||
private String keyprefHwCodecAcceleration;
|
|
||||||
private String keyprefCaptureToTexture;
|
|
||||||
private String keyprefFlexfec;
|
|
||||||
private String keyprefNoAudioProcessingPipeline;
|
|
||||||
private String keyprefAecDump;
|
|
||||||
private String keyprefOpenSLES;
|
|
||||||
private String keyprefDisableBuiltInAec;
|
|
||||||
private String keyprefDisableBuiltInAgc;
|
|
||||||
private String keyprefDisableBuiltInNs;
|
|
||||||
private String keyprefEnableLevelControl;
|
|
||||||
private String keyprefDisableWebRtcAGCAndHPF;
|
|
||||||
private String keyprefDisplayHud;
|
|
||||||
private String keyprefTracing;
|
|
||||||
private String keyprefRoomServerUrl;
|
private String keyprefRoomServerUrl;
|
||||||
private String keyprefRoom;
|
private String keyprefRoom;
|
||||||
private String keyprefRoomList;
|
private String keyprefRoomList;
|
||||||
private ArrayList<String> roomList;
|
private ArrayList<String> roomList;
|
||||||
private ArrayAdapter<String> adapter;
|
private ArrayAdapter<String> adapter;
|
||||||
private String keyprefEnableDataChannel;
|
|
||||||
private String keyprefOrdered;
|
|
||||||
private String keyprefMaxRetransmitTimeMs;
|
|
||||||
private String keyprefMaxRetransmits;
|
|
||||||
private String keyprefDataProtocol;
|
|
||||||
private String keyprefNegotiated;
|
|
||||||
private String keyprefDataId;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
@ -97,45 +70,19 @@ public class ConnectActivity extends Activity {
|
|||||||
// Get setting keys.
|
// Get setting keys.
|
||||||
PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
|
PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
|
||||||
sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
|
sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
keyprefVideoCallEnabled = getString(R.string.pref_videocall_key);
|
|
||||||
keyprefScreencapture = getString(R.string.pref_screencapture_key);
|
|
||||||
keyprefCamera2 = getString(R.string.pref_camera2_key);
|
|
||||||
keyprefResolution = getString(R.string.pref_resolution_key);
|
keyprefResolution = getString(R.string.pref_resolution_key);
|
||||||
keyprefFps = getString(R.string.pref_fps_key);
|
keyprefFps = getString(R.string.pref_fps_key);
|
||||||
keyprefCaptureQualitySlider = getString(R.string.pref_capturequalityslider_key);
|
|
||||||
keyprefVideoBitrateType = getString(R.string.pref_maxvideobitrate_key);
|
keyprefVideoBitrateType = getString(R.string.pref_maxvideobitrate_key);
|
||||||
keyprefVideoBitrateValue = getString(R.string.pref_maxvideobitratevalue_key);
|
keyprefVideoBitrateValue = getString(R.string.pref_maxvideobitratevalue_key);
|
||||||
keyprefVideoCodec = getString(R.string.pref_videocodec_key);
|
|
||||||
keyprefHwCodecAcceleration = getString(R.string.pref_hwcodec_key);
|
|
||||||
keyprefCaptureToTexture = getString(R.string.pref_capturetotexture_key);
|
|
||||||
keyprefFlexfec = getString(R.string.pref_flexfec_key);
|
|
||||||
keyprefAudioBitrateType = getString(R.string.pref_startaudiobitrate_key);
|
keyprefAudioBitrateType = getString(R.string.pref_startaudiobitrate_key);
|
||||||
keyprefAudioBitrateValue = getString(R.string.pref_startaudiobitratevalue_key);
|
keyprefAudioBitrateValue = getString(R.string.pref_startaudiobitratevalue_key);
|
||||||
keyprefAudioCodec = getString(R.string.pref_audiocodec_key);
|
|
||||||
keyprefNoAudioProcessingPipeline = getString(R.string.pref_noaudioprocessing_key);
|
|
||||||
keyprefAecDump = getString(R.string.pref_aecdump_key);
|
|
||||||
keyprefOpenSLES = getString(R.string.pref_opensles_key);
|
|
||||||
keyprefDisableBuiltInAec = getString(R.string.pref_disable_built_in_aec_key);
|
|
||||||
keyprefDisableBuiltInAgc = getString(R.string.pref_disable_built_in_agc_key);
|
|
||||||
keyprefDisableBuiltInNs = getString(R.string.pref_disable_built_in_ns_key);
|
|
||||||
keyprefEnableLevelControl = getString(R.string.pref_enable_level_control_key);
|
|
||||||
keyprefDisableWebRtcAGCAndHPF = getString(R.string.pref_disable_webrtc_agc_and_hpf_key);
|
|
||||||
keyprefDisplayHud = getString(R.string.pref_displayhud_key);
|
|
||||||
keyprefTracing = getString(R.string.pref_tracing_key);
|
|
||||||
keyprefRoomServerUrl = getString(R.string.pref_room_server_url_key);
|
keyprefRoomServerUrl = getString(R.string.pref_room_server_url_key);
|
||||||
keyprefRoom = getString(R.string.pref_room_key);
|
keyprefRoom = getString(R.string.pref_room_key);
|
||||||
keyprefRoomList = getString(R.string.pref_room_list_key);
|
keyprefRoomList = getString(R.string.pref_room_list_key);
|
||||||
keyprefEnableDataChannel = getString(R.string.pref_enable_datachannel_key);
|
|
||||||
keyprefOrdered = getString(R.string.pref_ordered_key);
|
|
||||||
keyprefMaxRetransmitTimeMs = getString(R.string.pref_max_retransmit_time_ms_key);
|
|
||||||
keyprefMaxRetransmits = getString(R.string.pref_max_retransmits_key);
|
|
||||||
keyprefDataProtocol = getString(R.string.pref_data_protocol_key);
|
|
||||||
keyprefNegotiated = getString(R.string.pref_negotiated_key);
|
|
||||||
keyprefDataId = getString(R.string.pref_data_id_key);
|
|
||||||
|
|
||||||
setContentView(R.layout.activity_connect);
|
setContentView(R.layout.activity_connect);
|
||||||
|
|
||||||
roomEditText = (EditText) findViewById(R.id.room_edittext);
|
roomEditText = findViewById(R.id.room_edittext);
|
||||||
roomEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
roomEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
|
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
|
||||||
@ -148,13 +95,13 @@ public class ConnectActivity extends Activity {
|
|||||||
});
|
});
|
||||||
roomEditText.requestFocus();
|
roomEditText.requestFocus();
|
||||||
|
|
||||||
roomListView = (ListView) findViewById(R.id.room_listview);
|
roomListView = findViewById(R.id.room_listview);
|
||||||
roomListView.setEmptyView(findViewById(android.R.id.empty));
|
roomListView.setEmptyView(findViewById(android.R.id.empty));
|
||||||
roomListView.setOnItemClickListener(roomListClickListener);
|
roomListView.setOnItemClickListener(roomListClickListener);
|
||||||
registerForContextMenu(roomListView);
|
registerForContextMenu(roomListView);
|
||||||
connectButton = (ImageButton) findViewById(R.id.connect_button);
|
ImageButton connectButton = findViewById(R.id.connect_button);
|
||||||
connectButton.setOnClickListener(connectListener);
|
connectButton.setOnClickListener(connectListener);
|
||||||
addFavoriteButton = (ImageButton) findViewById(R.id.add_favorite_button);
|
addFavoriteButton = findViewById(R.id.add_favorite_button);
|
||||||
addFavoriteButton.setOnClickListener(addFavoriteListener);
|
addFavoriteButton.setOnClickListener(addFavoriteListener);
|
||||||
|
|
||||||
// If an implicit VIEW intent is launching the app, go directly to that URL.
|
// If an implicit VIEW intent is launching the app, go directly to that URL.
|
||||||
@ -233,7 +180,7 @@ public class ConnectActivity extends Activity {
|
|||||||
super.onResume();
|
super.onResume();
|
||||||
String room = sharedPref.getString(keyprefRoom, "");
|
String room = sharedPref.getString(keyprefRoom, "");
|
||||||
roomEditText.setText(room);
|
roomEditText.setText(room);
|
||||||
roomList = new ArrayList<String>();
|
roomList = new ArrayList<>();
|
||||||
String roomListJson = sharedPref.getString(keyprefRoomList, null);
|
String roomListJson = sharedPref.getString(keyprefRoomList, null);
|
||||||
if (roomListJson != null) {
|
if (roomListJson != null) {
|
||||||
try {
|
try {
|
||||||
@ -245,7 +192,7 @@ public class ConnectActivity extends Activity {
|
|||||||
Log.e(TAG, "Failed to load room list: " + e.toString());
|
Log.e(TAG, "Failed to load room list: " + e.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, roomList);
|
adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, roomList);
|
||||||
roomListView.setAdapter(adapter);
|
roomListView.setAdapter(adapter);
|
||||||
if (adapter.getCount() > 0) {
|
if (adapter.getCount() > 0) {
|
||||||
roomListView.requestFocus();
|
roomListView.requestFocus();
|
||||||
@ -321,7 +268,7 @@ public class ConnectActivity extends Activity {
|
|||||||
|
|
||||||
private void connectToRoom(String roomId, boolean commandLineRun, boolean loopback,
|
private void connectToRoom(String roomId, boolean commandLineRun, boolean loopback,
|
||||||
boolean useValuesFromIntent, int runTimeMs) {
|
boolean useValuesFromIntent, int runTimeMs) {
|
||||||
this.commandLineRun = commandLineRun;
|
ConnectActivity.commandLineRun = commandLineRun;
|
||||||
|
|
||||||
// roomId is random for loopback.
|
// roomId is random for loopback.
|
||||||
if (loopback) {
|
if (loopback) {
|
||||||
|
|||||||
@ -224,23 +224,18 @@ class CpuMonitor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void init() {
|
private void init() {
|
||||||
try {
|
try (FileReader fin = new FileReader("/sys/devices/system/cpu/present")) {
|
||||||
FileReader fin = new FileReader("/sys/devices/system/cpu/present");
|
BufferedReader reader = new BufferedReader(fin);
|
||||||
try {
|
Scanner scanner = new Scanner(reader).useDelimiter("[-\n]");
|
||||||
BufferedReader reader = new BufferedReader(fin);
|
scanner.nextInt(); // Skip leading number 0.
|
||||||
Scanner scanner = new Scanner(reader).useDelimiter("[-\n]");
|
cpusPresent = 1 + scanner.nextInt();
|
||||||
scanner.nextInt(); // Skip leading number 0.
|
scanner.close();
|
||||||
cpusPresent = 1 + scanner.nextInt();
|
|
||||||
scanner.close();
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e(TAG, "Cannot do CPU stats due to /sys/devices/system/cpu/present parsing problem");
|
|
||||||
} finally {
|
|
||||||
fin.close();
|
|
||||||
}
|
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
Log.e(TAG, "Cannot do CPU stats since /sys/devices/system/cpu/present is missing");
|
Log.e(TAG, "Cannot do CPU stats since /sys/devices/system/cpu/present is missing");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e(TAG, "Error closing file");
|
Log.e(TAG, "Error closing file");
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e(TAG, "Cannot do CPU stats due to /sys/devices/system/cpu/present parsing problem");
|
||||||
}
|
}
|
||||||
|
|
||||||
cpuFreqMax = new long[cpusPresent];
|
cpuFreqMax = new long[cpusPresent];
|
||||||
@ -437,14 +432,9 @@ class CpuMonitor {
|
|||||||
*/
|
*/
|
||||||
private long readFreqFromFile(String fileName) {
|
private long readFreqFromFile(String fileName) {
|
||||||
long number = 0;
|
long number = 0;
|
||||||
try {
|
try (BufferedReader reader = new BufferedReader(new FileReader(fileName))) {
|
||||||
BufferedReader reader = new BufferedReader(new FileReader(fileName));
|
String line = reader.readLine();
|
||||||
try {
|
number = parseLong(line);
|
||||||
String line = reader.readLine();
|
|
||||||
number = parseLong(line);
|
|
||||||
} finally {
|
|
||||||
reader.close();
|
|
||||||
}
|
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
// CPU core is off, so file with its scaling frequency .../cpufreq/scaling_cur_freq
|
// CPU core is off, so file with its scaling frequency .../cpufreq/scaling_cur_freq
|
||||||
// is not present. This is not an error.
|
// is not present. This is not an error.
|
||||||
@ -473,37 +463,29 @@ class CpuMonitor {
|
|||||||
long userTime = 0;
|
long userTime = 0;
|
||||||
long systemTime = 0;
|
long systemTime = 0;
|
||||||
long idleTime = 0;
|
long idleTime = 0;
|
||||||
try {
|
try (BufferedReader reader = new BufferedReader(new FileReader("/proc/stat"))) {
|
||||||
BufferedReader reader = new BufferedReader(new FileReader("/proc/stat"));
|
// line should contain something like this:
|
||||||
try {
|
// cpu 5093818 271838 3512830 165934119 101374 447076 272086 0 0 0
|
||||||
// line should contain something like this:
|
// user nice system idle iowait irq softirq
|
||||||
// cpu 5093818 271838 3512830 165934119 101374 447076 272086 0 0 0
|
String line = reader.readLine();
|
||||||
// user nice system idle iowait irq softirq
|
String[] lines = line.split("\\s+");
|
||||||
String line = reader.readLine();
|
int length = lines.length;
|
||||||
String[] lines = line.split("\\s+");
|
if (length >= 5) {
|
||||||
int length = lines.length;
|
userTime = parseLong(lines[1]); // user
|
||||||
if (length >= 5) {
|
userTime += parseLong(lines[2]); // nice
|
||||||
userTime = parseLong(lines[1]); // user
|
systemTime = parseLong(lines[3]); // system
|
||||||
userTime += parseLong(lines[2]); // nice
|
idleTime = parseLong(lines[4]); // idle
|
||||||
systemTime = parseLong(lines[3]); // system
|
}
|
||||||
idleTime = parseLong(lines[4]); // idle
|
if (length >= 8) {
|
||||||
}
|
userTime += parseLong(lines[5]); // iowait
|
||||||
if (length >= 8) {
|
systemTime += parseLong(lines[6]); // irq
|
||||||
userTime += parseLong(lines[5]); // iowait
|
systemTime += parseLong(lines[7]); // softirq
|
||||||
systemTime += parseLong(lines[6]); // irq
|
|
||||||
systemTime += parseLong(lines[7]); // softirq
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e(TAG, "Problems parsing /proc/stat", e);
|
|
||||||
return null;
|
|
||||||
} finally {
|
|
||||||
reader.close();
|
|
||||||
}
|
}
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
Log.e(TAG, "Cannot open /proc/stat for reading", e);
|
Log.e(TAG, "Cannot open /proc/stat for reading", e);
|
||||||
return null;
|
return null;
|
||||||
} catch (IOException e) {
|
} catch (Exception e) {
|
||||||
Log.e(TAG, "Problems reading /proc/stat", e);
|
Log.e(TAG, "Problems parsing /proc/stat", e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return new ProcStat(userTime, systemTime, idleTime);
|
return new ProcStat(userTime, systemTime, idleTime);
|
||||||
|
|||||||
@ -233,7 +233,7 @@ public class DirectRTCClient implements AppRTCClient, TCPChannelClient.TCPChanne
|
|||||||
|
|
||||||
SignalingParameters parameters = new SignalingParameters(
|
SignalingParameters parameters = new SignalingParameters(
|
||||||
// Ice servers are not needed for direct connections.
|
// Ice servers are not needed for direct connections.
|
||||||
new LinkedList<PeerConnection.IceServer>(),
|
new LinkedList<>(),
|
||||||
isServer, // Server side acts as the initiator on direct connections.
|
isServer, // Server side acts as the initiator on direct connections.
|
||||||
null, // clientId
|
null, // clientId
|
||||||
null, // wssUrl
|
null, // wssUrl
|
||||||
@ -269,7 +269,7 @@ public class DirectRTCClient implements AppRTCClient, TCPChannelClient.TCPChanne
|
|||||||
|
|
||||||
SignalingParameters parameters = new SignalingParameters(
|
SignalingParameters parameters = new SignalingParameters(
|
||||||
// Ice servers are not needed for direct connections.
|
// Ice servers are not needed for direct connections.
|
||||||
new LinkedList<PeerConnection.IceServer>(),
|
new LinkedList<>(),
|
||||||
false, // This code will only be run on the client side. So, we are not the initiator.
|
false, // This code will only be run on the client side. So, we are not the initiator.
|
||||||
null, // clientId
|
null, // clientId
|
||||||
null, // wssUrl
|
null, // wssUrl
|
||||||
|
|||||||
@ -28,7 +28,6 @@ import java.util.Map;
|
|||||||
* Fragment for HUD statistics display.
|
* Fragment for HUD statistics display.
|
||||||
*/
|
*/
|
||||||
public class HudFragment extends Fragment {
|
public class HudFragment extends Fragment {
|
||||||
private View controlView;
|
|
||||||
private TextView encoderStatView;
|
private TextView encoderStatView;
|
||||||
private TextView hudViewBwe;
|
private TextView hudViewBwe;
|
||||||
private TextView hudViewConnection;
|
private TextView hudViewConnection;
|
||||||
@ -43,15 +42,15 @@ public class HudFragment extends Fragment {
|
|||||||
@Override
|
@Override
|
||||||
public View onCreateView(
|
public View onCreateView(
|
||||||
LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
controlView = inflater.inflate(R.layout.fragment_hud, container, false);
|
View controlView = inflater.inflate(R.layout.fragment_hud, container, false);
|
||||||
|
|
||||||
// Create UI controls.
|
// Create UI controls.
|
||||||
encoderStatView = (TextView) controlView.findViewById(R.id.encoder_stat_call);
|
encoderStatView = controlView.findViewById(R.id.encoder_stat_call);
|
||||||
hudViewBwe = (TextView) controlView.findViewById(R.id.hud_stat_bwe);
|
hudViewBwe = controlView.findViewById(R.id.hud_stat_bwe);
|
||||||
hudViewConnection = (TextView) controlView.findViewById(R.id.hud_stat_connection);
|
hudViewConnection = controlView.findViewById(R.id.hud_stat_connection);
|
||||||
hudViewVideoSend = (TextView) controlView.findViewById(R.id.hud_stat_video_send);
|
hudViewVideoSend = controlView.findViewById(R.id.hud_stat_video_send);
|
||||||
hudViewVideoRecv = (TextView) controlView.findViewById(R.id.hud_stat_video_recv);
|
hudViewVideoRecv = controlView.findViewById(R.id.hud_stat_video_recv);
|
||||||
toggleDebugButton = (ImageButton) controlView.findViewById(R.id.button_toggle_debug);
|
toggleDebugButton = controlView.findViewById(R.id.button_toggle_debug);
|
||||||
|
|
||||||
toggleDebugButton.setOnClickListener(new View.OnClickListener() {
|
toggleDebugButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -105,7 +104,7 @@ public class HudFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, String> getReportMap(StatsReport report) {
|
private Map<String, String> getReportMap(StatsReport report) {
|
||||||
Map<String, String> reportMap = new HashMap<String, String>();
|
Map<String, String> reportMap = new HashMap<>();
|
||||||
for (StatsReport.Value value : report.values) {
|
for (StatsReport.Value value : report.values) {
|
||||||
reportMap.put(value.name, value.value);
|
reportMap.put(value.name, value.value);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,7 +20,6 @@ import java.nio.ByteBuffer;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -134,7 +133,6 @@ public class PeerConnectionClient {
|
|||||||
private int videoHeight;
|
private int videoHeight;
|
||||||
private int videoFps;
|
private int videoFps;
|
||||||
private MediaConstraints audioConstraints;
|
private MediaConstraints audioConstraints;
|
||||||
private ParcelFileDescriptor aecDumpFileDescriptor;
|
|
||||||
private MediaConstraints sdpMediaConstraints;
|
private MediaConstraints sdpMediaConstraints;
|
||||||
private PeerConnectionParameters peerConnectionParameters;
|
private PeerConnectionParameters peerConnectionParameters;
|
||||||
// Queued remote ICE candidates are consumed only after both local and
|
// Queued remote ICE candidates are consumed only after both local and
|
||||||
@ -600,7 +598,7 @@ public class PeerConnectionClient {
|
|||||||
Log.d(TAG, "Create peer connection.");
|
Log.d(TAG, "Create peer connection.");
|
||||||
|
|
||||||
Log.d(TAG, "PCConstraints: " + pcConstraints.toString());
|
Log.d(TAG, "PCConstraints: " + pcConstraints.toString());
|
||||||
queuedRemoteCandidates = new LinkedList<IceCandidate>();
|
queuedRemoteCandidates = new LinkedList<>();
|
||||||
|
|
||||||
if (videoCallEnabled) {
|
if (videoCallEnabled) {
|
||||||
factory.setVideoHwAccelerationOptions(
|
factory.setVideoHwAccelerationOptions(
|
||||||
@ -649,7 +647,7 @@ public class PeerConnectionClient {
|
|||||||
|
|
||||||
if (peerConnectionParameters.aecDump) {
|
if (peerConnectionParameters.aecDump) {
|
||||||
try {
|
try {
|
||||||
aecDumpFileDescriptor =
|
ParcelFileDescriptor aecDumpFileDescriptor =
|
||||||
ParcelFileDescriptor.open(new File(Environment.getExternalStorageDirectory().getPath()
|
ParcelFileDescriptor.open(new File(Environment.getExternalStorageDirectory().getPath()
|
||||||
+ File.separator + "Download/audio.aecdump"),
|
+ File.separator + "Download/audio.aecdump"),
|
||||||
ParcelFileDescriptor.MODE_READ_WRITE | ParcelFileDescriptor.MODE_CREATE
|
ParcelFileDescriptor.MODE_READ_WRITE | ParcelFileDescriptor.MODE_CREATE
|
||||||
@ -715,11 +713,7 @@ public class PeerConnectionClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isHDVideo() {
|
public boolean isHDVideo() {
|
||||||
if (!videoCallEnabled) {
|
return videoCallEnabled && videoWidth * videoHeight >= 1280 * 720;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return videoWidth * videoHeight >= 1280 * 720;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public EglBase.Context getRenderContext() {
|
public EglBase.Context getRenderContext() {
|
||||||
@ -1072,11 +1066,11 @@ public class PeerConnectionClient {
|
|||||||
}
|
}
|
||||||
final List<String> header = origLineParts.subList(0, 3);
|
final List<String> header = origLineParts.subList(0, 3);
|
||||||
final List<String> unpreferredPayloadTypes =
|
final List<String> unpreferredPayloadTypes =
|
||||||
new ArrayList<String>(origLineParts.subList(3, origLineParts.size()));
|
new ArrayList<>(origLineParts.subList(3, origLineParts.size()));
|
||||||
unpreferredPayloadTypes.removeAll(preferredPayloadTypes);
|
unpreferredPayloadTypes.removeAll(preferredPayloadTypes);
|
||||||
// Reconstruct the line with |preferredPayloadTypes| moved to the beginning of the payload
|
// Reconstruct the line with |preferredPayloadTypes| moved to the beginning of the payload
|
||||||
// types.
|
// types.
|
||||||
final List<String> newLineParts = new ArrayList<String>();
|
final List<String> newLineParts = new ArrayList<>();
|
||||||
newLineParts.addAll(header);
|
newLineParts.addAll(header);
|
||||||
newLineParts.addAll(preferredPayloadTypes);
|
newLineParts.addAll(preferredPayloadTypes);
|
||||||
newLineParts.addAll(unpreferredPayloadTypes);
|
newLineParts.addAll(unpreferredPayloadTypes);
|
||||||
@ -1092,11 +1086,11 @@ public class PeerConnectionClient {
|
|||||||
}
|
}
|
||||||
// A list with all the payload types with name |codec|. The payload types are integers in the
|
// A list with all the payload types with name |codec|. The payload types are integers in the
|
||||||
// range 96-127, but they are stored as strings here.
|
// range 96-127, but they are stored as strings here.
|
||||||
final List<String> codecPayloadTypes = new ArrayList<String>();
|
final List<String> codecPayloadTypes = new ArrayList<>();
|
||||||
// a=rtpmap:<payload type> <encoding name>/<clock rate> [/<encoding parameters>]
|
// a=rtpmap:<payload type> <encoding name>/<clock rate> [/<encoding parameters>]
|
||||||
final Pattern codecPattern = Pattern.compile("^a=rtpmap:(\\d+) " + codec + "(/\\d+)+[\r]?$");
|
final Pattern codecPattern = Pattern.compile("^a=rtpmap:(\\d+) " + codec + "(/\\d+)+[\r]?$");
|
||||||
for (int i = 0; i < lines.length; ++i) {
|
for (String line : lines) {
|
||||||
Matcher codecMatcher = codecPattern.matcher(lines[i]);
|
Matcher codecMatcher = codecPattern.matcher(line);
|
||||||
if (codecMatcher.matches()) {
|
if (codecMatcher.matches()) {
|
||||||
codecPayloadTypes.add(codecMatcher.group(1));
|
codecPayloadTypes.add(codecMatcher.group(1));
|
||||||
}
|
}
|
||||||
@ -1127,7 +1121,7 @@ public class PeerConnectionClient {
|
|||||||
|
|
||||||
private void switchCameraInternal() {
|
private void switchCameraInternal() {
|
||||||
if (videoCapturer instanceof CameraVideoCapturer) {
|
if (videoCapturer instanceof CameraVideoCapturer) {
|
||||||
if (!videoCallEnabled || isError || videoCapturer == null) {
|
if (!videoCallEnabled || isError) {
|
||||||
Log.e(TAG, "Failed to switch camera. Video: " + videoCallEnabled + ". Error : " + isError);
|
Log.e(TAG, "Failed to switch camera. Video: " + videoCallEnabled + ". Error : " + isError);
|
||||||
return; // No video is sent or only one camera is available or error happened.
|
return; // No video is sent or only one camera is available or error happened.
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,7 +37,6 @@ public class RoomParametersFetcher {
|
|||||||
private final RoomParametersFetcherEvents events;
|
private final RoomParametersFetcherEvents events;
|
||||||
private final String roomUrl;
|
private final String roomUrl;
|
||||||
private final String roomMessage;
|
private final String roomMessage;
|
||||||
private AsyncHttpURLConnection httpConnection;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Room parameters fetcher callbacks.
|
* Room parameters fetcher callbacks.
|
||||||
@ -64,7 +63,7 @@ public class RoomParametersFetcher {
|
|||||||
|
|
||||||
public void makeRequest() {
|
public void makeRequest() {
|
||||||
Log.d(TAG, "Connecting to room: " + roomUrl);
|
Log.d(TAG, "Connecting to room: " + roomUrl);
|
||||||
httpConnection =
|
AsyncHttpURLConnection httpConnection =
|
||||||
new AsyncHttpURLConnection("POST", roomUrl, roomMessage, new AsyncHttpEvents() {
|
new AsyncHttpURLConnection("POST", roomUrl, roomMessage, new AsyncHttpEvents() {
|
||||||
@Override
|
@Override
|
||||||
public void onHttpError(String errorMessage) {
|
public void onHttpError(String errorMessage) {
|
||||||
@ -100,7 +99,7 @@ public class RoomParametersFetcher {
|
|||||||
String wssPostUrl = roomJson.getString("wss_post_url");
|
String wssPostUrl = roomJson.getString("wss_post_url");
|
||||||
boolean initiator = (roomJson.getBoolean("is_initiator"));
|
boolean initiator = (roomJson.getBoolean("is_initiator"));
|
||||||
if (!initiator) {
|
if (!initiator) {
|
||||||
iceCandidates = new LinkedList<IceCandidate>();
|
iceCandidates = new LinkedList<>();
|
||||||
String messagesString = roomJson.getString("messages");
|
String messagesString = roomJson.getString("messages");
|
||||||
JSONArray messages = new JSONArray(messagesString);
|
JSONArray messages = new JSONArray(messagesString);
|
||||||
for (int i = 0; i < messages.length(); ++i) {
|
for (int i = 0; i < messages.length(); ++i) {
|
||||||
@ -161,7 +160,7 @@ public class RoomParametersFetcher {
|
|||||||
// off the main thread!
|
// off the main thread!
|
||||||
private LinkedList<PeerConnection.IceServer> requestTurnServers(String url)
|
private LinkedList<PeerConnection.IceServer> requestTurnServers(String url)
|
||||||
throws IOException, JSONException {
|
throws IOException, JSONException {
|
||||||
LinkedList<PeerConnection.IceServer> turnServers = new LinkedList<PeerConnection.IceServer>();
|
LinkedList<PeerConnection.IceServer> turnServers = new LinkedList<>();
|
||||||
Log.d(TAG, "Request TURN from: " + url);
|
Log.d(TAG, "Request TURN from: " + url);
|
||||||
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
|
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
|
||||||
connection.setDoOutput(true);
|
connection.setDoOutput(true);
|
||||||
@ -203,7 +202,7 @@ public class RoomParametersFetcher {
|
|||||||
throws JSONException {
|
throws JSONException {
|
||||||
JSONObject json = new JSONObject(pcConfig);
|
JSONObject json = new JSONObject(pcConfig);
|
||||||
JSONArray servers = json.getJSONArray("iceServers");
|
JSONArray servers = json.getJSONArray("iceServers");
|
||||||
LinkedList<PeerConnection.IceServer> ret = new LinkedList<PeerConnection.IceServer>();
|
LinkedList<PeerConnection.IceServer> ret = new LinkedList<>();
|
||||||
for (int i = 0; i < servers.length(); ++i) {
|
for (int i = 0; i < servers.length(); ++i) {
|
||||||
JSONObject server = servers.getJSONObject(i);
|
JSONObject server = servers.getJSONObject(i);
|
||||||
String url = server.getString("urls");
|
String url = server.getString("urls");
|
||||||
|
|||||||
@ -41,7 +41,6 @@ public class WebSocketChannelClient {
|
|||||||
private final WebSocketChannelEvents events;
|
private final WebSocketChannelEvents events;
|
||||||
private final Handler handler;
|
private final Handler handler;
|
||||||
private WebSocketConnection ws;
|
private WebSocketConnection ws;
|
||||||
private WebSocketObserver wsObserver;
|
|
||||||
private String wsServerUrl;
|
private String wsServerUrl;
|
||||||
private String postServerUrl;
|
private String postServerUrl;
|
||||||
private String roomID;
|
private String roomID;
|
||||||
@ -73,7 +72,7 @@ public class WebSocketChannelClient {
|
|||||||
this.events = events;
|
this.events = events;
|
||||||
roomID = null;
|
roomID = null;
|
||||||
clientID = null;
|
clientID = null;
|
||||||
wsSendQueue = new LinkedList<String>();
|
wsSendQueue = new LinkedList<>();
|
||||||
state = WebSocketConnectionState.NEW;
|
state = WebSocketConnectionState.NEW;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,7 +92,7 @@ public class WebSocketChannelClient {
|
|||||||
|
|
||||||
Log.d(TAG, "Connecting WebSocket to: " + wsUrl + ". Post URL: " + postUrl);
|
Log.d(TAG, "Connecting WebSocket to: " + wsUrl + ". Post URL: " + postUrl);
|
||||||
ws = new WebSocketConnection();
|
ws = new WebSocketConnection();
|
||||||
wsObserver = new WebSocketObserver();
|
WebSocketObserver wsObserver = new WebSocketObserver();
|
||||||
try {
|
try {
|
||||||
ws.connect(new URI(wsServerUrl), wsObserver);
|
ws.connect(new URI(wsServerUrl), wsObserver);
|
||||||
} catch (URISyntaxException e) {
|
} catch (URISyntaxException e) {
|
||||||
|
|||||||
@ -26,7 +26,6 @@ import android.support.test.InstrumentationRegistry;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import org.appspot.apprtc.CallActivity;
|
import org.appspot.apprtc.CallActivity;
|
||||||
import org.appspot.apprtc.ConnectActivity;
|
|
||||||
import org.appspot.apprtc.R;
|
import org.appspot.apprtc.R;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|||||||
@ -79,7 +79,7 @@ public class PeerConnectionClientTest implements PeerConnectionEvents {
|
|||||||
private boolean isClosed;
|
private boolean isClosed;
|
||||||
private boolean isIceConnected;
|
private boolean isIceConnected;
|
||||||
private SessionDescription localSdp;
|
private SessionDescription localSdp;
|
||||||
private List<IceCandidate> iceCandidates = new LinkedList<IceCandidate>();
|
private List<IceCandidate> iceCandidates = new LinkedList<>();
|
||||||
private final Object localSdpEvent = new Object();
|
private final Object localSdpEvent = new Object();
|
||||||
private final Object iceCandidateEvent = new Object();
|
private final Object iceCandidateEvent = new Object();
|
||||||
private final Object iceConnectedEvent = new Object();
|
private final Object iceConnectedEvent = new Object();
|
||||||
@ -284,7 +284,7 @@ public class PeerConnectionClientTest implements PeerConnectionEvents {
|
|||||||
PeerConnectionClient createPeerConnectionClient(MockSink localRenderer,
|
PeerConnectionClient createPeerConnectionClient(MockSink localRenderer,
|
||||||
MockRenderer remoteRenderer, PeerConnectionParameters peerConnectionParameters,
|
MockRenderer remoteRenderer, PeerConnectionParameters peerConnectionParameters,
|
||||||
VideoCapturer videoCapturer) {
|
VideoCapturer videoCapturer) {
|
||||||
List<PeerConnection.IceServer> iceServers = new LinkedList<PeerConnection.IceServer>();
|
List<PeerConnection.IceServer> iceServers = new LinkedList<>();
|
||||||
SignalingParameters signalingParameters =
|
SignalingParameters signalingParameters =
|
||||||
new SignalingParameters(iceServers, true, // iceServers, initiator.
|
new SignalingParameters(iceServers, true, // iceServers, initiator.
|
||||||
null, null, null, // clientId, wssUrl, wssPostUrl.
|
null, null, null, // clientId, wssUrl, wssPostUrl.
|
||||||
@ -303,8 +303,7 @@ public class PeerConnectionClientTest implements PeerConnectionEvents {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private PeerConnectionParameters createParametersForAudioCall() {
|
private PeerConnectionParameters createParametersForAudioCall() {
|
||||||
PeerConnectionParameters peerConnectionParameters = new PeerConnectionParameters(
|
return new PeerConnectionParameters(false, /* videoCallEnabled */
|
||||||
false, /* videoCallEnabled */
|
|
||||||
true, /* loopback */
|
true, /* loopback */
|
||||||
false, /* tracing */
|
false, /* tracing */
|
||||||
// Video codec parameters.
|
// Video codec parameters.
|
||||||
@ -322,8 +321,6 @@ public class PeerConnectionClientTest implements PeerConnectionEvents {
|
|||||||
false, /* aecDump */
|
false, /* aecDump */
|
||||||
false /* useOpenSLES */, false /* disableBuiltInAEC */, false /* disableBuiltInAGC */,
|
false /* useOpenSLES */, false /* disableBuiltInAEC */, false /* disableBuiltInAGC */,
|
||||||
false /* disableBuiltInNS */, false /* enableLevelControl */, false /* disableWebRtcAGC */);
|
false /* disableBuiltInNS */, false /* enableLevelControl */, false /* disableWebRtcAGC */);
|
||||||
|
|
||||||
return peerConnectionParameters;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private VideoCapturer createCameraCapturer(boolean captureToTexture) {
|
private VideoCapturer createCameraCapturer(boolean captureToTexture) {
|
||||||
@ -341,8 +338,7 @@ public class PeerConnectionClientTest implements PeerConnectionEvents {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private PeerConnectionParameters createParametersForVideoCall(String videoCodec) {
|
private PeerConnectionParameters createParametersForVideoCall(String videoCodec) {
|
||||||
PeerConnectionParameters peerConnectionParameters = new PeerConnectionParameters(
|
return new PeerConnectionParameters(true, /* videoCallEnabled */
|
||||||
true, /* videoCallEnabled */
|
|
||||||
true, /* loopback */
|
true, /* loopback */
|
||||||
false, /* tracing */
|
false, /* tracing */
|
||||||
// Video codec parameters.
|
// Video codec parameters.
|
||||||
@ -360,8 +356,6 @@ public class PeerConnectionClientTest implements PeerConnectionEvents {
|
|||||||
false, /* aecDump */
|
false, /* aecDump */
|
||||||
false /* useOpenSLES */, false /* disableBuiltInAEC */, false /* disableBuiltInAGC */,
|
false /* useOpenSLES */, false /* disableBuiltInAEC */, false /* disableBuiltInAGC */,
|
||||||
false /* disableBuiltInNS */, false /* enableLevelControl */, false /* disableWebRtcAGC */);
|
false /* disableBuiltInNS */, false /* enableLevelControl */, false /* disableWebRtcAGC */);
|
||||||
|
|
||||||
return peerConnectionParameters;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
|
|||||||
Reference in New Issue
Block a user