Improve video decoder resync handling to prevent freezes (fix for Waze accumulating latency) - #49
Improve video decoder resync handling to prevent freezes (fix for Waze accumulating latency)#4914praveenk wants to merge 2 commits into
Conversation
|
Hi, can't you release an apk somewhere so I can download it? If it's more stable? |
Yes, you can try with this build. You will need to uninstall any previous version of OpenDroidAuto for it to install. |
|
Thank you! Will you still be working on this app or will Maki continue? |
|
Just installed this "latency fix" apk, started it up and toyed around with VLC and GMaps through Android Auto, so far so good, no major regressions at least. Never noticed latency issues (not using Waze), but the decoder improvements sound like they might just be general stability improvements too. Fingers crossed that they resolve the occasional application crash that required me to restart OpenDroidAuto on the road. |
|
Is the latency - you are talking about - manifesting by seeing the car way behind (stale position, sometimes not even moving) or (less often) ahead (somehow extrapolated, "thinking" I have chosen another turn)? If not, I will search other open issues. |
This pull request introduces several improvements to video decoding robustness, buffer management, and code safety across both the JNI C++ backend and the Android Java video output. The main focus is on smarter handling of H.264 video frame synchronization, improved buffer overflow management, and minor code cleanups.
Video decoder synchronization and buffer management improvements
H264NalParser.hutility to inspect H.264 NAL units, enabling detection of keyframes (IDR) and codec configuration frames. This is now used inOMXSourceto improve sync handling. [1] [2]OMXSource::queueBufferto detect decoder backlog, drop frames until a keyframe is found, and avoid freezes by timing out if no keyframe arrives. This prevents buffer overflows and ensures the decoder can resynchronize after interruptions. [1] [2]clearQueuedBuffers()method, used both for overflow and on stop, reducing code duplication and improving safety. [1] [2]JNI/C++ code safety and cleanup
OMXDecoder::read, and simplified timestamp handling for buffer queuing. [1] [2]Timestamp.cpp, and corrected timestamp extraction usingmemcpyfor portability and correctness. [1] [2]Android Java video output improvements
configured_andrunning_flags inNativeVideoOutputvolatilefor thread safety, adjusted codec thread start order, and set a nonzero timeout for output buffer dequeue to improve playback reliability. [1] [2] [3]These changes collectively make the video pipeline more robust against stream interruptions, decoder backlogs, and threading issues.