not as clever as I hoped :-(

James jam at tigger.ws
Tue Aug 10 14:00:54 UTC 2021


> I took much of my stuff from basic_tutorial12.c so playing with it here:
> 
> when I run tutorial and send it SIGTERM the handler is immediatly invoked.
> yet is never set
> EOS is not sent (explicity, but happens)
> 
> If I let the clip play to the end then EOS message and yet is set.
> 
> What am I missing, in particular I want to send eos on SIGTERM
> 
> volatile int yet = 0;
> GstElement *pipeline;
> 
> void handler (int signum)
> {
>  g_print ("[handler function] send eos] %d\n", gst_element_send_event (pipeline, gst_event_new_eos ()));
>  while (!(yet)) {
>      g_print ("%d\n", yet);
>      g_usleep (100000);
>  }
>  g_print ("exit\n");
>  exit (0);
> }
> 
> 
> and
> 
> case GST_MESSAGE_EOS:
>    /* end-of-stream */
>    gst_element_set_state (data->pipeline, GST_STATE_READY);
>    g_main_loop_quit (data->loop);
>  yet = 1;
>  g_print (“\nEOS\n");
>    break;
> 
> 
> In case it is interesting here are traces:
> 
> --------------------------------
> tutorial run to end:
> ————————————————
> 
> jam at ws101:~> ./basic
> Buffering (100%)
> EOS
> 
> ————————————————
> tutorial gets SIGTERM
> ————————————————
> 
> jam at ws101:~> ./basic
> [handler function] send eos] 1
> 0
> 0
> 0
> forever
> playback STOPS but yet is never set


OK delving down a bit:

gst_element_send_event (pipeline, gst_event_new_eos ()));

does not trigger a cb.
The whole cb structure is complete and does work: tut12 to end generates a cb message for eos, but not on SIGTERM.
A EOS IS generated if I wait a while (no EOS results in no mov atom in mp4s so having one is easy to spot)
James
PS the src for gst-launch does not seem to do any more than me.



More information about the gstreamer-devel mailing list