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@4915 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user