Flush RTSP pipeline

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Flush RTSP pipeline

allopez
Hello everyone,

I am using the next pipeline to connect to a IP camera, which sends
MJPEG video through it:

rtspsrc name=rtspsrc ! queue ! rtpjpegdepay ! ffdec_mjpeg ! xvimagesink
name=videosink

e.g. URI = rtsp://192.168.0.25/live.sdp

I would like to know how to flush correctly the pipeline when I get the
end-of-stream message in the GstBus (GST_MESSAGE_EOS).

Currently, I set the pipeline to NULL and open it again:

gst_element_set_state (gstPipeline, GST_STATE_NULL);
gst_object_unref(gstPipeline);

[...]

gstPipeline = gst_pipeline_new (NULL);
gstPipeline = gst_parse_launch(m_sGstLaunch,&error);

The main problem is the IP camera is also closing more connections I
need to work when I do this.

Thanks in advance,

Alvaro


______________________
This message including any attachments may contain confidential
information, according to our Information Security Management System,
 and intended solely for a specific individual to whom they are addressed.
 Any unauthorised copy, disclosure or distribution of this message
 is strictly forbidden. If you have received this transmission in error,
 please notify the sender immediately and delete it.

______________________
Este mensaje, y en su caso, cualquier fichero anexo al mismo,
 puede contener informacion clasificada por su emisor como confidencial
 en el marco de su Sistema de Gestion de Seguridad de la
Informacion siendo para uso exclusivo del destinatario, quedando
prohibida su divulgacion copia o distribucion a terceros sin la
autorizacion expresa del remitente. Si Vd. ha recibido este mensaje
 erroneamente, se ruega lo notifique al remitente y proceda a su borrado.
Gracias por su colaboracion.

______________________

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Flush RTSP pipeline

allopez
This post was updated on .
Hi,

I discovered I could flush the pipeline using:

gst_element_seek(pipeline,1.0, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH,GST_SEEK_TYPE_SET, 0, GST_SEEK_TYPE_NONE, 0);

As I am using some cameras, I perform the seek before moving from GST_STATE_PAUSED to GST_STATE_PLAYING states. I am not receiving the GST_MESSAGE_EOS now.

Also, I divided the pipeline bus processing into some callbacks:

gst_bus_add_signal_watch(bus);
g_signal_connect(bus, "message::state-changed", G_CALLBACK(gst_state_changed_cb), this);
g_signal_connect(bus, "message::element", G_CALLBACK(gst_element_cb), this);
g_signal_connect(bus, "message::error", G_CALLBACK(gst_error_cb), this);
g_signal_connect(bus, "message::eos", G_CALLBACK(gst_eos_cb), this);
gst_object_unref (bus);

This way I can perform another flush in the pipeline when I get the GST_MESSAGE_STATE_CHANGED in the pipeline object when it moves from GST_STATE_PLAYING to GST_STATE_PAUSED. In this case, the transition between playing one camera to another is quite perfect. Furthermore, I have detected some strange effects I don´t know how to solve if the stream is played at 640x360:

1º/ If I move from one camera to another I get the CPU working nearly at 100% in a random time. Also, the application uses too much memory. Maybe memory leaks in gst_element_seek ???

2º/ Sometimes the seek ends in a complete lock of my application --> Backtrace:

#0  0xb6cdcc14 in __lll_lock_wait () from /lib/libpthread.so.0
#1  0xb6cd81bd in _L_lock_748 () from /lib/libpthread.so.0
#2  0xb6cd7fe1 in pthread_mutex_lock () from /lib/libpthread.so.0
#3  0xb6e8883e in g_static_rec_mutex_lock () from /lib/libglib-2.0.so.0
#4  0xb676a337 in gst_rtspsrc_perform_seek (pad=0xb41df10c, event=0x1164ab50) at gstrtspsrc.c:1865
#5  gst_rtspsrc_handle_src_event (pad=0xb41df10c, event=0x1164ab50) at gstrtspsrc.c:1987
#6  0xb70c6b72 in gst_pad_send_event (pad=0x824d540, event=0x1164ab50) at gstpad.c:5425
#7  0xb70c71ee in gst_pad_push_event (pad=0x823fb28, event=0x1164ab50) at gstpad.c:5277
#8  0xb66a157f in gst_queue_handle_src_event (pad=0xb41dfd80, event=0x1164ab50) at gstqueue.c:1313
#9  0xb70c6b72 in gst_pad_send_event (pad=0xb41dfd80, event=0x1164ab50) at gstpad.c:5425
#10 0xb70c71ee in gst_pad_push_event (pad=0x823f808, event=0x1164ab50) at gstpad.c:5277
#11 0xb70c7892 in gst_pad_event_default_dispatch (pad=0x823fd80, event=0x1164ab50) at gstpad.c:3586
#12 gst_pad_event_default (pad=0x823fd80, event=0x1164ab50) at gstpad.c:3663
#13 0xb70c6b72 in gst_pad_send_event (pad=0x823fd80, event=0x1164ab50) at gstpad.c:5425
#14 0xb70c71ee in gst_pad_push_event (pad=0x823fcb8, event=0x1164ab50) at gstpad.c:5277
#15 0xb5b37545 in gst_ffmpegdec_src_event (pad=0x823fbf0, event=0x1164ab50) at gstffmpegdec.c:559
#16 0xb70c6b72 in gst_pad_send_event (pad=0x823fbf0, event=0x1164ab50) at gstpad.c:5425
#17 0xb70c71ee in gst_pad_push_event (pad=0xb41dfbf0, event=0x1164ab50) at gstpad.c:5277
#18 0xb67166bb in gst_base_sink_send_event (element=0xb4123be8, event=0x1164ab50) at gstbasesink.c:4526
#19 0xb70a621e in gst_element_send_event (element=0xb4123be8, event=0x1164ab50) at gstelement.c:1667
#20 0xb7092928 in gst_bin_send_event (element=0xb41ddc88, event=0x1164ab50) at gstbin.c:2703
#21 0xb70a621e in gst_element_send_event (element=0xb41ddc88, event=0x1164ab50) at gstelement.c:1667
#22 0xb70a6337 in gst_element_seek (element=0xb41ddc88, rate=1, format=GST_FORMAT_TIME, flags=GST_SEEK_FLAG_FLUSH, cur_type=GST_SEEK_TYPE_SET, cur=0,
    stop_type=GST_SEEK_TYPE_NONE, stop=0) at gstelement.c:1707

What could I do to solve these problems ???

Thanks in advance