Android 将Surface附加到MediaCodec(NDK)会为GrallocMapperPasstThrough:缓冲区描述符提供无效的使用位0x2000
如果我在Android 将Surface附加到MediaCodec(NDK)会为GrallocMapperPasstThrough:缓冲区描述符提供无效的使用位0x2000,android,c++,android-ndk,Android,C++,Android Ndk,如果我在AMediaCodec\u configure中取下format.get()并将nullptr放入其中,我不会得到W/grallocmappersthrough:buffer描述符,其中包含无效使用位0x2000错误,,因此问题肯定出在javaSurface中 我试图使javaSurface成为一个全局参考: I/MediaCodec: (0x7f589ba200) init name(video/avc) isType(1) encoder(0) I/OMXClient: Treble
AMediaCodec\u configure
中取下format.get()
并将nullptr
放入其中,我不会得到W/grallocmappersthrough:buffer描述符,其中包含无效使用位0x2000
错误,,因此问题肯定出在javaSurface
中
我试图使javaSurface
成为一个全局参考:
I/MediaCodec: (0x7f589ba200) init name(video/avc) isType(1) encoder(0)
I/OMXClient: Treble IOmx obtained
I/MediaCodec: (0x7f589ba200) Component Allocated (OMX.qcom.video.decoder.avc)
I/MediaCodec: (0x7f589ba200) configure surface(0x7f56270000) crypto(0x0) flags(0)
D/MediaCodec: (0x7f589ba200) configure format: AMessage(what = 0x00000000) = {
string mime = "video/avc"
int32_t width = 2304
int32_t height = 1296
}
D/SurfaceUtils: connecting to surface 0x7f56270010, reason connectToSurface
I/MediaCodec: [OMX.qcom.video.decoder.avc] setting surface generation to 20434946
D/SurfaceUtils: disconnecting from surface 0x7f56270010, reason connectToSurface(reconnect)
connecting to surface 0x7f56270010, reason connectToSurface(reconnect)
I/ACodec: DRC Mode: Dynamic Buffer Mode
I/ExtendedACodec: setupVideoDecoder()
I/ACodec: [OMX.qcom.video.decoder.avc] setupVideoDecoder Width Height (2304x1296)
mime (video/avc) compressionFormat (7)
I/ExtendedACodec: Decoder will be in frame by frame mode
I/MediaCodec: (0x7f589ba200) start
D/SurfaceUtils: set up nativeWindow 0x7f56270010 for 2304x1296, color 0x7fa30c06, rotation 0, usage 0x20002900
I/MediaCodec: (0x7f589ba200) kWhatStartCompleted
W/GrallocMapperPassthrough: buffer descriptor with invalid usage bits 0x2000
I/chatty: uid=10102(u0_a102) CodecLooper identical 2 lines
W/GrallocMapperPassthrough: buffer descriptor with invalid usage bits 0x2000
D/SurfaceUtils: set up nativeWindow 0x7f5ba36010 for 2304x1296, color 0x7fa30c06, rotation 0, usage 0x20002900
D/MediaCodec: (0x7f589bac00) kWhatOutputBuffersChanged
W/GrallocMapperPassthrough: buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough: buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough: buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough: buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough: buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough: buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough: buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough: buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough: buffer descriptor with invalid usage bits 0x2000
D/SurfaceUtils: set up nativeWindow 0x7f56270010 for 1920x1088, color 0x7fa30c06, rotation 0, usage 0x20002900
D/MediaCodec: (0x7f589ba200) kWhatOutputBuffersChanged
W/GrallocMapperPassthrough: buffer descriptor with invalid usage bits 0x2000
I/chatty: uid=10102(u0_a102) CodecLooper identical 2 lines
W/GrallocMapperPassthrough: buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough: buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough: buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough: buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough: buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough: buffer descriptor with invalid usage bits 0x2000
Process 19956 terminated.
但我仍然得到了错误
到达MediaCodecodeDecoder
构造函数的曲面是从连接到屏幕的SurfaceTexture
创建的:曲面曲面曲面=新曲面(SurfaceTexture)代码>
正如您从输出中看到的,解码工作正常,因为它检测到我添加的2个流的宽度和高度
ps:请注意,我调用的queueInputBuffer的presentationTimeoutUS等于10000,因为我不知道放在那里的是什么:但我不认为这是一个问题
I/MediaCodec: (0x7f589ba200) init name(video/avc) isType(1) encoder(0)
I/OMXClient: Treble IOmx obtained
I/MediaCodec: (0x7f589ba200) Component Allocated (OMX.qcom.video.decoder.avc)
I/MediaCodec: (0x7f589ba200) configure surface(0x7f56270000) crypto(0x0) flags(0)
D/MediaCodec: (0x7f589ba200) configure format: AMessage(what = 0x00000000) = {
string mime = "video/avc"
int32_t width = 2304
int32_t height = 1296
}
D/SurfaceUtils: connecting to surface 0x7f56270010, reason connectToSurface
I/MediaCodec: [OMX.qcom.video.decoder.avc] setting surface generation to 20434946
D/SurfaceUtils: disconnecting from surface 0x7f56270010, reason connectToSurface(reconnect)
connecting to surface 0x7f56270010, reason connectToSurface(reconnect)
I/ACodec: DRC Mode: Dynamic Buffer Mode
I/ExtendedACodec: setupVideoDecoder()
I/ACodec: [OMX.qcom.video.decoder.avc] setupVideoDecoder Width Height (2304x1296)
mime (video/avc) compressionFormat (7)
I/ExtendedACodec: Decoder will be in frame by frame mode
I/MediaCodec: (0x7f589ba200) start
D/SurfaceUtils: set up nativeWindow 0x7f56270010 for 2304x1296, color 0x7fa30c06, rotation 0, usage 0x20002900
I/MediaCodec: (0x7f589ba200) kWhatStartCompleted
W/GrallocMapperPassthrough: buffer descriptor with invalid usage bits 0x2000
I/chatty: uid=10102(u0_a102) CodecLooper identical 2 lines
W/GrallocMapperPassthrough: buffer descriptor with invalid usage bits 0x2000
D/SurfaceUtils: set up nativeWindow 0x7f5ba36010 for 2304x1296, color 0x7fa30c06, rotation 0, usage 0x20002900
D/MediaCodec: (0x7f589bac00) kWhatOutputBuffersChanged
W/GrallocMapperPassthrough: buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough: buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough: buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough: buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough: buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough: buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough: buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough: buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough: buffer descriptor with invalid usage bits 0x2000
D/SurfaceUtils: set up nativeWindow 0x7f56270010 for 1920x1088, color 0x7fa30c06, rotation 0, usage 0x20002900
D/MediaCodec: (0x7f589ba200) kWhatOutputBuffersChanged
W/GrallocMapperPassthrough: buffer descriptor with invalid usage bits 0x2000
I/chatty: uid=10102(u0_a102) CodecLooper identical 2 lines
W/GrallocMapperPassthrough: buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough: buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough: buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough: buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough: buffer descriptor with invalid usage bits 0x2000
W/GrallocMapperPassthrough: buffer descriptor with invalid usage bits 0x2000
Process 19956 terminated.
this->globalJavaSurface = env->NewGlobalRef(javaSurface);
this->surface.reset(ANativeWindow_fromSurface(env, globalJavaSurface));