Index: webrtc/examples/androidapp/src/org/appspot/apprtc/CallActivity.java |
diff --git a/webrtc/examples/androidapp/src/org/appspot/apprtc/CallActivity.java b/webrtc/examples/androidapp/src/org/appspot/apprtc/CallActivity.java |
index 39740a35bb66d908253db3618317afc5c0db8d5c..834e224ecea52d28b06503751e95e6b71ac7acbd 100644 |
--- a/webrtc/examples/androidapp/src/org/appspot/apprtc/CallActivity.java |
+++ b/webrtc/examples/androidapp/src/org/appspot/apprtc/CallActivity.java |
@@ -37,6 +37,8 @@ import org.webrtc.RendererCommon.ScalingType; |
import org.webrtc.SessionDescription; |
import org.webrtc.StatsReport; |
import org.webrtc.SurfaceViewRenderer; |
+import org.webrtc.GlVideoFileDrawer; |
magjed_webrtc
2016/08/31 13:08:03
The imports should be put in alphabetical order.
mandermo
2016/09/16 12:32:30
Done.
|
+import org.webrtc.GlRectDrawer; |
/** |
* Activity for peer connection call setup, call waiting |
@@ -96,6 +98,18 @@ public class CallActivity extends Activity |
"org.appspot.apprtc.CMDLINE"; |
public static final String EXTRA_RUNTIME = |
"org.appspot.apprtc.RUNTIME"; |
+ public static final String EXTRA_VIDEO_FILE_AS_CAMERA = |
+ "org.appspot.apprtc.VIDEO_FILE_AS_CAMERA"; |
+ public static final String EXTRA_VIDEO_FILE_AS_CAMERA_WIDTH = |
magjed_webrtc
2016/08/31 13:08:03
Why do we have to send width and height separately
mandermo
2016/09/16 12:32:30
Video container .yuv does not contain width and he
magjed_webrtc
2016/09/16 13:46:25
Ok, then I prefer if we use a container that conta
mandermo
2016/09/23 15:12:03
Change to .y4m with width and height and conversio
|
+ "org.appspot.apprtc.VIDEO_FILE_AS_CAMERA_WIDTH"; |
+ public static final String EXTRA_VIDEO_FILE_AS_CAMERA_HEIGHT = |
+ "org.appspot.apprtc.VIDEO_FILE_AS_CAMERA_HEIGHT"; |
+ public static final String EXTRA_SAVE_REMOTE_VIDEO_TO_FILE = |
+ "org.appspot.apprtc.SAVE_REMOTE_VIDEO_TO_FILE"; |
+ public static final String EXTRA_SAVE_REMOTE_VIDEO_TO_FILE_WIDTH = |
+ "org.appspot.apprtc.SAVE_REMOTE_VIDEO_TO_FILE_WIDTH"; |
+ public static final String EXTRA_SAVE_REMOTE_VIDEO_TO_FILE_HEIGHT = |
+ "org.appspot.apprtc.SAVE_REMOTE_VIDEO_TO_FILE_HEIGHT"; |
private static final String TAG = "CallRTCClient"; |
// List of mandatory application permissions. |
@@ -193,10 +207,24 @@ public class CallActivity extends Activity |
localRender.setOnClickListener(listener); |
remoteRender.setOnClickListener(listener); |
+ final Intent intent = getIntent(); |
+ |
// Create video renderers. |
rootEglBase = EglBase.create(); |
localRender.init(rootEglBase.getEglBaseContext(), null); |
- remoteRender.init(rootEglBase.getEglBaseContext(), null); |
+ String saveRemoteVideoToFile = intent.getStringExtra(EXTRA_SAVE_REMOTE_VIDEO_TO_FILE); |
+ |
+ if (saveRemoteVideoToFile != null) { |
+ int videoOutWidth = intent.getIntExtra(EXTRA_SAVE_REMOTE_VIDEO_TO_FILE_WIDTH, 0); |
+ int videoOutHeight = intent.getIntExtra(EXTRA_SAVE_REMOTE_VIDEO_TO_FILE_HEIGHT, 0); |
+ GlVideoFileDrawer drawer = new GlVideoFileDrawer( |
+ saveRemoteVideoToFile, videoOutWidth, videoOutHeight, |
+ rootEglBase.getEglBaseContext(), new GlRectDrawer()); |
+ remoteRender.init(rootEglBase.getEglBaseContext(), null, EglBase.CONFIG_PLAIN, drawer); |
+ } |
+ else { |
+ remoteRender.init(rootEglBase.getEglBaseContext(), null); |
+ } |
localRender.setZOrderMediaOverlay(true); |
updateVideoView(); |
@@ -211,7 +239,6 @@ public class CallActivity extends Activity |
} |
// Get Intent parameters. |
- final Intent intent = getIntent(); |
Uri roomUri = intent.getData(); |
if (roomUri == null) { |
logAndToast(getString(R.string.missing_url)); |
@@ -221,6 +248,7 @@ public class CallActivity extends Activity |
return; |
} |
String roomId = intent.getStringExtra(EXTRA_ROOMID); |
+ Log.d(TAG, "Room ID: " + roomId); |
if (roomId == null || roomId.length() == 0) { |
logAndToast(getString(R.string.missing_url)); |
Log.e(TAG, "Incorrect room ID in intent!"); |
@@ -255,10 +283,15 @@ public class CallActivity extends Activity |
intent.getBooleanExtra(EXTRA_DISABLE_BUILT_IN_AEC, false), |
intent.getBooleanExtra(EXTRA_DISABLE_BUILT_IN_AGC, false), |
intent.getBooleanExtra(EXTRA_DISABLE_BUILT_IN_NS, false), |
- intent.getBooleanExtra(EXTRA_ENABLE_LEVEL_CONTROL, false)); |
+ intent.getBooleanExtra(EXTRA_ENABLE_LEVEL_CONTROL, false), |
+ intent.getStringExtra(EXTRA_VIDEO_FILE_AS_CAMERA), |
+ intent.getIntExtra(EXTRA_VIDEO_FILE_AS_CAMERA_WIDTH, 0), |
+ intent.getIntExtra(EXTRA_VIDEO_FILE_AS_CAMERA_HEIGHT, 0)); |
commandLineRun = intent.getBooleanExtra(EXTRA_CMDLINE, false); |
runTimeMs = intent.getIntExtra(EXTRA_RUNTIME, 0); |
+ Log.d(TAG, "VIDEO_FILE: '" + intent.getStringExtra(EXTRA_VIDEO_FILE_AS_CAMERA) + "'"); |
+ |
// Create connection client. Use DirectRTCClient if room name is an IP otherwise use the |
// standard WebSocketRTCClient. |
if (loopback || !DirectRTCClient.IP_PATTERN.matcher(roomId).matches()) { |