I want to reconnect the camera after it is disconnected.
When all video sources are disconnected, the bus will receive Gst.MessageType.EOS message.
According to reference code in deepstream_rt_src_add_del.py,I modify add_source function, delete the video source then adding it.
When executing, the bus receives Gst.MessageType.QOS message. At the same time, the pipeline is in a waiting state.
I think buffer resources are released during EOS.
What should I do?
def add_sources():
eos_loc = [i for i, d in enumerate(g_eos_list) if d is True]
for source_id in range(number_sources):
if g_eos_list[source_id]:
if g_source_enabled[source_id]:
# Delete
g_source_enabled[source_id] = False
stop_release_source(source_id)
print('Delete source %d' % source_id)
# Add
uri_name = video_sources[source_id]
source_bin = create_uridecode_bin(source_id, uri_name)
if not source_bin:
sys.stderr.write("Failed to create source bin. Exiting.")
exit(1)
# Add source bin to our list and to pipeline
g_source_bin_list[source_id] = source_bin
g_source_bin_list[source_id].set_state(Gst.State.PAUSED)
pipeline.add(source_bin)
print('Add source %d' % source_id)
pipeline.set_state(Gst.State.PLAYING)
return True
when all sources are disconnected, bus get Gst.MessageType.EOS.
Re add the source, can not get frame. Because bus get Gst.MessageType.QOS.
One all sources are disconnected, the whole pipeline state should be changed to NULL, and restart from the beginning. You can not add source back before the pipeline restart.