簡體   English   中英

Android MediaCodec解碼h264原始數據延遲問題

[英]Android MediaCodec decode h264 raw data latency issue

我嘗試使用MediaCodec解碼1080p h264原始數據。 但是我發現SONY Z3(5.1.1)的延遲在45ms〜65ms之間。 可以減少延遲嗎? 我的幀是IPPP,GOP是15,是否有任何h264 sps標志會影響延遲?

我還有一個問題,如何改變表面的方向讓框架以90,180或270度顯示。

我把我的測試項目源放在下面的谷歌驅動器鏈接。 並且h264原始數據在test_code \\ res \\ raw中。

https://drive.google.com/file/d/0B688fdS1LxF4REtra0YteDh6TkE/view?usp=sharing

02-16 18:05:52.804: I/Process(10590): Sending signal. PID: 10590 SIG: 9
02-16 18:05:54.618: W/ResourceType(10706): Found multiple library tables, ignoring...
02-16 18:05:54.677: D/OpenGLRenderer(10706): Use EGL_SWAP_BEHAVIOR_PRESERVED: true
02-16 18:05:54.684: D/Atlas(10706): Validating map...
02-16 18:05:54.717: I/Adreno-EGL(10706): <qeglDrvAPI_eglInitialize:410>: EGL 1.4 QUALCOMM build: AU_LINUX_ANDROID_LA.BF.1.1.1_RB1.05.01.00.042.030_msm8974_LA.BF.1.1.1_RB1__release_AU ()
02-16 18:05:54.717: I/Adreno-EGL(10706): OpenGL ES Shader Compiler Version: E031.25.03.06
02-16 18:05:54.717: I/Adreno-EGL(10706): Build Date: 07/13/15 Mon
02-16 18:05:54.717: I/Adreno-EGL(10706): Local Branch: mybranch11906725
02-16 18:05:54.717: I/Adreno-EGL(10706): Remote Branch: quic/LA.BF.1.1.1_rb1.26
02-16 18:05:54.717: I/Adreno-EGL(10706): Local Patches: NONE
02-16 18:05:54.717: I/Adreno-EGL(10706): Reconstruct Branch: AU_LINUX_ANDROID_LA.BF.1.1.1_RB1.05.01.00.042.030 + 6151be1 + a1e0343 + 002d7d6 + 7d0e3f7 +  NOTHING
02-16 18:05:54.718: I/OpenGLRenderer(10706): Initialized EGL, version 1.4
02-16 18:05:54.733: D/OpenGLRenderer(10706): Enabling debug mode 0
02-16 18:05:54.800: I/Timeline(10706): Timeline: Activity_idle id: android.os.BinderProxy@1970952c time:27341192
02-16 18:05:56.804: I/OMXClient(10706): Using client-side OMX mux.
02-16 18:05:56.819: D/MediaCodec(10706): MediaCodec[kWhatConfigure]: video-output-protection: 00000000, audio-output-protection: 00000000
02-16 18:05:56.821: I/ACodec(10706): [OMX.qcom.video.decoder.avc] DRC Mode: Dynamic Buffer Mode
02-16 18:05:56.827: I/ExtendedCodec(10706): Decoder will be in frame by frame mode
02-16 18:05:56.830: D/ACodec(10706): Found video-output-protection flags set to 00000000
02-16 18:05:56.845: E/(10706): inputBuffers.size:4
02-16 18:05:56.845: E/(10706): outputBuffers.size:23
02-16 18:05:56.858: E/DecodeActivity(10706): dequeueOutputBuffer timed out!
02-16 18:05:56.870: E/DecodeActivity(10706): dequeueOutputBuffer timed out!
02-16 18:05:56.883: E/DecodeActivity(10706): dequeueOutputBuffer timed out!
02-16 18:05:56.884: E/DecodeActivity(10706): INFO_OUTPUT_BUFFERS_CHANGED
02-16 18:05:56.892: E/DecodeActivity(10706): New format {mime=video/raw, crop-top=0, crop-right=1919, slice-height=1088, color-format=2141391876, height=1088, width=1920, what=1869968451, crop-bottom=1079, crop-left=0, stride=1920}
02-16 18:05:56.898: E/DecodeActivity(10706): Receive first decode frame after 51 ms

我在您的代碼中看到您將10000 uS設置為接收輸入數據的超時。 那是很短的時間。

while (!Thread.interrupted()) {
            if (!isEOS) {
                int inIndex = decoder.dequeueInputBuffer(10000);

dequeueInputBuffer ,放置一個很長的超時,例如十秒(10000000)。 這樣可以等待更長的時間。 將-1設置為超時將阻塞,直到接收到數據為止。

您可能應該在饋送循環之外處理連接問題,並在啟動饋送循環之前讓自己的助手來緩沖初始數據。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM