Administrator
|
///// -------------- PIPELINE ------------- ///////////// / - - q3
- - - - q1 - - - rtph264depay - - - - h264parse - - - - vtee - - \ / - - q5 source -- - - q4 \ - - - - q2 - - - rtpmp4gdepay - - - aacparse - - - faad - - - atee - -/ \ - - q6 FakeSinkBin: q5 - - fakesink q6 - - fakesink2 Record bin: q4 - - \ avimux - - appsink q3- - - / The Methods Using: _videoD->BlockVideoPad is vtee _videoD->BlockAudioPad is atee I call StopRecordPipeline function then goes through each method below that. I can't figure out is there something in the methods calling the probes I need to do? void PipelineClass::StopRecordPipeline(gpointer user_data) { GstPad* sinkpad; std::cout << "Checked video and audio pad" << std::endl; //Block Audio Pad std::cout << std::endl << "Blocking Audio" << std::endl; _videoD->aID = gst_pad_add_probe (_videoD->BlockAudioPad, GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM ,RtspBlock1, user_data, NULL); std::cout << "ID: " << _videoD->aID << std::endl; } GstPadProbeReturn PipelineClass::RtspBlock1 (GstPad * pad, GstPadProbeInfo * info, gpointer user_data) { GstPad* srcpad; GST_DEBUG_OBJECT (pad, "pad is blocked now"); g_print("\nBlocked Now\n"); /* remove the probe first */ //gst_pad_remove_probe (pad, GST_PAD_PROBE_INFO_ID (info)); _videoD->vID = gst_pad_add_probe(_videoD->BlockVideoPad, GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM, RtspBlock2, user_data, NULL); std::cout << "ID: " << _videoD->vID << std::endl; return GST_PAD_PROBE_OK; } GstPadProbeReturn PipelineClass::RtspBlock2 (GstPad * pad, GstPadProbeInfo * info, gpointer user_data) { GstPad* sinkpad; GST_DEBUG_OBJECT (pad, "pad is blocked now"); g_print("\nBlocked Now\n"); /* remove the probe first */ //gst_pad_remove_probe (pad, GST_PAD_PROBE_INFO_ID (info)); //install new probe for EOS sinkpad = gst_element_get_static_pad (_videoD->appsink, "sink"); _videoD->eosID = gst_pad_add_probe (sinkpad, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM, RtspEventProbe, user_data, NULL); gst_object_unref (sinkpad); // push EOS into the element, the probe will be fired when the // EOS leaves the effect and it has thus drained all of its data gst_element_send_event(_videoD->Rec,gst_event_new_eos()); return GST_PAD_PROBE_OK; } GstPadProbeReturn PipelineClass::RtspEventProbe (GstPad * pad, GstPadProbeInfo * info, gpointer user_data) { if (GST_EVENT_TYPE (GST_PAD_PROBE_INFO_DATA (info)) != GST_EVENT_EOS) return GST_PAD_PROBE_PASS; if(!_videoD->isBlocked) return GST_PAD_PROBE_REMOVE; GstElement* valve1,* valve2; gst_pad_remove_probe (pad, GST_PAD_PROBE_INFO_ID (info)); std::cout << std::endl << "Got Eos and Restarting Recording" << std::endl; ClosingFile(_gstVideoStruct); ResetGstVideoStruct(_gstVideoStruct); AccessToVideoClass->UnlinkRecPipeline(); std::cout << "\nSetting up appsink signals\n"; g_signal_connect(_videoD->appsink, "new-sample", G_CALLBACK(appsink_ToFile),_videoD); g_signal_connect(_videoD->appsink, "eos", G_CALLBACK(check_for_eos),_videoD); return GST_PAD_PROBE_DROP; } void VideoRecClass::UnlinkRecPipeline() { // remove on two pads and release on the vtee and atee. // Each element in the Rec bin to null and remove from pipeline ...... SetupRtspRecPipeline(); gst_pad_remove_probe(_videoData->BlockAudioPad,_videoData->aID); gst_pad_remove_probe(_videoData->BlockVideoPad,_videoData->vID); LinkRtspRecPipeline(); _videoData->aID = 0; _videoData->vID = 0; ...... }
------------------------------
Gstreamer 1.16.2 ------------------------------ Windows |
Administrator
|
Figured out how to unblock it. The Only problem is that it won't have the video written to the file. It has the Audio but not the Video. Any Idea? I extracted the header and it says there is plenty enough of video frames.
The Link below is a testing project that has all in one functions instead of a bunch of headers. So the methods below are similar to the Gstreamer project. Gstreamer Project ///// ---------------------------- METHODS ------------------------------- ///////// GstPadProbeReturn PipelineClass::RtspEventProbe (GstPad * pad, GstPadProbeInfo * info, gpointer user_data); GstPadProbeReturn PipelineClass::cb_block (GstPad * pad, GstPadProbeInfo * info, gpointer user_data); GstPadProbeReturn PipelineClass::RtspEventProbe (GstPad * pad, GstPadProbeInfo * info, gpointer user_data) { if (GST_EVENT_TYPE (GST_PAD_PROBE_INFO_DATA (info)) != GST_EVENT_EOS) return GST_PAD_PROBE_PASS; GstElement* valve1,* valve2; gboolean ret = FALSE; GstEvent* flush_stop; gst_pad_remove_probe (pad, GST_PAD_PROBE_INFO_ID (info)); std::cout << std::endl << "Got Eos and Restarting Recording" << std::endl; \/-------------------- Important Area --------------------------\/ UnlinkRecPipeline(); gst_pad_remove_probe(_videoD->BlockAudioPad,_videoD->aID); gst_pad_remove_probe(_videoD->BlockVideoPad,_videoD->vID); isBlocked = FALSE; cb_block method is below: gst_pad_add_probe (_videoD->BlockAudioPad, GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM ,cb_block, user_data, NULL); gst_pad_add_probe (_videoD->BlockVideoPad, GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM ,cb_block, user_data, NULL); LinkRtspRecPipeline(); /\-------------------- Important Area --------------------------/\ std::cout << "\nRecord to Playing Check"; AccessToVideoClass->CheckStateChange(gst_element_set_state (_videoD->Rec, GST_STATE_PLAYING)); std::cout << std::endl; std::cout << "\nSetting up appsink signals\n"; g_signal_connect(_videoD->appsink, "new-sample", G_CALLBACK(appsink_ToFile),_videoD); g_signal_connect(_videoD->appsink, "eos", G_CALLBACK(check_for_eos),_videoD); return GST_PAD_PROBE_DROP; } GstPadProbeReturn PipelineClass::cb_block (GstPad * pad, GstPadProbeInfo * info, gpointer user_data) { do{ if(!_videoD->isBlocked) { g_print("\nUnblocking\n"); return GST_PAD_PROBE_REMOVE; } }while(_videoD->isBlocked); }
------------------------------
Gstreamer 1.16.2 ------------------------------ Windows |
Free forum by Nabble | Edit this page |