Resuming rtsp stream on receiving EOS signal on message bus using re-connection timer

Federico Zamperini fzamperini at tiscali.it
Thu Feb 7 07:32:11 PST 2013


Glad it works; for posterity's sake I just say that I'm quite sure I 
don't reinitialize the pipeline, just stop/start it (I don't have my 
code at hand right now).
BTW, when you say you reinitialize the pipeline you mean you destroy it 
and then recreate it?

Il 07/02/2013 16:22, enthusiastic geek ha scritto:
> Hi Federico,
>                   Thanks a lot for your reply. I got it to work! Here are the
> few changes that I did to the code.
>
> // This function is used to receive asynchronous messages in the main loop.
> bool VideoBroadcast::on_bus_message(const Glib::RefPtr<Gst::Bus>& bus,
>                                      const Glib::RefPtr<Gst::Message>&
> message,
>                                      Glib::RefPtr<Glib::MainLoop> mainloop,
>                                      uint32_t index)
> {
>      switch (message->get_message_type()) {
>      case Gst::MESSAGE_EOS:
>      {
>          std::cout << std::endl << "End of stream" << std::endl;
>          this->setStreamStatus(index, false); // Set the stream status to
> inactive
>          this->stopStream(index);
>          //mainloop->quit(); //Don't Quit Main Loop yet. Move this to clean
> up routine.
>          return false;
>      }
>      case Gst::MESSAGE_ERROR:
>      {
>          Glib::RefPtr<Gst::MessageError> msgError =
>              Glib::RefPtr<Gst::MessageError>::cast_dynamic(message);
>
>          if (msgError)
>          {
>              Glib::Error err;
>              err = msgError->parse();
>              std::cerr << "Error: " << err.what() << std::endl;
>          } else {
>              std::cerr << "Error." << std::endl;
>          }
>          this->setStreamStatus(index, false); // Set the stream status to
> inactive
>          this->stopStream(index);
>          //mainloop->quit(); //mainloop->quit(); //Don't Quit Main Loop yet.
> Move this to clean up routine.
>          return false;
>      }
>      default:
>          break;
>      }
>
>      return true;
> }
>
>
> As you can see I am not quitting the main loop
>
>
> bool timeoutCallback(VideoBroadcast* test)
> {
>      std::cout << "Checking for the stream connection ..." << std::endl;
>      for (uint32_t index = 0; index < TOTAL_STREAMS; index++)
>      {
>          std::cout << "Stream " << index << " is "<<
> (test->getStreamStatus(index)? "active": "inactive") << std::endl;
>          if (test->getStreamStatus(index)==false)
>          {
>              test->initializeStreamData(index); // No need to create mainloop
> in this method again.
>                                                              // Mainloop is
> created in the constructor
>              if (test->getState(index) == Gst::STATE_PLAYING)
>              {
>                  test->setStreamStatus(index, true);
>              }
>          }
>      }
>      return true;
> }
>
>
> Since I didn't quit the mainloop, there was no need to recreate it, but I
> had to reinitialize the pipeline with bins since I am using the following
> API. Not sure if it has to do anything with it.
>
> app->pipeline_[index] = Glib::RefPtr<Gst::Pipeline>::cast_dynamic(
> Gst::Parse::launch(app->launch_string_[index]) );
>
>
> I avoided reinitializing bins and waited for 5 minutes or so and the
> pipeline wouldn't come up. That is when I decided to reinitialize (barring
> creating the loop since I never quit it) and test the behavior.
>
>
>
> --
> View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Resuming-rtsp-stream-on-receiving-EOS-signal-on-message-bus-using-re-connection-timer-tp4658402p4658418.html
> Sent from the GStreamer-devel mailing list archive at Nabble.com.
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>


More information about the gstreamer-devel mailing list