Change YuvConverter.convert to catch GLExceptions and return null.
With https://webrtc-review.googlesource.com/c/src/+/222582, I420 conversion is allowed to fail. Bug: webrtc:12877 Change-Id: Iadae21ad889f084b8027206af4478223d7733d3e Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/222653 Reviewed-by: Xavier Lepaul <xalep@webrtc.org> Commit-Queue: Fabian Bergmark <fabianbergmark@google.com> Cr-Commit-Position: refs/heads/master@{#34320}
This commit is contained in:
committed by
WebRTC LUCI CQ
parent
ac82bd386a
commit
1bb36d2c77
@ -12,6 +12,8 @@ package org.webrtc;
|
||||
|
||||
import android.graphics.Matrix;
|
||||
import android.opengl.GLES20;
|
||||
import android.opengl.GLException;
|
||||
import android.support.annotation.Nullable;
|
||||
import java.nio.ByteBuffer;
|
||||
import org.webrtc.VideoFrame.I420Buffer;
|
||||
import org.webrtc.VideoFrame.TextureBuffer;
|
||||
@ -20,7 +22,9 @@ import org.webrtc.VideoFrame.TextureBuffer;
|
||||
* Class for converting OES textures to a YUV ByteBuffer. It can be constructed on any thread, but
|
||||
* should only be operated from a single thread with an active EGL context.
|
||||
*/
|
||||
public class YuvConverter {
|
||||
public final class YuvConverter {
|
||||
private static final String TAG = "YuvConverter";
|
||||
|
||||
private static final String FRAGMENT_SHADER =
|
||||
// Difference in texture coordinate corresponding to one
|
||||
// sub-pixel in the x direction.
|
||||
@ -122,9 +126,17 @@ public class YuvConverter {
|
||||
}
|
||||
|
||||
/** Converts the texture buffer to I420. */
|
||||
@Nullable
|
||||
public I420Buffer convert(TextureBuffer inputTextureBuffer) {
|
||||
threadChecker.checkIsOnValidThread();
|
||||
try {
|
||||
return convertInternal(inputTextureBuffer);
|
||||
} catch (GLException e) {
|
||||
Logging.w(TAG, "Failed to convert TextureBuffer", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private I420Buffer convertInternal(TextureBuffer inputTextureBuffer) {
|
||||
TextureBuffer preparedBuffer = (TextureBuffer) videoFrameDrawer.prepareBufferForViewportSize(
|
||||
inputTextureBuffer, inputTextureBuffer.getWidth(), inputTextureBuffer.getHeight());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user