Remove surface size mismatch logic from EglRenderer.

This logic doesn't really work. Application should mask the view while
the surface size is being changed.

BUG=webrtc:6470

Review-Url: https://codereview.webrtc.org/2528243003
Cr-Commit-Position: refs/heads/master@{#15273}
This commit is contained in:
sakal 2016-11-28 08:47:05 -08:00 committed by Commit bot
parent 6287e82b9b
commit d1aaaaa125
3 changed files with 3 additions and 30 deletions

View File

@ -101,8 +101,6 @@ public class EglRenderer implements VideoRenderer.Callbacks {
// These variables are synchronized on |layoutLock|.
private final Object layoutLock = new Object();
private int surfaceWidth;
private int surfaceHeight;
private float layoutAspectRatio;
// If true, mirrors the video stream horizontally.
private boolean mirror;
@ -458,17 +456,6 @@ public class EglRenderer implements VideoRenderer.Callbacks {
completionCallback.run();
}
/**
* Notify that the surface size has changed.
*/
public void surfaceSizeChanged(int surfaceWidth, int surfaceHeight) {
logD("Surface size changed: " + surfaceWidth + "x" + surfaceHeight);
synchronized (layoutLock) {
this.surfaceWidth = surfaceWidth;
this.surfaceHeight = surfaceHeight;
}
}
/**
* Private helper function to post tasks safely.
*/
@ -536,18 +523,6 @@ public class EglRenderer implements VideoRenderer.Callbacks {
final int drawnFrameWidth;
final int drawnFrameHeight;
synchronized (layoutLock) {
int surfaceClearCount = 0;
while (eglBase.surfaceWidth() != surfaceWidth || eglBase.surfaceHeight() != surfaceHeight) {
++surfaceClearCount;
if (surfaceClearCount > MAX_SURFACE_CLEAR_COUNT) {
logD("Failed to get surface of expected size - dropping frame.");
VideoRenderer.renderFrameDone(frame);
return;
}
logD("Surface size mismatch - clearing surface. Size: " + eglBase.surfaceWidth() + "x"
+ eglBase.surfaceHeight() + " Expected: " + surfaceWidth + "x" + surfaceHeight);
clearSurfaceOnRenderThread();
}
final float[] layoutMatrix;
if (layoutAspectRatio > 0) {
final float frameAspectRatio = frame.rotatedWidth() / (float) frame.rotatedHeight();
@ -581,11 +556,11 @@ public class EglRenderer implements VideoRenderer.Callbacks {
yuvUploader.uploadYuvData(
yuvTextures, frame.width, frame.height, frame.yuvStrides, frame.yuvPlanes);
drawer.drawYuv(yuvTextures, drawMatrix, drawnFrameWidth, drawnFrameHeight, 0, 0, surfaceWidth,
surfaceHeight);
drawer.drawYuv(yuvTextures, drawMatrix, drawnFrameWidth, drawnFrameHeight, 0, 0,
eglBase.surfaceWidth(), eglBase.surfaceHeight());
} else {
drawer.drawOes(frame.textureId, drawMatrix, drawnFrameWidth, drawnFrameHeight, 0, 0,
surfaceWidth, surfaceHeight);
eglBase.surfaceWidth(), eglBase.surfaceHeight());
}
final long swapBuffersStartTimeNs = System.nanoTime();

View File

@ -252,7 +252,6 @@ public class SurfaceViewRenderer
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
ThreadUtils.checkIsOnMainThread();
logD("surfaceChanged: format: " + format + " size: " + width + "x" + height);
eglRenderer.surfaceSizeChanged(width, height);
}
private String getResourceName() {

View File

@ -97,7 +97,6 @@ public class EglRendererTest extends InstrumentationTestCase {
surfaceTexture = new SurfaceTexture(oesTextureId);
surfaceTexture.setDefaultBufferSize(1 /* width */, 1 /* height */);
eglRenderer.createEglSurface(surfaceTexture);
eglRenderer.surfaceSizeChanged(1 /* width */, 1 /* height */);
}
@Override