Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Unified Diff: talk/app/webrtc/java/src/org/webrtc/MediaCodecVideoEncoder.java

Issue 1523843006: MediaCodecVideoEncoder, set timestamp on the encoder surface when drawing a texture. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressed comments. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « talk/app/webrtc/java/jni/peerconnection_jni.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: talk/app/webrtc/java/src/org/webrtc/MediaCodecVideoEncoder.java
diff --git a/talk/app/webrtc/java/src/org/webrtc/MediaCodecVideoEncoder.java b/talk/app/webrtc/java/src/org/webrtc/MediaCodecVideoEncoder.java
index 54d40cd00e844cc27fd7261b97163f12cf163d00..5c8f9dc77e05064026824e039938e4e7dcc84699 100644
--- a/talk/app/webrtc/java/src/org/webrtc/MediaCodecVideoEncoder.java
+++ b/talk/app/webrtc/java/src/org/webrtc/MediaCodecVideoEncoder.java
@@ -44,6 +44,7 @@ import java.nio.ByteBuffer;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
// Java-side of peerconnection_jni.cc:MediaCodecVideoEncoder.
// This class is an implementation detail of the Java PeerConnection API.
@@ -75,7 +76,7 @@ public class MediaCodecVideoEncoder {
private Thread mediaCodecThread;
private MediaCodec mediaCodec;
private ByteBuffer[] outputBuffers;
- private EglBase eglBase;
+ private EglBase14 eglBase;
private int width;
private int height;
private Surface inputSurface;
@@ -270,7 +271,7 @@ public class MediaCodecVideoEncoder {
}
boolean initEncode(VideoCodecType type, int width, int height, int kbps, int fps,
- EglBase.Context sharedContext) {
+ EglBase14.Context sharedContext) {
final boolean useSurface = sharedContext != null;
Logging.d(TAG, "Java initEncode: " + type + " : " + width + " x " + height +
". @ " + kbps + " kbps. Fps: " + fps + ". Encode from texture : " + useSurface);
@@ -325,7 +326,7 @@ public class MediaCodecVideoEncoder {
format, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE);
if (useSurface) {
- eglBase = EglBase.create(sharedContext, EglBase.CONFIG_RECORDABLE);
+ eglBase = new EglBase14(sharedContext, EglBase.CONFIG_RECORDABLE);
// Create an input surface and keep a reference since we must release the surface when done.
inputSurface = mediaCodec.createInputSurface();
eglBase.createSurface(inputSurface);
@@ -388,9 +389,7 @@ public class MediaCodecVideoEncoder {
// but it's a workaround for bug webrtc:5147.
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
drawer.drawOes(oesTextureId, transformationMatrix, 0, 0, width, height);
- // TODO(perkj): Do we have to call EGLExt.eglPresentationTimeANDROID ?
- // If not, remove |presentationTimestampUs|.
- eglBase.swapBuffers();
+ eglBase.swapBuffers(TimeUnit.MICROSECONDS.toNanos(presentationTimestampUs));
return true;
}
catch (RuntimeException e) {
« no previous file with comments | « talk/app/webrtc/java/jni/peerconnection_jni.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698