<div style="line-height:1.7;color:#000000;font-size:14px;font-family:arial">I think the code maybe looks like,<br><br>&nbsp;&nbsp;&nbsp;&nbsp; GstStateChangeReturn ret_get_state;<br>&nbsp;&nbsp;&nbsp;&nbsp; GstState state;<br><pre>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if&nbsp;(player-&gt;pipeline)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>            gst_element_set_state&nbsp;(player-&gt;pipeline, GST_STATE_NULL);<br>            while (ret_get_state = gst_element_get_state(bin, &amp;state, NULL, 1<br>                                        * GST_SECOND) != GST_STATE_CHANGE_FAILURE)<br>          {<br>                   if ( GST_STATE_NULL == state)<br>                  {<br>                          break;<br>                  }<br>          }<br>            <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g_object_unref&nbsp;(player-&gt;pipeline);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; player-&gt;pipeline&nbsp;=&nbsp;NULL;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br></pre><div></div><div id="divNeteaseMailCard"></div>At&nbsp;2011-12-28&nbsp;17:29:24,forestzhu&nbsp;&lt;forest0823@126.com&gt;&nbsp;wrote:
&gt;Hi&nbsp;all,
&gt;I&nbsp;met&nbsp;trouble&nbsp;in&nbsp;gsteamer&nbsp;program.
&gt;Sometimes&nbsp;the&nbsp;&nbsp;program&nbsp;will&nbsp;crash&nbsp;
&gt;when&nbsp;I&nbsp;use&nbsp;the&nbsp;"&nbsp;gst_element_set_state"&nbsp;to&nbsp;set&nbsp;the&nbsp;pipeline&nbsp;to&nbsp;NULL&nbsp;.
&gt;
&gt;my&nbsp;code&nbsp;likes&nbsp;below:
&gt;
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(player-&gt;pipeline)
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DEBUG_LOG("pipeline=&gt;%p&nbsp;...",player-&gt;pipeline);
&gt;while(GST_STATE_CHANGE_FAILURE&nbsp;==&nbsp;gst_element_set_state&nbsp;(player-&gt;pipeline,
&gt;GST_STATE_NULL))
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DEBUG_LOG("fail&nbsp;to&nbsp;change&nbsp;pipeline&nbsp;state...");
&gt;DEBUG_LOG("after&nbsp;set&nbsp;state");
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sleep(1);
&gt;
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;g_object_unref&nbsp;(player-&gt;pipeline);
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;player-&gt;pipeline&nbsp;=&nbsp;NULL;
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&gt;
&gt;I&nbsp;confirmed&nbsp;before&nbsp;set_state&nbsp;the&nbsp;player-&gt;pipeline&nbsp;'s&nbsp;mem_address&nbsp;is&nbsp;correct
&gt;.
&gt;And&nbsp;the&nbsp;&nbsp;"DEBUG_LOG("fail&nbsp;to&nbsp;change&nbsp;pipeline&nbsp;state...");"&nbsp;and
&gt;"DEBUG_LOG("after&nbsp;set&nbsp;state");"&nbsp;will&nbsp;not&nbsp;run.
&gt;
&gt;Anyone&nbsp;can&nbsp;give&nbsp;me&nbsp;some&nbsp;informations?
&gt;
&gt;Thanks&nbsp;for&nbsp;any&nbsp;hint!
&gt;
&gt;Regards!
&gt;
&gt;
&gt;forest
&gt;
&gt;
&gt;
&gt;
&gt;--
&gt;View&nbsp;this&nbsp;message&nbsp;in&nbsp;context:&nbsp;http://gstreamer-devel.966125.n4.nabble.com/The-problem-about-gst-element-set-state-tp4239421p4239421.html
&gt;Sent&nbsp;from&nbsp;the&nbsp;GStreamer-devel&nbsp;mailing&nbsp;list&nbsp;archive&nbsp;at&nbsp;Nabble.com.
&gt;_______________________________________________
&gt;gstreamer-devel&nbsp;mailing&nbsp;list
&gt;gstreamer-devel@lists.freedesktop.org
&gt;http://lists.freedesktop.org/mailman/listinfo/gstreamer-dev
</div><br><br><span title="neteasefooter"><span id="netease_mail_footer"></span></span>