Android: Allow SurfaceTextureHelper.textureToYuv to be used for RGB frames
TBR=sakal@webrtc.org Bug: b/69162554 Change-Id: I342777a1cc961346a3e61408d02fbc6a16b7b633 Reviewed-on: https://webrtc-review.googlesource.com/24101 Reviewed-by: Magnus Jedvert <magjed@webrtc.org> Commit-Queue: Magnus Jedvert <magjed@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20748}
This commit is contained in:

committed by
Commit Bot

parent
df4883dbf0
commit
c040daec11
@ -18,13 +18,9 @@ import android.opengl.GLES20;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.HandlerThread;
|
||||
import android.os.SystemClock;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.FloatBuffer;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import org.webrtc.EglBase;
|
||||
import org.webrtc.VideoFrame.I420Buffer;
|
||||
import org.webrtc.VideoFrame.TextureBuffer;
|
||||
|
||||
/**
|
||||
@ -256,14 +252,9 @@ public class SurfaceTextureHelper {
|
||||
}
|
||||
|
||||
/**
|
||||
* Posts to the correct thread to convert |textureBuffer| to I420. Must only be called with
|
||||
* textures generated by this SurfaceTextureHelper.
|
||||
* Posts to the correct thread to convert |textureBuffer| to I420.
|
||||
*/
|
||||
public VideoFrame.I420Buffer textureToYuv(final TextureBuffer textureBuffer) {
|
||||
if (textureBuffer.getTextureId() != oesTextureId) {
|
||||
throw new IllegalStateException("textureToByteBuffer called with unexpected textureId");
|
||||
}
|
||||
|
||||
final VideoFrame.I420Buffer[] result = new VideoFrame.I420Buffer[1];
|
||||
ThreadUtils.invokeAtFrontUninterruptibly(handler, () -> {
|
||||
if (yuvConverter == null) {
|
||||
|
@ -216,6 +216,7 @@ public class YuvConverter {
|
||||
if (textureType != shaderTextureType) {
|
||||
initShader(textureType);
|
||||
}
|
||||
shader.useProgram();
|
||||
|
||||
// We draw into a buffer laid out like
|
||||
//
|
||||
|
Reference in New Issue
Block a user