RTSP url can't display stream, even when mainloop is running.

hhony hanshony at gmail.com
Fri Mar 2 18:36:07 UTC 2018


Rhythm, I didn't claim it was perfect code.. just example code. :) Exiting
the interpreter would garbage collect those objects.. however, fair point
about 'mainloop.quit()'.

So, when I worked with RTSP last it was in C++.. not python.. but the
mapping looks the same:
https://lazka.github.io/pgi-docs/GstRtspServer-1.0/mapping.html

If I understand you correctly, you're saying 'MainLoop.get_context()' isn't
working for you? Or you seem to think you need MainContext before you
construct the MainLoop.. I don't follow your MainContext statement.. but
it's described here:
https://lazka.github.io/pgi-docs/GLib-2.0/classes/MainLoop.html

To do what you're proposing - I assume it would be similar to:

import gi
gi.require_version('Gst', '1.0')
gi.require_version('GstRtspServer', '1.0')
from gi.repository import GLib, Gst, GstRtspServer
from threading import Thread

mainloop = GLib.MainLoop()
Gst.init(None)

loop_thread = Thread(target=mainloop.run, args=())
loop_thread.start()

print('mainloop is running ', mainloop.is_running())

# can't you just attach it? - work for me.
rtsp = GstRtspServer.RTSPServer.new()
id = rtsp.attach(mainloop.get_context())

# this should return an ID higher than '0'
print('MainContext id: ', id)

.. other things here ..

loop_thread.stop()
exit()




--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/


More information about the gstreamer-devel mailing list