Administrator
|
This post was updated on .
Well, as it often is with such things, this one was my fault. What i thought was the pipeline not getting EOS was actually Qt hiding the behavior of the program and making it look like the pipeline was misbehaving.
So, note to anyone using an appsink and gst_app_sink_pull_buffer() -- and of course you know this but I didn't think of it days....
The buffer pointer returned by gst_app_sink_pull_buffer()
can be NULL! Not checking for NULL leads to all sorts of seg faults if you
try using the buffer pointer.
I kept getting inside my appsink is not EOS loop but when I'd drqw the buffer it would be null. The first NULl just happened to show up with the EOS and trying to use buf* got me a seg fault which Qt announced with "The program ended unexpectedly." How do you spell euphemism?
One remaining item:
I'm still not 100% certain my bus watcher for EOS is getting fired off. However, since the appsink takes longer than the filesink (I think/hope) I can depend on it detecting the EOS. Any thoughts anyone?
************************************************************
************************************************************
In the gst_parse_launch()ed pipeline below, I want the real frames to flow into the videosink and the buffer info to be processed in the appsink loop. I need to add other info at the appsink for some of the frames.
I am not getting any EOS to flow into the appsink tee. The program seems to stall in the loop that watches for the EOS in the appsink.
NOTE: If the tee is after the matroskamux, the pipeline won't play, state change rc = 2.
I attach to the bus to check for EOS and call a callback that should shutdown the pipeline. With no tee this callback works great.
i poll the output of appsink looking for EOS.
Neither poll nor callback gets an EOS.
/*--- build the pipeline ---*/
this->pipeline = gst_parse_launch(
"souphttpsrc name=my_src "
"! multipartdemux name=my_demux "
"! image/jpeg,width=640,height=480 "
"! tee name=t t. "
"! queue name=my_queue1 "
"! matroskamux name=my_mux "
"! filesink name=my_sink t. "
"! queue name=my_queue2 "
"! appsink name=my_appsink ",
&error );
/* ... */
appsink = gst_bin_get_by_name (GST_BIN( this->pipeline), "my_appsink" );
/*--- setup bus and message handling ---*/
bus = gst_pipeline_get_bus( GST_PIPELINE( this->pipeline ));
gst_bus_add_signal_watch_full( bus, G_PRIORITY_HIGH );
g_signal_connect(
bus,
"message::eos",
(GCallback)eos_message_received,
this );
gst_object_unref( GST_OBJECT(bus) );
/* start playback */
gst_element_set_state( this->pipeline, GST_STATE_PLAYING );
while ( !gst_app_sink_is_eos( GST_APP_SINK( appsink )))
{
GstBuffer *buf (0);
buf = gst_app_sink_pull_buffer( GST_APP_SINK( appsink ));
/* write various data to file(s) --- THIS IS THE BUG, check buf for NULL */
gst_buffer_unref( buf );
}
g_main_loop_run( this->loop );
/* ... */
After a few seconds, an EOS is injected by an external (thread) timer that uses:
gst_element_send_event( this->pipeline, gst_event_new_eos() );
NEXT QUESTION WILL BE: can I know the appsink and filesink are synched?
Thanks for any help.
Wes
|
Free forum by Nabble | Edit this page |