<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    My guess is that you do NOT wait for a message to report that the
    state has actually changed.  Therefore, you unref the pipeline while
    the code is trying to change the state.  Poof!<br>
    <br>
    <div class="moz-cite-prefix">On 29/07/2013 15:47, Otwoh wrote:<br>
    </div>
    <blockquote cite="mid:1375109278456-4661329.post@n4.nabble.com"
      type="cite">
      <pre wrap="">Hello.

I have a C++ GStreamer application which record my webcam.

Here the Pipeline :

ksvideosrc --- queue2 --- ffmpegcolospace --- videorate ---ffenc_mjpeg ---
queue2
                                                                                                            
\
                                                                                                            
avimux --- filesrc
                                                                                                            
/
                              dshowaudiosrc --- audioconvert --- ffenc_aac
--- queue2


When I want to stop recording, I manually call  g_main_loop_quit
(main_loop);
Then, I clear objects:

g_main_loop_run(smp->main_loop);
gst_element_set_state (smp->pipeline, GST_STATE_NULL);
gst_object_unref (smp->pipeline);


It works very well when I use mjpeg encoder, or raw video.
But my application crash every times, when I use an encoder with prediction
(mpeg2, mpeg4, h264)
The crash is a Stack overflow and memory corrupted.

Plus, in spite of crashing, the video file is created and complete. It's
really weird...

How can I stop the capture cleanly ?



--
View this message in context: <a class="moz-txt-link-freetext" href="http://gstreamer-devel.966125.n4.nabble.com/Crash-when-closing-pipeline-tp4661329.html">http://gstreamer-devel.966125.n4.nabble.com/Crash-when-closing-pipeline-tp4661329.html</a>
Sent from the GStreamer-devel mailing list archive at Nabble.com.
_______________________________________________
gstreamer-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a>
<a class="moz-txt-link-freetext" href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a>

</pre>
    </blockquote>
    <br>
    <div class="moz-signature">-- <br>
      --<br>
      Ian Davidson<br>
      <i>239 Streetsbrook Road, Solihull, West Midlands, B91 1HE</i><br>
      --<br>
      Facts used in this message may or may not reflect an underlying
      objective reality. Facts are supplied for personal use only.<br>
      Recipients quoting supplied information do so at their own risk.
      Facts supplied may vary in whole or part from widely accepted
      standards.<br>
      While painstakingly researched, facts may or may not be indicative
      of actually occurring events or natural phenomena.<br>
      The author accepts no responsibility for personal loss or injury
      resulting from memorisation and subsequent use.
    </div>
  </body>
</html>