Skip to content

Commit

Permalink
Remove fps_meter from ao-rtsp. (#699)
Browse files Browse the repository at this point in the history
  • Loading branch information
denisvmedyantsev authored Mar 15, 2024
1 parent 102f1e6 commit 6d20a78
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 26 deletions.
22 changes: 9 additions & 13 deletions adapters/ds/sinks/always_on_rtsp/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,6 @@ def __init__(self):
# default encoding bitrate
self.encoder_bitrate = opt_config('ENCODER_BITRATE', ENCODER_BITRATE, int)

self.fps_period_frames = opt_config('FPS_PERIOD_FRAMES', 1000, int)
self.fps_period_seconds = opt_config('FPS_PERIOD_SECONDS', convert=float)
self.fps_output = opt_config('FPS_OUTPUT', 'stdout')

try:
self.metadata_output = opt_config('METADATA_OUTPUT', None, MetadataOutput)
except ValueError:
Expand Down Expand Up @@ -122,13 +118,21 @@ def __init__(self):

self.pipeline_source_stage_name = 'source'
self.pipeline_demux_stage_name = 'source-demux'

conf = VideoPipelineConfiguration()
conf.frame_period = opt_config('FPS_PERIOD_FRAMES', 1000, int)
time_period_seconds = opt_config('FPS_PERIOD_SECONDS', convert=int)
conf.timestamp_period = (
time_period_seconds * 1000 if time_period_seconds else None
)

self.video_pipeline: Optional[VideoPipeline] = VideoPipeline(
'always-on-sink',
[
(self.pipeline_source_stage_name, VideoPipelineStagePayloadType.Frame),
(self.pipeline_demux_stage_name, VideoPipelineStagePayloadType.Frame),
],
VideoPipelineConfiguration(),
conf,
)

@functools.cached_property
Expand All @@ -142,11 +146,3 @@ def video_raw_caps(self) -> str:
if nvidia_runtime_is_available()
else 'video/x-raw'
)

def fps_meter_properties(self, measurer_name: str):
props = {'output': self.fps_output, 'measurer-name': measurer_name}
if self.fps_period_seconds:
props['period-seconds'] = self.fps_period_seconds
else:
props['period-frames'] = self.fps_period_frames
return props
4 changes: 0 additions & 4 deletions adapters/ds/sinks/always_on_rtsp/input_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,6 @@ def build_input_pipeline(
'capsfilter',
properties={'caps': f'{config.video_raw_caps}, format=RGBA'},
),
PipelineElement(
'fps_meter',
properties=config.fps_meter_properties(f'Input {config.source_id}'),
),
]
if config.sync:
sink_elements.append(
Expand Down
4 changes: 0 additions & 4 deletions adapters/ds/sinks/always_on_rtsp/output_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ def build_output_pipeline(
]
+ build_encoder_elements(config)
+ [
PipelineElement(
'fps_meter',
properties=config.fps_meter_properties(f'Output {config.source_id}'),
),
PipelineElement(
'rtspclientsink',
properties={
Expand Down
4 changes: 3 additions & 1 deletion adapters/gst/gst_plugins/python/savant_parse_bin.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ def on_sink_pad_caps(self, pad: Gst.Pad, event: Gst.Event):
# sends full JPEG frames, not a continuous stream which requires parsing
# Jpegparse also does not parse well for 4K yuvj420p probably because of the limitations.
#
self.logger.debug('JPEG parsing is not required in the adapter. Using identity.')
self.logger.debug(
'JPEG parsing is not required in the adapter. Using identity.'
)
parser_name = 'identity'
self.logger.debug('Adding parser %r.', parser_name)
self._parser = Gst.ElementFactory.make(parser_name)
Expand Down
2 changes: 1 addition & 1 deletion scripts/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def build_common_envs(
source_id: Optional[str],
fps_period_frames: Optional[int],
fps_period_seconds: Optional[float],
fps_output: str,
fps_output: Optional[str],
zmq_endpoint: str,
zmq_type: Optional[str],
zmq_bind: Optional[bool],
Expand Down
14 changes: 11 additions & 3 deletions scripts/run_sink.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,16 @@ def video_files_sink(
help='Interval in milliseconds to poll statuses of the streams.',
show_default=True,
)
@fps_meter_options
@click.option(
'--fps-period-frames',
type=int,
help='FPS measurement period, in frames.',
)
@click.option(
'--fps-period-seconds',
type=int,
help='FPS measurement period, in seconds.',
)
@common_options
@adapter_docker_image_option('deepstream')
@click.argument('rtsp_uri', required=False)
Expand All @@ -470,7 +479,6 @@ def always_on_rtsp_sink(
framerate: str,
fps_period_frames: Optional[int],
fps_period_seconds: Optional[float],
fps_output: Optional[str],
metadata_output: Optional[str],
sync: bool,
dev_mode: bool,
Expand Down Expand Up @@ -517,7 +525,7 @@ def always_on_rtsp_sink(
source_id=source_id,
fps_period_frames=fps_period_frames,
fps_period_seconds=fps_period_seconds,
fps_output=fps_output,
fps_output=None,
zmq_endpoint=in_endpoint,
zmq_type=in_type,
zmq_bind=in_bind,
Expand Down

0 comments on commit 6d20a78

Please sign in to comment.