summaryrefslogtreecommitdiff
path: root/examples/android/src/org
diff options
context:
space:
mode:
authorfischman@webrtc.org <fischman@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d>2013-10-03 18:23:13 +0000
committerfischman@webrtc.org <fischman@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d>2013-10-03 18:23:13 +0000
commitd6e55624705769778c95ef79153cdc57a5a76707 (patch)
treee440d83375fa60dfccb96177e6d971c7b46d659b /examples/android/src/org
parentfdec3b26135424ca195a70eabb364dcbd7d0256c (diff)
downloadtalk-d6e55624705769778c95ef79153cdc57a5a76707.tar.gz
VideoCaptureAndroid: rewrote the (standalone) implementation of video capture on Android.
Besides being ~40% the size of the previous implementation, this makes it so that VideoCaptureAndroid can stop and restart capture, which is necessary to support onPause/onResume reasonably on Android. BUG=1407 R=henrike@webrtc.org, wu@webrtc.org Review URL: https://webrtc-codereview.appspot.com/2334004 git-svn-id: http://webrtc.googlecode.com/svn/trunk/talk@4915 4adac7df-926f-26a2-2b94-8c16560cd09d
Diffstat (limited to 'examples/android/src/org')
-rw-r--r--examples/android/src/org/appspot/apprtc/AppRTCDemoActivity.java18
-rw-r--r--examples/android/src/org/appspot/apprtc/VideoStreamsView.java1
2 files changed, 10 insertions, 9 deletions
diff --git a/examples/android/src/org/appspot/apprtc/AppRTCDemoActivity.java b/examples/android/src/org/appspot/apprtc/AppRTCDemoActivity.java
index 8f1fecd..a6da552 100644
--- a/examples/android/src/org/appspot/apprtc/AppRTCDemoActivity.java
+++ b/examples/android/src/org/appspot/apprtc/AppRTCDemoActivity.java
@@ -156,19 +156,18 @@ public class AppRTCDemoActivity extends Activity
public void onPause() {
super.onPause();
vsv.onPause();
- // TODO(fischman): IWBN to support pause/resume, but the WebRTC codebase
- // isn't ready for that yet; e.g.
- // https://code.google.com/p/webrtc/issues/detail?id=1407
- // Instead, simply exit instead of pausing (the alternative leads to
- // system-borking with wedged cameras; e.g. b/8224551)
- disconnectAndExit();
+ if (videoSource != null) {
+ videoSource.stop();
+ }
}
@Override
public void onResume() {
- // The onResume() is a lie! See TODO(fischman) in onPause() above.
super.onResume();
vsv.onResume();
+ if (videoSource != null) {
+ videoSource.restart();
+ }
}
@Override
@@ -249,7 +248,8 @@ public class AppRTCDemoActivity extends Activity
}
@Override
- public void onDestroy() {
+ protected void onDestroy() {
+ disconnectAndExit();
super.onDestroy();
}
@@ -524,7 +524,6 @@ public class AppRTCDemoActivity extends Activity
return;
}
quit[0] = true;
- wakeLock.release();
if (pc != null) {
pc.dispose();
pc = null;
@@ -542,6 +541,7 @@ public class AppRTCDemoActivity extends Activity
factory.dispose();
factory = null;
}
+ wakeLock.release();
finish();
}
}
diff --git a/examples/android/src/org/appspot/apprtc/VideoStreamsView.java b/examples/android/src/org/appspot/apprtc/VideoStreamsView.java
index 30c9bf8..906aa92 100644
--- a/examples/android/src/org/appspot/apprtc/VideoStreamsView.java
+++ b/examples/android/src/org/appspot/apprtc/VideoStreamsView.java
@@ -75,6 +75,7 @@ public class VideoStreamsView
public VideoStreamsView(Context c, Point screenDimensions) {
super(c);
this.screenDimensions = screenDimensions;
+ setPreserveEGLContextOnPause(true);
setEGLContextClientVersion(2);
setRenderer(this);
setRenderMode(RENDERMODE_WHEN_DIRTY);