diff --git a/adapters/ds/sinks/always_on_rtsp/config.py b/adapters/ds/sinks/always_on_rtsp/config.py index 6a06f462f..01e6ea71a 100644 --- a/adapters/ds/sinks/always_on_rtsp/config.py +++ b/adapters/ds/sinks/always_on_rtsp/config.py @@ -87,9 +87,9 @@ def __init__(self): self.framerate = opt_config('FRAMERATE', '30/1') self.idr_period_frames = opt_config('IDR_PERIOD_FRAMES', IDR_PERIOD_FRAMES, int) - self.sync = opt_config('SYNC_INPUT', False, strtobool) + self.sync = opt_config('SYNC_INPUT', True, strtobool) self.realtime = opt_config('REALTIME', False, strtobool) - self.sync_offset_ms = opt_config('SYNC_OFFSET_MS', 0, int) + self.sync_offset_ms = opt_config('SYNC_OFFSET_MS', 1000, int) assert self.sync_offset_ms >= 0, 'SYNC_OFFSET_MS should be non-negative.' self.sync_queue_size = opt_config('SYNC_QUEUE_SIZE', 500, int) assert self.sync_queue_size > 0, 'SYNC_QUEUE_SIZE should be positive.' diff --git a/docs/source/savant_101/10_adapters.rst b/docs/source/savant_101/10_adapters.rst index d69e23a19..fb68fd89c 100644 --- a/docs/source/savant_101/10_adapters.rst +++ b/docs/source/savant_101/10_adapters.rst @@ -1124,16 +1124,16 @@ The simplified design of the adapter is depicted in the following diagram: - ``logger`` * - ``SYNC_INPUT`` - A flag indicating whether to show frames on sink synchronously (i.e. at the source rate). - - ``False`` - ``True`` + - ``False`` * - ``REALTIME`` - - A flag indicating whether to synchronise frames at realtime (i.e. using avsolute timestamps); ignored when ``SYNC_INPUT=False``. + - A flag indicating whether to synchronise frames at realtime (i.e. using absolute timestamps); ignored when ``SYNC_INPUT=False``. - ``False`` - ``True`` * - ``SYNC_OFFSET_MS`` - An offset in milliseconds to adjust the synchronisation. Tune this parameter to play video more smoothly. When ``REALTIME=False``, the offset is applied to the timestamp of the first frame; when ``REALTIME=True``, the offset is applied to the current time. Ignored when ``SYNC_INPUT=False``. - - ``0`` - - ``10`` + - ``1000`` + - ``5000`` * - ``SYNC_QUEUE_SIZE`` - A size of queue for frames to be synchronised; ignored when ``SYNC_INPUT=False``. Tune this parameter according to the stream framerate and ``SYNC_OFFSET_MS``. - ``500`` @@ -1177,7 +1177,7 @@ Running the adapter with Docker: docker run --rm -it --name sink-always-on-rtsp \ --gpus=all \ --entrypoint python \ - -e SYNC_INPUT=False \ + -e SYNC_INPUT=True \ -e ZMQ_ENDPOINT=sub+connect:ipc:///tmp/zmq-sockets/output-video.ipc \ -e SOURCE_ID=test \ -e STUB_FILE_LOCATION=/path/to/stub_file/test.jpg \ diff --git a/gst_plugins/python/savant_rs_video_decode_bin.py b/gst_plugins/python/savant_rs_video_decode_bin.py index 7c1ceba6c..8ba8c2fc4 100644 --- a/gst_plugins/python/savant_rs_video_decode_bin.py +++ b/gst_plugins/python/savant_rs_video_decode_bin.py @@ -18,7 +18,7 @@ OUT_CAPS = Gst.Caps.from_string('video/x-raw(memory:NVMM);video/x-raw') DEFAULT_PASS_EOS = True # Default values of "queue" element -DEFAULT_DECODER_QUEUE_LENGTH = 200 +DEFAULT_DECODER_QUEUE_LENGTH = 5 DEFAULT_DECODER_QUEUE_SIZE = 10485760 NESTED_DEMUX_PROPERTIES = { diff --git a/samples/peoplenet_detector/docker-compose.x86.yml b/samples/peoplenet_detector/docker-compose.x86.yml index 885557e32..d8134f158 100644 --- a/samples/peoplenet_detector/docker-compose.x86.yml +++ b/samples/peoplenet_detector/docker-compose.x86.yml @@ -31,7 +31,6 @@ services: - ZMQ_SRC_ENDPOINT=sub+bind:ipc:///tmp/zmq-sockets/input-video.ipc - ZMQ_SINK_ENDPOINT=pub+bind:ipc:///tmp/zmq-sockets/output-video.ipc - METRICS_FRAME_PERIOD=1000 - - DECODER_QUEUE_LENGTH=5 deploy: resources: reservations: diff --git a/savant/config/default.yml b/savant/config/default.yml index 3277a4f11..9931a72dc 100644 --- a/savant/config/default.yml +++ b/savant/config/default.yml @@ -193,7 +193,7 @@ pipeline: ingress_queue_length: ${oc.decode:${oc.env:INGRESS_QUEUE_LENGTH, null}} # Size of the ingress queue in bytes (0 - no limit, default 10485760). ingress_queue_byte_size: ${oc.decode:${oc.env:INGRESS_QUEUE_BYTE_SIZE, null}} - # Length of the queue before decoder in frames (0 - no limit, default 200). + # Length of the queue before decoder in frames (0 - no limit, default 5). decoder_queue_length: ${oc.decode:${oc.env:DECODER_QUEUE_LENGTH, null}} # Size of the queue before decoder in bytes (0 - no limit, default 10485760). decoder_queue_byte_size: ${oc.decode:${oc.env:DECODER_QUEUE_BYTE_SIZE, null}} diff --git a/scripts/run_sink.py b/scripts/run_sink.py index 8c60fc2e6..5a1997784 100755 --- a/scripts/run_sink.py +++ b/scripts/run_sink.py @@ -400,10 +400,13 @@ def video_files_sink( help='Where to dump metadata (stdout or logger).', ) @click.option( - '--sync', + '--no-sync', is_flag=True, default=False, - help='Show frames on sink synchronously (i.e. at the source file rate).', + help=( + 'Disable showing frames on sink synchronously (i.e. at the source file rate). ' + 'Set this flag to show frames as soon as possible.' + ), ) @click.option( '--realtime', @@ -414,7 +417,7 @@ def video_files_sink( @click.option( '--sync-offset-ms', type=click.INT, - default=0, + default=1000, help=( 'Offset in milliseconds to adjust the synchronisation. ' 'Tune this parameter to play video more smoothly.' @@ -504,7 +507,7 @@ def always_on_rtsp_sink( fps_period_frames: Optional[int], fps_period_seconds: Optional[float], metadata_output: Optional[str], - sync: bool, + no_sync: bool, realtime: bool, sync_offset_ms: int, sync_queue_size: int, @@ -534,9 +537,6 @@ def always_on_rtsp_sink( Stream control API is available at http://:. See http://:/docs for API documentation. - - Note: it is advisable to use --sync flag on source adapter or use a live - source adapter (e.g. rtsp or usb-cam). """ assert ( @@ -594,7 +594,7 @@ def always_on_rtsp_sink( cmd = build_docker_run_command( f'sink-always-on-rtsp-{uuid.uuid4().hex}', zmq_endpoints=[in_endpoint], - sync_input=sync, + sync_input=not no_sync, entrypoint='python', args=['-m', 'adapters.ds.sinks.always_on_rtsp'], envs=envs,