GNOME Bugzilla – Bug 779484
rtsp: Allow pipelines to be shared between media
Last modified: 2018-11-03 15:41:14 UTC
In order to build videocompositor/mosaic RTSP server, I subclassed RTSPMediaFactory to create my own elements directly. Each RTSPMedia created by the factory is in the same pipeline (so they can mux together). But RTSPMedia does not allow you to share pipelines between Media elements, because as part of the preparation process it prerolls the pipeline: it sets the pipeline state to pause and then it listens for confirmation that it transitioned from ready -> pause before activating everything. But if you are sharing a pipeline between RTSPMedia it will already be in state playing most of the time, and new medias that share the pipeline will not get prepared correctly. My solution is to make the preroll method overridable. I wanted some feedback on this before I continue...
Created attachment 347086 [details] [review] Allow override of preroll
Created attachment 347193 [details] [review] Add setting to indicate pipeline is shared; Media do not manipulate state of shared-pipelines I like this approach better although the change is more drastic. There is a new setting, 'shared-pipeline', that tells the media not to manipulate the pipeline's state nor rely on the pipeline's state changes (e.g., in handle_message) for its own internal state. This allows different media to share a live pipeline. In order for this to work correctly, the media needs to manipulate the state of its rtpbin and the various elements added by the stream, which would otherwise have inherited the state changes from the pipeline. To keep the code simple, these elements are added to the bin the user provides (i.e., the media's element) rather than adding them to the pipeline. Then simply changing the bin's state keeps everything in sync. I also fixed what I think was a bug in `gst_rtsp_media_unprepare`, where the media would never be unprepared if it was in the suspend state, but going into the suspend state is a normal part of disposing of the media.
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/issues/33.