You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By default, queues are **blocking** and their size is **30**, so when the device fills up a queue and when the limit is
69
+
reached, any additional messages from the device will be blocked and the library will wait until it can add new messages to the queue.
70
+
It will wait for the host to consume (eg. :code:`queue.get()`) a message before putting a new one into the queue.
71
+
72
+
.. note::
73
+
After the host queue gets filled up, the XLinkOut.input queue on the device will start filling up. If that queue is
74
+
set to blocking, other nodes that are sending messages to it will have to wait as well. This is a usual cause for a
75
+
blocked pipeline, where one of the queues isn't emptied in timely manner and the rest of the pipeline waits for it
76
+
to be empty again.
77
+
78
+
Non-Blocking behaviour
79
+
**********************
80
+
Making the queue non-blocking will change the behavior in the situation described above - instead of waiting, the library will discard
81
+
the oldest message and add the new one to the queue, and then continue its processing loop (so it won't get blocked).
82
+
:code:`maxSize` determines the size of the queue and it also helps to control memory usage.
83
+
84
+
For example, if a message has 5MB of data, and the queue size is 30, this queue can effectively store
85
+
up to 150MB of data in the memory on the host (the messages can also get really big, for instance, a single 4K NV12 encoded frame takes about ~12MB).
86
+
87
+
Some additional information
88
+
***************************
89
+
90
+
- Decreasing the queue size to 1 and setting non-blocking behavior will effectively mean "I only want the latest packet from the queue".
91
+
- Queues are thread-safe - they can be accessed from any thread.
92
+
- Queues are created such that each queue is its own thread which takes care of receiving, serializing/deserializing, and sending the messages forward (same for input/output queues).
93
+
- The :code:`Device` object isn't fully thread-safe. Some RPC calls (eg. :code:`getLogLevel`, :code:`setLogLevel`, :code:`getDdrMemoryUsage`) will get thread-safe once the mutex is set in place (right now there could be races).
0 commit comments