Repository navigation
udp:// receive thread at the audio priority: no drops in a loaded grid (#253) - #254
Conversation
…d grid (#253) Thread.MAX_PRIORITY is nice -8. In the 3x3 grid (load ~24 on the 4-core test box) that thread still waited long enough for a key-frame burst to fill the socket buffer. THREAD_PRIORITY_URGENT_AUDIO (nice -19), H.265 1080p at 8 Mbit/s, three 4-minute runs each: rtp_lost 49.5/s -> 5.2/s, socket_drops 27.9/s -> 0.05/s, ring_dropped 3.05/s -> 0. The rest is lost on the network: the box kernel drops nothing.
PR Summary by QodoPrioritize UDP reception to prevent drops in loaded grids
AI Description
Diagram
High-Level Assessment
Files changed (3)
|
Code Review by Qodo
1.
|
1b17d42 to
e93848e
Compare
|
/review |
|
Code review by qodo was updated up to the latest commit e93848e |
|
CI build of e93848e (2.18.4) on the test box, same 3×3 grid and push (H.265 1080p at 8 Mbit/s, load average 23–26), three 4-minute runs. Per second, from
The receive thread |
Fixes #253.
The
udp://receive thread from #252 ran atThread.MAX_PRIORITY, which is nice −8 on Android. In a loaded 3×3 grid it still waited for the CPU long enough for a key-frame burst to fill the socket buffer (rmem_maxcaps it at 512 KiB). Now it runs atProcess.THREAD_PRIORITY_URGENT_AUDIO(nice −19).Measured
Test box with 4 cores, 3×3 grid of 8 cameras plus the U cell, load average 19–26. The U cell gets an H.265 1080p push from Majestic at 8 Mbit/s (~700 datagrams/s). One build with the receive variant switched at run time, three 4-minute runs per variant, interleaved. Per second, from
/stats.json→cells[U].udp:rtp_lostsocket_dropsring_droppedMAX_PRIORITY+DatagramPacket(2.18.3)URGENT_AUDIO+DatagramPacket(this PR)MAX_PRIORITY+DatagramChannelURGENT_AUDIO+DatagramChannelThe rest of
rtp_lostis lost on the network. Over one minute the camera sent 43 442 UDP datagrams (OutDatagrams, noSndbufErrors), the app received 42 791, and the box kernel counted noRcvbufErrors.Ideas 2 and 3 from #253 are left out:
DatagramChannelinto a direct buffer: no gain over the priority alone.recvmmsg()through JNI: built and ready to measure, but with nothing left to drop in the box it would only add the NDK to the build.Checks
testDebugUnitTest(371 tests),lintDebugand the release build pass locally in the Android build container.CHANGELOG.mdsection added.