Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. GStreamer - How to interrupt a video stream programmaticaly?
Forum Updated to NodeBB v4.3 + New Features

GStreamer - How to interrupt a video stream programmaticaly?

Scheduled Pinned Locked Moved Unsolved 3rd Party Software
3 Posts 2 Posters 2.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • X Offline
    X Offline
    xrodpim
    wrote on last edited by
    #1

    Hi.

    I have a RTSP server (implemented with GStreamer) that works as a video stream server for a client implemented with Qt5GStreamer.
    This rtsp server accepts up to 3 client sessions simultaneously. So, 3 clients can receive a video stream simultaneously. In this case, if a 4th client tries to see the video, the stream will not be available, wich is obvious.

    However, even if one running client stops the video (ex: close the windows that shows the video), the 4th client remains incapable of seeing the video, because the stream continue unavailable, wich is an error. The problem here is the client that maybe has some error that prevent it to interrupt the video and free the session in a correct way. The client is using a gstreamer pipeline to receive the stream.

    So, I suspect that my Qt code needs some fix. See the code that I use when the client close the video:

    if( _pipeline ){
        _pipeline->setState(QGst::StateNull);
        _pipeline.clear();
    }
    

    Now, see the code that creates the pipeline, please:

        _pipeline = QGst::Pipeline::create();
    
        rtspsrc = QGst::ElementFactory::make("rtspsrc");
        rtspsrc->setProperty("location",uri);
        rtspsrc->setProperty("do-rtcp",false);
        rtspsrc->setProperty("buffer-mode",1);
        _pipeline->add(rtspsrc);
    
        /* SURFACE */
        videoSink = _surface->videoSink();
        videoSink->setProperty("sync",false);
        _pipeline->add(videoSink);
    
        /* SIGNALS */
    
        // prepare bus to listen
        _pipeline->bus()->addSignalWatch();
        // watch for the receiving side src pads
        QGlib::connect(rtspsrc, "pad-added", this, &CameraControl::onRtpBinPadAdded);
        QGlib::connect(rtspsrc, "select-stream", this, &CameraControl::onSelectStream);
        QGlib::connect(_pipeline->bus(), "message::error", this, &CameraControl::onBusErrorMessage);
    
        /* ALL READY */
    
        /* Play */
        _pipeline->setState(QGst::StatePlaying);
    

    What is wrong in my code? Is there something more I must put in my code to free the client session in the gstreamer?
    If everything is ok with my code, could it be a issue in the GSTreamer version being used?

    Any hint will be very helpful!

    Best regards.

    Rodrigo Pimenta Carvalho.

    X 1 Reply Last reply
    0
    • X xrodpim

      Hi.

      I have a RTSP server (implemented with GStreamer) that works as a video stream server for a client implemented with Qt5GStreamer.
      This rtsp server accepts up to 3 client sessions simultaneously. So, 3 clients can receive a video stream simultaneously. In this case, if a 4th client tries to see the video, the stream will not be available, wich is obvious.

      However, even if one running client stops the video (ex: close the windows that shows the video), the 4th client remains incapable of seeing the video, because the stream continue unavailable, wich is an error. The problem here is the client that maybe has some error that prevent it to interrupt the video and free the session in a correct way. The client is using a gstreamer pipeline to receive the stream.

      So, I suspect that my Qt code needs some fix. See the code that I use when the client close the video:

      if( _pipeline ){
          _pipeline->setState(QGst::StateNull);
          _pipeline.clear();
      }
      

      Now, see the code that creates the pipeline, please:

          _pipeline = QGst::Pipeline::create();
      
          rtspsrc = QGst::ElementFactory::make("rtspsrc");
          rtspsrc->setProperty("location",uri);
          rtspsrc->setProperty("do-rtcp",false);
          rtspsrc->setProperty("buffer-mode",1);
          _pipeline->add(rtspsrc);
      
          /* SURFACE */
          videoSink = _surface->videoSink();
          videoSink->setProperty("sync",false);
          _pipeline->add(videoSink);
      
          /* SIGNALS */
      
          // prepare bus to listen
          _pipeline->bus()->addSignalWatch();
          // watch for the receiving side src pads
          QGlib::connect(rtspsrc, "pad-added", this, &CameraControl::onRtpBinPadAdded);
          QGlib::connect(rtspsrc, "select-stream", this, &CameraControl::onSelectStream);
          QGlib::connect(_pipeline->bus(), "message::error", this, &CameraControl::onBusErrorMessage);
      
          /* ALL READY */
      
          /* Play */
          _pipeline->setState(QGst::StatePlaying);
      

      What is wrong in my code? Is there something more I must put in my code to free the client session in the gstreamer?
      If everything is ok with my code, could it be a issue in the GSTreamer version being used?

      Any hint will be very helpful!

      Best regards.

      Rodrigo Pimenta Carvalho.

      X Offline
      X Offline
      xrodpim
      wrote on last edited by
      #2

      Sorry, the complete code for pipeline creation is:

         _pipeline = QGst::Pipeline::create();
          rtspsrc = QGst::ElementFactory::make("rtspsrc");
          /* Configuring */
      
          /* RTSPSRC */
          rtspsrc->setProperty("location",uri);
          rtspsrc->setProperty("do-rtcp",false);
          rtspsrc->setProperty("buffer-mode",1);
          _pipeline->add(rtspsrc);
      
          /* SURFACE */
          videoSink = _surface->videoSink();
          videoSink->setProperty("sync",false);
          _pipeline->add(videoSink);
      
          /* SIGNALS */
      
          // prepare bus to listen
          _pipeline->bus()->addSignalWatch();
          // watch for the receiving side src pads
          QGlib::connect(rtspsrc, "pad-added", this, &CameraControl::onRtpBinPadAdded);
          QGlib::connect(rtspsrc, "select-stream", this, &CameraControl::onSelectStream);
          QGlib::connect(_pipeline->bus(), "message::error", this, &CameraControl::onBusErrorMessage);
      
          /* ALL READY */
      
          /* Play */
          _pipeline->setState(QGst::StatePlaying);
      
      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        The QtGStreamer module is not part of the Qt project, you should as the author of the module.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved