Hi Michael,
Thanks for your response. I used your advice and made some changes to the code but to no avail. I am making sure that I do not invoke this code twice. Also there is a check for the current state to not be NULL before calling this API. The code still gets stuck at "gst_element_set_state". Please find the code below : gst_element_get_state (m_ppipeline, &m_state,NULL,GST_CLOCK_TIME_NONE ); if (m_state == GST_STATE_PLAYING) { cout<<"Entering aaOutputEncode::stopRecording"<<endl; if (!m_ppipeline || !m_pencoder) ORIGINATE_ERROR("Video encoder not initialized"); if (m_state != GST_STATE_PLAYING) ORIGINATE_ERROR("Video encoder not recording"); cout<<"Calling gst_element_get_static_pad"<<endl; // Send the end-of-stream event. GstPad *pad = gst_element_get_static_pad(m_pencoder, "sink"); if (!pad) ORIGINATE_ERROR("Failed to get 'sink' pad"); cout<<"Calling gst_pad_send_event"<<endl; bool result = gst_pad_send_event(pad, gst_event_new_eos()); cout<<"Calling gst_object_unref"<<endl; gst_object_unref(pad); if (!result) ORIGINATE_ERROR("Failed to send end of stream event to encoder"); cout<<"Calling gst_pipeline_get_bus"<<endl; // Wait for the event to complete. GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(m_ppipeline)); if (!bus) ORIGINATE_ERROR("Failed to get bus"); cout<<"Calling gst_bus_poll"<<endl; result = gst_bus_poll(bus, GST_MESSAGE_EOS, GST_CLOCK_TIME_NONE); cout<<"Calling gst_object_unref"<<endl; gst_object_unref(bus); if (!result) ORIGINATE_ERROR("Failed to wait for the EOF event"); if(m_state != GST_STATE_NULL) { cout<<"Calling gst_element_set_state"<<endl; // Stop the pipeline. if (gst_element_set_state(m_ppipeline, GST_STATE_NULL) == GST_STATE_CHANGE_FAILURE) ORIGINATE_ERROR("Failed to stop recording."); } m_state = GST_STATE_NULL; cout<<"Exiting aaOutputEncode::stopRecording"<<endl; } if (m_ppipeline) gst_object_unref(GST_OBJECT(m_ppipeline)); m_ppipeline = NULL; -- Sent from: http://gstreamer-devel.966125.n4.nabble.com/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |