0

I've seen in this thread that presentation time has to be set for some encoders. I am using input surface when encoding with mediacodec, but it doesn't work with Snapdragon devices. My question is do we also need to set this presentation timestamp when using an input surface ? If so how to simply set a timestamp to the input surface ?

Thanks a lot for any help.

Community
  • 1
  • 1
Sloosh
  • 1,681
  • 1
  • 10
  • 14

1 Answers1

2

Assuming your input surface is being rendered with GLES, you would use eglPresentationTimeANDROID().

See Grafika for examples (e.g. "Record GL app" activity).

fadden
  • 51,356
  • 5
  • 116
  • 166
  • thanks for your answer. But I don't have GLES context ... is it possible to add timestamp without OpenGL ? – Sloosh Jul 14 '14 at 18:11
  • How are you providing frames to the Surface? Canvas isn't really supported (https://code.google.com/p/android/issues/detail?id=61194). – fadden Jul 14 '14 at 22:48
  • I get my data from a bufferProducer. Data are produced elsewhere by another program. So I understand that I now have to create an EGL context to be able to add presentation time to the surface, am I right ? But I am in native code, and I have following error (while any other egl function is ok): error: undefined reference to 'eglPresentationTimeANDROID' I link my program with libEGL and libGLESv2 with flag EGL_EGLEXT_PROTOTYPES. Any idea of what could be missing ? Thanks – Sloosh Jul 15 '14 at 11:39
  • If you're using private APIs, you can just set the timestamp directly in the BufferQueue. If you look in the EGL implementation (line 1529 in https://android.googlesource.com/platform/frameworks/native/+/kitkat-release/opengl/libs/EGL/eglApi.cpp), you can see that it calls `native_window_set_buffers_timestamp()`. – fadden Jul 15 '14 at 14:50
  • yes this is what I just found ! thanks a lot i will try like this. – Sloosh Jul 15 '14 at 15:45