Add screenshare support to AppRTCMobile.
BUG=webrtc:6674 Review-Url: https://codereview.webrtc.org/2488643002 Cr-Commit-Position: refs/heads/master@{#15003}
This commit is contained in:
@ -16,6 +16,7 @@
|
|||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
|
<uses-permission android:name="android.permission.CAPTURE_VIDEO_OUTPUT" />
|
||||||
|
|
||||||
<application android:label="@string/app_name"
|
<application android:label="@string/app_name"
|
||||||
android:icon="@drawable/ic_launcher"
|
android:icon="@drawable/ic_launcher"
|
||||||
|
|||||||
@ -39,6 +39,10 @@
|
|||||||
<string name="pref_videocall_dlg">Enable video in a call.</string>
|
<string name="pref_videocall_dlg">Enable video in a call.</string>
|
||||||
<string name="pref_videocall_default">true</string>
|
<string name="pref_videocall_default">true</string>
|
||||||
|
|
||||||
|
<string name="pref_screencapture_key">screencapture_preference</string>
|
||||||
|
<string name="pref_screencapture_title">Use screencapture.</string>
|
||||||
|
<string name="pref_screencapture_default">false</string>
|
||||||
|
|
||||||
<string name="pref_camera2_key">camera2_preference</string>
|
<string name="pref_camera2_key">camera2_preference</string>
|
||||||
<string name="pref_camera2_title">Use Camera2.</string>
|
<string name="pref_camera2_title">Use Camera2.</string>
|
||||||
<string name="pref_camera2_default">true</string>
|
<string name="pref_camera2_default">true</string>
|
||||||
|
|||||||
@ -10,6 +10,11 @@
|
|||||||
android:dialogTitle="@string/pref_videocall_dlg"
|
android:dialogTitle="@string/pref_videocall_dlg"
|
||||||
android:defaultValue="@string/pref_videocall_default" />
|
android:defaultValue="@string/pref_videocall_default" />
|
||||||
|
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:key="@string/pref_screencapture_key"
|
||||||
|
android:title="@string/pref_screencapture_title"
|
||||||
|
android:defaultValue="@string/pref_screencapture_default" />
|
||||||
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:key="@string/pref_camera2_key"
|
android:key="@string/pref_camera2_key"
|
||||||
android:title="@string/pref_camera2_title"
|
android:title="@string/pref_camera2_title"
|
||||||
|
|||||||
@ -10,44 +10,47 @@
|
|||||||
|
|
||||||
package org.appspot.apprtc;
|
package org.appspot.apprtc;
|
||||||
|
|
||||||
import org.appspot.apprtc.AppRTCClient.RoomConnectionParameters;
|
|
||||||
import org.appspot.apprtc.AppRTCClient.SignalingParameters;
|
|
||||||
import org.appspot.apprtc.PeerConnectionClient.PeerConnectionParameters;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.FragmentTransaction;
|
import android.app.FragmentTransaction;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
|
import android.media.projection.MediaProjection;
|
||||||
|
import android.media.projection.MediaProjectionManager;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
|
import android.util.DisplayMetrics;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
|
import android.view.WindowManager;
|
||||||
import android.view.WindowManager.LayoutParams;
|
import android.view.WindowManager.LayoutParams;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.RuntimeException;
|
import java.lang.RuntimeException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import org.appspot.apprtc.AppRTCClient.RoomConnectionParameters;
|
||||||
|
import org.appspot.apprtc.AppRTCClient.SignalingParameters;
|
||||||
|
import org.appspot.apprtc.PeerConnectionClient.PeerConnectionParameters;
|
||||||
import org.webrtc.Camera1Enumerator;
|
import org.webrtc.Camera1Enumerator;
|
||||||
import org.webrtc.Camera2Enumerator;
|
import org.webrtc.Camera2Enumerator;
|
||||||
import org.webrtc.CameraEnumerator;
|
import org.webrtc.CameraEnumerator;
|
||||||
import org.webrtc.EglBase;
|
import org.webrtc.EglBase;
|
||||||
import org.webrtc.FileVideoCapturer;
|
import org.webrtc.FileVideoCapturer;
|
||||||
import org.webrtc.VideoFileRenderer;
|
|
||||||
import org.webrtc.IceCandidate;
|
import org.webrtc.IceCandidate;
|
||||||
import org.webrtc.Logging;
|
import org.webrtc.Logging;
|
||||||
import org.webrtc.PeerConnectionFactory;
|
import org.webrtc.PeerConnectionFactory;
|
||||||
import org.webrtc.RendererCommon.ScalingType;
|
import org.webrtc.RendererCommon.ScalingType;
|
||||||
|
import org.webrtc.ScreenCapturerAndroid;
|
||||||
import org.webrtc.SessionDescription;
|
import org.webrtc.SessionDescription;
|
||||||
import org.webrtc.StatsReport;
|
import org.webrtc.StatsReport;
|
||||||
import org.webrtc.SurfaceViewRenderer;
|
import org.webrtc.SurfaceViewRenderer;
|
||||||
import org.webrtc.VideoCapturer;
|
import org.webrtc.VideoCapturer;
|
||||||
|
import org.webrtc.VideoFileRenderer;
|
||||||
import org.webrtc.VideoRenderer;
|
import org.webrtc.VideoRenderer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -60,6 +63,7 @@ public class CallActivity extends Activity implements AppRTCClient.SignalingEven
|
|||||||
public static final String EXTRA_ROOMID = "org.appspot.apprtc.ROOMID";
|
public static final String EXTRA_ROOMID = "org.appspot.apprtc.ROOMID";
|
||||||
public static final String EXTRA_LOOPBACK = "org.appspot.apprtc.LOOPBACK";
|
public static final String EXTRA_LOOPBACK = "org.appspot.apprtc.LOOPBACK";
|
||||||
public static final String EXTRA_VIDEO_CALL = "org.appspot.apprtc.VIDEO_CALL";
|
public static final String EXTRA_VIDEO_CALL = "org.appspot.apprtc.VIDEO_CALL";
|
||||||
|
public static final String EXTRA_SCREENCAPTURE = "org.appspot.apprtc.SCREENCAPTURE";
|
||||||
public static final String EXTRA_CAMERA2 = "org.appspot.apprtc.CAMERA2";
|
public static final String EXTRA_CAMERA2 = "org.appspot.apprtc.CAMERA2";
|
||||||
public static final String EXTRA_VIDEO_WIDTH = "org.appspot.apprtc.VIDEO_WIDTH";
|
public static final String EXTRA_VIDEO_WIDTH = "org.appspot.apprtc.VIDEO_WIDTH";
|
||||||
public static final String EXTRA_VIDEO_HEIGHT = "org.appspot.apprtc.VIDEO_HEIGHT";
|
public static final String EXTRA_VIDEO_HEIGHT = "org.appspot.apprtc.VIDEO_HEIGHT";
|
||||||
@ -94,6 +98,7 @@ public class CallActivity extends Activity implements AppRTCClient.SignalingEven
|
|||||||
public static final String EXTRA_USE_VALUES_FROM_INTENT =
|
public static final String EXTRA_USE_VALUES_FROM_INTENT =
|
||||||
"org.appspot.apprtc.USE_VALUES_FROM_INTENT";
|
"org.appspot.apprtc.USE_VALUES_FROM_INTENT";
|
||||||
private static final String TAG = "CallRTCClient";
|
private static final String TAG = "CallRTCClient";
|
||||||
|
private static final int CAPTURE_PERMISSION_REQUEST_CODE = 1;
|
||||||
|
|
||||||
// List of mandatory application permissions.
|
// List of mandatory application permissions.
|
||||||
private static final String[] MANDATORY_PERMISSIONS = {"android.permission.MODIFY_AUDIO_SETTINGS",
|
private static final String[] MANDATORY_PERMISSIONS = {"android.permission.MODIFY_AUDIO_SETTINGS",
|
||||||
@ -140,6 +145,9 @@ public class CallActivity extends Activity implements AppRTCClient.SignalingEven
|
|||||||
private boolean callControlFragmentVisible = true;
|
private boolean callControlFragmentVisible = true;
|
||||||
private long callStartedTimeMs = 0;
|
private long callStartedTimeMs = 0;
|
||||||
private boolean micEnabled = true;
|
private boolean micEnabled = true;
|
||||||
|
private boolean screencaptureEnabled = false;
|
||||||
|
private static Intent mediaProjectionPermissionResultData;
|
||||||
|
private static int mediaProjectionPermissionResultCode;
|
||||||
|
|
||||||
// Controls
|
// Controls
|
||||||
private CallFragment callFragment;
|
private CallFragment callFragment;
|
||||||
@ -243,10 +251,23 @@ public class CallActivity extends Activity implements AppRTCClient.SignalingEven
|
|||||||
boolean loopback = intent.getBooleanExtra(EXTRA_LOOPBACK, false);
|
boolean loopback = intent.getBooleanExtra(EXTRA_LOOPBACK, false);
|
||||||
boolean tracing = intent.getBooleanExtra(EXTRA_TRACING, false);
|
boolean tracing = intent.getBooleanExtra(EXTRA_TRACING, false);
|
||||||
|
|
||||||
|
int videoWidth = intent.getIntExtra(EXTRA_VIDEO_WIDTH, 0);
|
||||||
|
int videoHeight = intent.getIntExtra(EXTRA_VIDEO_HEIGHT, 0);
|
||||||
|
|
||||||
|
screencaptureEnabled = intent.getBooleanExtra(EXTRA_SCREENCAPTURE, false);
|
||||||
|
// If capturing format is not specified for screencapture, use screen resolution.
|
||||||
|
if (screencaptureEnabled && videoWidth == 0 && videoHeight == 0) {
|
||||||
|
DisplayMetrics displayMetrics = new DisplayMetrics();
|
||||||
|
WindowManager windowManager =
|
||||||
|
(WindowManager) getApplication().getSystemService(Context.WINDOW_SERVICE);
|
||||||
|
windowManager.getDefaultDisplay().getRealMetrics(displayMetrics);
|
||||||
|
videoWidth = displayMetrics.widthPixels;
|
||||||
|
videoHeight = displayMetrics.heightPixels;
|
||||||
|
}
|
||||||
|
|
||||||
peerConnectionParameters =
|
peerConnectionParameters =
|
||||||
new PeerConnectionParameters(intent.getBooleanExtra(EXTRA_VIDEO_CALL, true), loopback,
|
new PeerConnectionParameters(intent.getBooleanExtra(EXTRA_VIDEO_CALL, true), loopback,
|
||||||
tracing, intent.getIntExtra(EXTRA_VIDEO_WIDTH, 0),
|
tracing, videoWidth, videoHeight, intent.getIntExtra(EXTRA_VIDEO_FPS, 0),
|
||||||
intent.getIntExtra(EXTRA_VIDEO_HEIGHT, 0), intent.getIntExtra(EXTRA_VIDEO_FPS, 0),
|
|
||||||
intent.getIntExtra(EXTRA_VIDEO_BITRATE, 0), intent.getStringExtra(EXTRA_VIDEOCODEC),
|
intent.getIntExtra(EXTRA_VIDEO_BITRATE, 0), intent.getStringExtra(EXTRA_VIDEOCODEC),
|
||||||
intent.getBooleanExtra(EXTRA_HWCODEC_ENABLED, true),
|
intent.getBooleanExtra(EXTRA_HWCODEC_ENABLED, true),
|
||||||
intent.getIntExtra(EXTRA_AUDIO_BITRATE, 0), intent.getStringExtra(EXTRA_AUDIOCODEC),
|
intent.getIntExtra(EXTRA_AUDIO_BITRATE, 0), intent.getStringExtra(EXTRA_AUDIOCODEC),
|
||||||
@ -285,7 +306,6 @@ public class CallActivity extends Activity implements AppRTCClient.SignalingEven
|
|||||||
ft.add(R.id.call_fragment_container, callFragment);
|
ft.add(R.id.call_fragment_container, callFragment);
|
||||||
ft.add(R.id.hud_fragment_container, hudFragment);
|
ft.add(R.id.hud_fragment_container, hudFragment);
|
||||||
ft.commit();
|
ft.commit();
|
||||||
startCall();
|
|
||||||
|
|
||||||
// For command line execution run connection for <runTimeMs> and exit.
|
// For command line execution run connection for <runTimeMs> and exit.
|
||||||
if (commandLineRun && runTimeMs > 0) {
|
if (commandLineRun && runTimeMs > 0) {
|
||||||
@ -305,6 +325,25 @@ public class CallActivity extends Activity implements AppRTCClient.SignalingEven
|
|||||||
}
|
}
|
||||||
peerConnectionClient.createPeerConnectionFactory(
|
peerConnectionClient.createPeerConnectionFactory(
|
||||||
CallActivity.this, peerConnectionParameters, CallActivity.this);
|
CallActivity.this, peerConnectionParameters, CallActivity.this);
|
||||||
|
|
||||||
|
if (screencaptureEnabled) {
|
||||||
|
MediaProjectionManager mediaProjectionManager =
|
||||||
|
(MediaProjectionManager) getApplication().getSystemService(
|
||||||
|
Context.MEDIA_PROJECTION_SERVICE);
|
||||||
|
startActivityForResult(
|
||||||
|
mediaProjectionManager.createScreenCaptureIntent(), CAPTURE_PERMISSION_REQUEST_CODE);
|
||||||
|
} else {
|
||||||
|
startCall();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
if (requestCode != CAPTURE_PERMISSION_REQUEST_CODE)
|
||||||
|
return;
|
||||||
|
mediaProjectionPermissionResultCode = resultCode;
|
||||||
|
mediaProjectionPermissionResultData = data;
|
||||||
|
startCall();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean useCamera2() {
|
private boolean useCamera2() {
|
||||||
@ -352,7 +391,9 @@ public class CallActivity extends Activity implements AppRTCClient.SignalingEven
|
|||||||
public void onPause() {
|
public void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
activityRunning = false;
|
activityRunning = false;
|
||||||
if (peerConnectionClient != null) {
|
// Don't stop the video when using screencapture to allow user to show other apps to the remote
|
||||||
|
// end.
|
||||||
|
if (peerConnectionClient != null && !screencaptureEnabled) {
|
||||||
peerConnectionClient.stopVideoSource();
|
peerConnectionClient.stopVideoSource();
|
||||||
}
|
}
|
||||||
cpuMonitor.pause();
|
cpuMonitor.pause();
|
||||||
@ -362,7 +403,8 @@ public class CallActivity extends Activity implements AppRTCClient.SignalingEven
|
|||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
activityRunning = true;
|
activityRunning = true;
|
||||||
if (peerConnectionClient != null) {
|
// Video is not paused for screencapture. See onPause.
|
||||||
|
if (peerConnectionClient != null && !screencaptureEnabled) {
|
||||||
peerConnectionClient.startVideoSource();
|
peerConnectionClient.startVideoSource();
|
||||||
}
|
}
|
||||||
cpuMonitor.resume();
|
cpuMonitor.resume();
|
||||||
@ -588,6 +630,18 @@ public class CallActivity extends Activity implements AppRTCClient.SignalingEven
|
|||||||
reportError("Failed to open video file for emulated camera");
|
reportError("Failed to open video file for emulated camera");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
} else if (screencaptureEnabled) {
|
||||||
|
if (mediaProjectionPermissionResultCode != Activity.RESULT_OK) {
|
||||||
|
reportError("User didn't give permission to capture the screen.");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new ScreenCapturerAndroid(
|
||||||
|
mediaProjectionPermissionResultData, new MediaProjection.Callback() {
|
||||||
|
@Override
|
||||||
|
public void onStop() {
|
||||||
|
reportError("User revoked permission to capture the screen.");
|
||||||
|
}
|
||||||
|
});
|
||||||
} else if (useCamera2()) {
|
} else if (useCamera2()) {
|
||||||
if (!captureToTexture()) {
|
if (!captureToTexture()) {
|
||||||
reportError(getString(R.string.camera2_texture_only_error));
|
reportError(getString(R.string.camera2_texture_only_error));
|
||||||
|
|||||||
@ -33,12 +33,10 @@ import android.widget.EditText;
|
|||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import org.json.JSONArray;
|
|
||||||
import org.json.JSONException;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the initial setup where the user selects which room to join.
|
* Handles the initial setup where the user selects which room to join.
|
||||||
@ -55,6 +53,7 @@ public class ConnectActivity extends Activity {
|
|||||||
private ListView roomListView;
|
private ListView roomListView;
|
||||||
private SharedPreferences sharedPref;
|
private SharedPreferences sharedPref;
|
||||||
private String keyprefVideoCallEnabled;
|
private String keyprefVideoCallEnabled;
|
||||||
|
private String keyprefScreencapture;
|
||||||
private String keyprefCamera2;
|
private String keyprefCamera2;
|
||||||
private String keyprefResolution;
|
private String keyprefResolution;
|
||||||
private String keyprefFps;
|
private String keyprefFps;
|
||||||
@ -90,6 +89,7 @@ public class ConnectActivity extends Activity {
|
|||||||
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);
|
keyprefVideoCallEnabled = getString(R.string.pref_videocall_key);
|
||||||
|
keyprefScreencapture = getString(R.string.pref_screencapture_key);
|
||||||
keyprefCamera2 = getString(R.string.pref_camera2_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);
|
||||||
@ -295,6 +295,10 @@ public class ConnectActivity extends Activity {
|
|||||||
boolean videoCallEnabled = sharedPrefGetBoolean(R.string.pref_videocall_key,
|
boolean videoCallEnabled = sharedPrefGetBoolean(R.string.pref_videocall_key,
|
||||||
CallActivity.EXTRA_VIDEO_CALL, R.string.pref_videocall_default, useValuesFromIntent);
|
CallActivity.EXTRA_VIDEO_CALL, R.string.pref_videocall_default, useValuesFromIntent);
|
||||||
|
|
||||||
|
// Use screencapture option.
|
||||||
|
boolean useScreencapture = sharedPrefGetBoolean(R.string.pref_screencapture_key,
|
||||||
|
CallActivity.EXTRA_SCREENCAPTURE, R.string.pref_screencapture_default, useValuesFromIntent);
|
||||||
|
|
||||||
// Use Camera2 option.
|
// Use Camera2 option.
|
||||||
boolean useCamera2 = sharedPrefGetBoolean(R.string.pref_camera2_key, CallActivity.EXTRA_CAMERA2,
|
boolean useCamera2 = sharedPrefGetBoolean(R.string.pref_camera2_key, CallActivity.EXTRA_CAMERA2,
|
||||||
R.string.pref_camera2_default, useValuesFromIntent);
|
R.string.pref_camera2_default, useValuesFromIntent);
|
||||||
@ -438,6 +442,7 @@ public class ConnectActivity extends Activity {
|
|||||||
intent.putExtra(CallActivity.EXTRA_ROOMID, roomId);
|
intent.putExtra(CallActivity.EXTRA_ROOMID, roomId);
|
||||||
intent.putExtra(CallActivity.EXTRA_LOOPBACK, loopback);
|
intent.putExtra(CallActivity.EXTRA_LOOPBACK, loopback);
|
||||||
intent.putExtra(CallActivity.EXTRA_VIDEO_CALL, videoCallEnabled);
|
intent.putExtra(CallActivity.EXTRA_VIDEO_CALL, videoCallEnabled);
|
||||||
|
intent.putExtra(CallActivity.EXTRA_SCREENCAPTURE, useScreencapture);
|
||||||
intent.putExtra(CallActivity.EXTRA_CAMERA2, useCamera2);
|
intent.putExtra(CallActivity.EXTRA_CAMERA2, useCamera2);
|
||||||
intent.putExtra(CallActivity.EXTRA_VIDEO_WIDTH, videoWidth);
|
intent.putExtra(CallActivity.EXTRA_VIDEO_WIDTH, videoWidth);
|
||||||
intent.putExtra(CallActivity.EXTRA_VIDEO_HEIGHT, videoHeight);
|
intent.putExtra(CallActivity.EXTRA_VIDEO_HEIGHT, videoHeight);
|
||||||
|
|||||||
@ -10,13 +10,23 @@
|
|||||||
|
|
||||||
package org.appspot.apprtc;
|
package org.appspot.apprtc;
|
||||||
|
|
||||||
import org.appspot.apprtc.AppRTCClient.SignalingParameters;
|
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.os.ParcelFileDescriptor;
|
import android.os.ParcelFileDescriptor;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.EnumSet;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Timer;
|
||||||
|
import java.util.TimerTask;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
import org.appspot.apprtc.AppRTCClient.SignalingParameters;
|
||||||
import org.webrtc.AudioSource;
|
import org.webrtc.AudioSource;
|
||||||
import org.webrtc.AudioTrack;
|
import org.webrtc.AudioTrack;
|
||||||
import org.webrtc.CameraVideoCapturer;
|
import org.webrtc.CameraVideoCapturer;
|
||||||
@ -42,19 +52,6 @@ import org.webrtc.VideoTrack;
|
|||||||
import org.webrtc.voiceengine.WebRtcAudioManager;
|
import org.webrtc.voiceengine.WebRtcAudioManager;
|
||||||
import org.webrtc.voiceengine.WebRtcAudioUtils;
|
import org.webrtc.voiceengine.WebRtcAudioUtils;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Timer;
|
|
||||||
import java.util.TimerTask;
|
|
||||||
import java.util.concurrent.Executors;
|
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Peer connection client implementation.
|
* Peer connection client implementation.
|
||||||
*
|
*
|
||||||
@ -82,9 +79,6 @@ public class PeerConnectionClient {
|
|||||||
private static final String DTLS_SRTP_KEY_AGREEMENT_CONSTRAINT = "DtlsSrtpKeyAgreement";
|
private static final String DTLS_SRTP_KEY_AGREEMENT_CONSTRAINT = "DtlsSrtpKeyAgreement";
|
||||||
private static final int HD_VIDEO_WIDTH = 1280;
|
private static final int HD_VIDEO_WIDTH = 1280;
|
||||||
private static final int HD_VIDEO_HEIGHT = 720;
|
private static final int HD_VIDEO_HEIGHT = 720;
|
||||||
private static final int MAX_VIDEO_WIDTH = 1280;
|
|
||||||
private static final int MAX_VIDEO_HEIGHT = 1280;
|
|
||||||
private static final int MAX_VIDEO_FPS = 30;
|
|
||||||
private static final int BPS_IN_KBPS = 1000;
|
private static final int BPS_IN_KBPS = 1000;
|
||||||
|
|
||||||
private static final PeerConnectionClient instance = new PeerConnectionClient();
|
private static final PeerConnectionClient instance = new PeerConnectionClient();
|
||||||
@ -428,10 +422,7 @@ public class PeerConnectionClient {
|
|||||||
if (videoFps == 0) {
|
if (videoFps == 0) {
|
||||||
videoFps = 30;
|
videoFps = 30;
|
||||||
}
|
}
|
||||||
|
Logging.d(TAG, "Capturing format: " + videoWidth + "x" + videoHeight + "@" + videoFps);
|
||||||
videoWidth = Math.min(videoWidth, MAX_VIDEO_WIDTH);
|
|
||||||
videoHeight = Math.min(videoHeight, MAX_VIDEO_HEIGHT);
|
|
||||||
videoFps = Math.min(videoFps, MAX_VIDEO_FPS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create audio constraints.
|
// Create audio constraints.
|
||||||
|
|||||||
@ -16,7 +16,6 @@ import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.ListPreference;
|
import android.preference.ListPreference;
|
||||||
import android.preference.Preference;
|
import android.preference.Preference;
|
||||||
|
|
||||||
import org.webrtc.Camera2Enumerator;
|
import org.webrtc.Camera2Enumerator;
|
||||||
import org.webrtc.voiceengine.WebRtcAudioUtils;
|
import org.webrtc.voiceengine.WebRtcAudioUtils;
|
||||||
|
|
||||||
@ -26,6 +25,7 @@ import org.webrtc.voiceengine.WebRtcAudioUtils;
|
|||||||
public class SettingsActivity extends Activity implements OnSharedPreferenceChangeListener {
|
public class SettingsActivity extends Activity implements OnSharedPreferenceChangeListener {
|
||||||
private SettingsFragment settingsFragment;
|
private SettingsFragment settingsFragment;
|
||||||
private String keyprefVideoCall;
|
private String keyprefVideoCall;
|
||||||
|
private String keyprefScreencapture;
|
||||||
private String keyprefCamera2;
|
private String keyprefCamera2;
|
||||||
private String keyprefResolution;
|
private String keyprefResolution;
|
||||||
private String keyprefFps;
|
private String keyprefFps;
|
||||||
@ -56,6 +56,7 @@ public class SettingsActivity extends Activity implements OnSharedPreferenceChan
|
|||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
keyprefVideoCall = getString(R.string.pref_videocall_key);
|
keyprefVideoCall = getString(R.string.pref_videocall_key);
|
||||||
|
keyprefScreencapture = getString(R.string.pref_screencapture_key);
|
||||||
keyprefCamera2 = getString(R.string.pref_camera2_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);
|
||||||
@ -98,6 +99,7 @@ public class SettingsActivity extends Activity implements OnSharedPreferenceChan
|
|||||||
settingsFragment.getPreferenceScreen().getSharedPreferences();
|
settingsFragment.getPreferenceScreen().getSharedPreferences();
|
||||||
sharedPreferences.registerOnSharedPreferenceChangeListener(this);
|
sharedPreferences.registerOnSharedPreferenceChangeListener(this);
|
||||||
updateSummaryB(sharedPreferences, keyprefVideoCall);
|
updateSummaryB(sharedPreferences, keyprefVideoCall);
|
||||||
|
updateSummaryB(sharedPreferences, keyprefScreencapture);
|
||||||
updateSummaryB(sharedPreferences, keyprefCamera2);
|
updateSummaryB(sharedPreferences, keyprefCamera2);
|
||||||
updateSummary(sharedPreferences, keyprefResolution);
|
updateSummary(sharedPreferences, keyprefResolution);
|
||||||
updateSummary(sharedPreferences, keyprefFps);
|
updateSummary(sharedPreferences, keyprefFps);
|
||||||
@ -186,6 +188,7 @@ public class SettingsActivity extends Activity implements OnSharedPreferenceChan
|
|||||||
|| key.equals(keyprefStartAudioBitrateValue)) {
|
|| key.equals(keyprefStartAudioBitrateValue)) {
|
||||||
updateSummaryBitrate(sharedPreferences, key);
|
updateSummaryBitrate(sharedPreferences, key);
|
||||||
} else if (key.equals(keyprefVideoCall)
|
} else if (key.equals(keyprefVideoCall)
|
||||||
|
|| key.equals(keyprefScreencapture)
|
||||||
|| key.equals(keyprefCamera2)
|
|| key.equals(keyprefCamera2)
|
||||||
|| key.equals(keyPrefTracing)
|
|| key.equals(keyPrefTracing)
|
||||||
|| key.equals(keyprefCaptureQualitySlider)
|
|| key.equals(keyprefCaptureQualitySlider)
|
||||||
|
|||||||
Reference in New Issue
Block a user