<html><head><style type="text/css">.style1 {font-family: "Times New Roman";}</style></head><body>Hi Nicolas,<BR>
<BR>
thanks for your response.<BR>
<BR>
unfortunately the states "null" and "ready" didn't solve the problem. I also tried to completely re-initialize the pipeline and faced very a strange behavior. When I unref my pipeline and do the re-init afterwards, I can see the old frames. But when I do not unref the pipeline but simply "override" my references, only the new frames are displayed (as desired).<BR>
<BR>
I've attached my simplified source code below, maybe you see what's wrong. Case (1) shows the working code (even if it leaks) case (2) does not work.<BR>
<BR>
void Streamer::init()<BR>
{<BR>
auto pipeline = gst_pipeline_new( "pipeline" );<BR>
auto src = gst_element_factory_make( "udpsrc", "source" );<BR>
auto depay = gst_element_factory_make( "rtph264depay", "depay" );<BR>
auto dec = gst_element_factory_make( "avdec_h264", "dec" );<BR>
auto convert = gst_element_factory_make( "videoconvert", "convert" );<BR>
auto upload = gst_element_factory_make( "glupload", "upload" );<BR>
auto sink = gst_element_factory_make( "appsink", "sink" );<BR>
<BR>
gst_app_sink_set_drop( sink, true );<BR>
gst_app_sink_set_max_buffers( sink, 1 );<BR>
gst_app_sink_set_emit_signals( sink, true );<BR>
<BR>
GstAppSinkCallbacks callbacks = { nullptr, newPreroll, newSample, nullptr };<BR>
gst_app_sink_set_callbacks( m_data->sink, &callbacks, this, nullptr );<BR>
<BR>
gst_bin_add_many( GST_BIN( pipeline), src, depay, dec, convert, upload, sink, NULL );<BR>
<BR>
if( !gst_element_link_many( src, depay, dec, convert, NULL ) ) { return nullptr; }<BR>
<BR>
GstCaps* caps = gst_caps_from_string( "video/x-raw, format=BGR" );<BR>
<BR>
if( !gst_element_link_filtered( convert, upload, caps ) ) { return nullptr; }<BR>
<BR>
if( !gst_element_link( upload, sink ) { return nullptr; }<BR>
<BR>
// Do further config ...<BR>
<BR>
// Inject gl context<BR>
<BR>
m_pipeline = pipeline;<BR>
<BR>
gst_element_set_state( m_pipeline, GST_STATE_PLAYING );<BR>
}<BR>
<BR>
void Streamer::restart()<BR>
{<BR>
// Working (1)<BR>
gst_element_set_state( m_pipeline, GST_STATE_NULL );<BR>
init();<BR>
<BR>
// Not working (2)<BR>
gst_element_set_state( m_pipeline, GST_STATE_NULL );<BR>
gst_unref_object(m_pipeline);<BR>
init();<BR>
}<BR>
<BR>
Is it sufficient to call gst_unref_object ( m_pipeline ) in order to completely free all sources, or is it necessary to unref all elements added to the pipeline manually? I'm not completely sure about this point.<BR>
<BR>
As you can see above, I'm using static names for the GstElements added to the pipeline. In the doc it says that if no name is given, a unique name is generated. Is the name used internally for any referencing or sth like that?<BR>
<BR>
I really thought, that if I create a new pipeline no frames will be buffered at all.<BR>
<BR>
Thanks in advance<BR>
Michael<BR>
<BR>
<BR>
-----Ursprüngliche Nachricht-----<BR>
Von: gstreamer-devel [mailto:gstreamer-devel-bounces@lists.freedesktop.org] Im Auftrag von Nicolas Dufresne<BR>
Gesendet: Freitag, 4. September 2020 23:42<BR>
An: Discussion of the development of and with GStreamer <gstreamer-devel@lists.freedesktop.org><BR>
Betreff: [External] Re: Restarted stream contains legacy frames<BR>
<BR>
Le vendredi 04 septembre 2020 à 10:18 +0000, Timtchenko, Michael a écrit :<BR>
> Hi gstreamers,<BR>
><BR>
> i’m facing a little problem regarding the stopping/resuming of my<BR>
> camera stream with gstreamer. When I restart the stream by a<BR>
> transition from GST_STATE_PLAYING (1) -> GST_STATE_PAUSING (2)<BR>
> ->GST_STATE_ PLAYING (3), the stream contains the last frames from<BR>
> (1).<BR>
><BR>
> Is there a proper way to clear the pipeline? I don’t want to see any<BR>
> old frames when I restart my stream.<BR>
<BR>
Pause state is not often used for live pipelines, it will just block the rendering. Best is to cycle through NULL, or perhaps ready.<BR>
<BR>
><BR>
> I’ve also tried to send flushing events, but without success. I did<BR>
> this by sending the events gst_event_new_flush_start() and<BR>
> gst_event_new_flush_stop().<BR>
><BR>
> My pipeline looks like this:<BR>
><BR>
> udpsrc port=55555 caps=\"application/x-rtp, media=(string)video,<BR>
> clock-rate=(int)90000, encoding-name=(string)H264, payload=(int)96\"<BR>
<BR>
It might be wise to use rtpjitterbuffer here.<BR>
<BR>
> ! rtph264depay<BR>
> ! avdec_h264<BR>
> ! decodebin<BR>
> ! videoconvert<BR>
> ! glupload<BR>
> ! appsink<BR>
><BR>
> Advice is welcome.<BR>
><BR>
> BR<BR>
> Michael<BR>
><BR>
><BR>
> Bitte beachten / Please note!<BR>
><BR>
> *********************************************************************<BR>
> **********<BR>
> AGCO GmbH<BR>
> Sitz der AGCO GmbH: Johann-Georg-Fendt-Str.4, 87616 Marktoberdorf,<BR>
> Germany Registergericht Amtsgericht Kempten HRB 10327<BR>
> Geschäftsführer: Christoph Groeblinghoff, Ingrid Bussjaeger-Martin,<BR>
> Dr. Heribert Reiter, Ekkehart Glaeser Vorsitzender des Aufsichtsrates:<BR>
> Torsten Dehner<BR>
><BR>
> *********************************************************************<BR>
> **********<BR>
> Diese E-Mail ist nur für den Empfänger bestimmt, an den es gerichtet<BR>
> ist und kann vertrauliches bzw. unter das Berufsgeheimnis fallendes<BR>
> Material enthalten. Jegliche darin enthaltene Ansicht oder<BR>
> Meinungsäußerung ist die des Autors und stellt nicht notwendigerweise<BR>
> die Ansicht oder Meinung von AGCO dar. Sind Sie nicht der Empfänger,<BR>
> so haben Sie diese E-Mail irrtümlich erhalten und jegliche Verwendung,<BR>
> Veröffentlichung, Weiterleitung, Abschrift oder jeglicher Druck dieser<BR>
> E-Mail ist strengstens untersagt. Weder AGCO noch der Absender<BR>
> übernehmen die Haftung für Viren; es obliegt Ihrer Verantwortung, die<BR>
> E-Mail und deren angehängte Dateien (sofern vorhanden) auf Viren zu<BR>
> überprüfen.<BR>
><BR>
> *********************************************************************<BR>
> **********<BR>
> This email is intended solely for the use of the individual to whom it<BR>
> is addressed and may contain confidential and/or privileged material.<BR>
> Any views or opinions presented are solely those of the author and do<BR>
> not necessarily represent those of AGCO. If you are not the intended<BR>
> recipient, be advised that you have received this email in error and<BR>
> that any use, dissemination, forwarding, printing or copying of this<BR>
> email is strictly prohibited. Neither AGCO nor the sender accepts any<BR>
> responsibility for viruses and it is your responsibility to scan and<BR>
> virus check the email and its<BR>
> attachment(s) (if any).<BR>
><BR>
> *********************************************************************<BR>
> **********<BR>
><BR>
> This email is intended solely for the use of the individual to whom it<BR>
> is addressed and may contain confidential and/or privileged material.<BR>
> Any views or opinions presented are solely those of the author and do<BR>
> not necessarily represent those of AGCO. If you are not the intended<BR>
> recipient, be advised that you have received this email in error and<BR>
> that any use, dissemination, forwarding, printing or copying of this<BR>
> email is strictly prohibited. Neither AGCO nor the sender accepts any<BR>
> responsibility for viruses and it is your responsibility to scan and<BR>
> virus check the e-mail and its<BR>
> attachment(s) (if any).<BR>
><BR>
><BR>
><BR>
><BR>
> _______________________________________________<BR>
> gstreamer-devel mailing list<BR>
> <a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><BR>
> <a href="https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><BR>
<BR>
_______________________________________________<BR>
gstreamer-devel mailing list<BR>
<a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><BR>
<a href="https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><BR>
<BR>
This email is intended solely for the use of the individual to whom it is addressed and may contain confidential and/or privileged material. Any views or opinions presented are solely those of the author and do not necessarily represent those of AGCO. If you are not the intended recipient, be advised that you have received this email in error and that any use, dissemination, forwarding, printing or copying of this email is strictly prohibited. Neither AGCO nor the sender accepts any responsibility for viruses and it is your responsibility to scan and virus check the e-mail and its attachment(s) (if any).<BR>
<BR>
This email is intended solely for the use of the individual to whom it is addressed and may contain confidential and/or privileged material. Any views or opinions presented are solely those of the author and do not necessarily represent those of AGCO. If you are not the intended recipient, be advised that you have received this email in error and that any use, dissemination, forwarding, printing or copying of this email is strictly prohibited. Neither AGCO nor the sender accepts any responsibility for viruses and it is your responsibility to scan and virus check the e-mail and its attachment(s) (if any).<BR>
<br><br><p style="font-family: Verdana; font-size:10pt; color:#666666;"><b> </b></p><p style="font-family: Verdana; font-size:8pt; color:#666666;"><br><br> </p></body></html>