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

Federico Zamperini fzamperini at tiscali.it
Wed Feb 6 14:09:08 PST 2013


Can you be more precise in describing your tests?
When you say that you close the stream src for testing do you mean that 
you shut down the rtsp server (transmitter) or the src element on the 
receiver side?
If you shut down and then restart the transmitter the session src of the 
rtp stream changes and the receiver gets an error.
In this case you should stop the receiver (set pipeline state to NULL) 
on EOS and then (try to) restart (set pipeline state to PLAYING).
On the other hand, if you disconnect the transmitter and reconnect it 
(without stopping it) before getting an EOS, the rtspsrc (receiver side) 
resumes receiving data autonomously as soon as the transmitter is 
reconnected.

Federico

Il 06/02/2013 19:10, enthusiastic geek ha scritto:
> I am trying to resume rtsp stream using EOS in bus message event handler and
> a re connection timer. I close the stream src deliberately for testing. Then
> I resume the stream. During reconnection attempt despite stream being active
> I get the following message "Error: Could not read from resource.". My code
> snippet looks as follows:
>
> Message bus event handler
>
> // This function is used to receive asynchronous messages in the main loop.
> bool Video::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->pauseStream(index);
>          //this->stopStream(index);
>          //mainloop->quit();
> 		return true;
>          //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->pauseStream(index);
>          //this->stopStream(index);
>          //mainloop->quit();
>          return true;
>          //return false;
>      }
>      default:
>          break;
>      }
>
>      return true;
> }
>
>
> And my re-connection timer callback function looks like
>
> bool timeoutCallback(Video* test)
> {
>
>
>      std::cout << "Checking for the stream connection ..." << std::endl;
>      for (uint32_t stream_count = 0; stream_count < TOTAL_STREAMS;
> stream_count++)
>      {
>          std::cout << "Stream " << stream_count << " is "<<
> (test->getStreamStatus(stream_count)? "active": "inactive") << std::endl;
>
>          if (test->getStreamStatus(stream_count)==false)
>          {
> 			test->playStream(stream_count);
>          }
>
>      }
>
>      return true;
> }
>
>
> And my helper functions look as follows
>
> void Video::startStream(uint32_t index)
> {
>      app->loop_[index]->run();
> }
>
> void Video::stopStream(uint32_t index)
> {
>      this->pauseStream(index);
> 	if(this->getState(index) != Gst::STATE_NULL){
>      	app->pipeline_[index]->set_state(Gst::STATE_NULL);
> 	}
> }
>
> void Video::pauseStream(uint32_t index)
> {
> 	if(this->getState(index) != Gst::STATE_PAUSED){
>      	app->pipeline_[index]->set_state(Gst::STATE_PAUSED);
> 	}
> 	if(this->getState(index) != Gst::STATE_READY){
>      	app->pipeline_[index]->set_state(Gst::STATE_READY);
> 	}
> }
>
> void Video::resumeStream(uint32_t index)
> {
> 	if(this->getState(index) != Gst::STATE_READY){
>      	app->pipeline_[index]->set_state(Gst::STATE_READY);
> 	}
> 	if(this->getState(index) != Gst::STATE_PAUSED){
>      	app->pipeline_[index]->set_state(Gst::STATE_PAUSED);
> 	}
> }
>
> void Video::playStream(uint32_t index)
> {
>      this->resumeStream(index);
> 	if(this->getState(index) != Gst::STATE_PLAYING){
>      	app->pipeline_[index]->set_state(Gst::STATE_PLAYING);
> 	}
> }
>
>
>
>
> --
> 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-tp4658402.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
>
>
> -----
> Nessun virus nel messaggio.
> Controllato da AVG - www.avg.com
> Versione: 2013.0.2897 / Database dei virus: 2639/6084 -  Data di rilascio: 05/02/2013
>
>


More information about the gstreamer-devel mailing list