Skip to content

Commit

Permalink
Fix RTSP source adapter (#98)
Browse files Browse the repository at this point in the history
* Filter caps on RTSP source adapters
* Filter out non-IDR frames at the start of the stream
  • Loading branch information
tomskikh authored Mar 23, 2023
1 parent 13549c8 commit e180010
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions adapters/gst/sources/rtsp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ trap handler SIGINT SIGTERM
gst-launch-1.0 --eos-on-shutdown \
rtspsrc protocols=tcp location="${RTSP_URI}" ! \
parsebin ! \
'video/x-h264,stream-format=byte-stream,alignment=au;video/x-h265,stream-format=byte-stream,alignment=au' ! \
fps_meter "${FPS_PERIOD}" output="${FPS_OUTPUT}" ! \
video_to_avro_serializer source-id="${SOURCE_ID}" ! \
zeromq_sink socket="${ZMQ_ENDPOINT}" socket-type="${ZMQ_SOCKET_TYPE}" bind="${ZMQ_SOCKET_BIND}" sync="${SYNC_OUTPUT}" source-id="${SOURCE_ID}" \
Expand Down
8 changes: 8 additions & 0 deletions savant/gst_plugins/python/avro_video_demux.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,14 @@ def handle_video_frame(self, message: Dict, buffer: Gst.Buffer) -> Gst.FlowRetur
source_id,
)
return Gst.FlowReturn.OK
if not message['keyframe']:
self.logger.warning(
'Frame %s from source %s is not a keyframe, skipping it. '
'Stream should start with a keyframe.',
frame_pts,
source_id,
)
return Gst.FlowReturn.OK
source_info = SourceInfo(source_id, frame_params)
self.sources[source_id] = source_info
source_info.timestamp = time.time()
Expand Down

0 comments on commit e180010

Please sign in to comment.