[gst-devel] Fakesrc signal handoff question

Tim Muller t.i.m at zen.co.uk
Wed May 30 10:54:25 CEST 2007


Riccardo Corona <coronariccardo at gmail.com> wrote :

Hi,

> Hi,during my test with gstreamer app for win32 I've used a fakesrc with
> an handoff function in which I obtain some mpeg4 fragment that is put into
> a gstbuffer. I've also used the right plugin to visualize the mpeg4 packet
> on my directdraw sink.

Some more details about the pipeline used would probably be helpful.


> It works weel only for the first 2-3 packets received and then the refresh
> of the images stops and, if I run in debug mode, I can see that some thread
> stop its execution but there isn't gstreamer thread. This is main part of
> may handoff:

> static void
> cb_handoff (GstElement *fakesrc, GstBuffer  *buffer, GstPad *pad,
>     gpointer user_data)
> {
>   MyClass* dlg=(MyClass*)user_data;
>
>  //fg_image is the object that contains the correct (I've checked it...)
>  //mpeg4 fragment
>  //dt contains the time of the fragment
>  //dlg->t is a struct tm that allows to obtain time_t
>  ...
>  buffer->timestamp = mktime(&dlg->t);//GST_CLOCK_TIME_NONE;

The timestamps you're creating, are they 0-based? (there may also be problems
due to fakesrc sending a newsegment event in BYTES format, but the videosink
expecting a TIME format, so it depends on your pipeline setup if there's an
element that converts it to TIME Format or not).

> //fg_image->pixel_ptr contains the mpeg4 image buffer
> gst_buffer_set_data(buffer,fg_image->pixel_ptr,fg_image->dimension);

Have you tried memcpy()'ing the data first, to make sure the data you're
passing is not invalidated while it makes its way through the pipeline?
Maybe something like (this assumes you're getting passed empty buffers, which
may not be the case if you've set certain fakesrc properties):

  GST_BUFFER_MALLOCDATA(buffer) =
      g_memdup (fg_image->pixel_ptr,fg_image->dimension);
  GST_BUFFER_DATA(buffer) = GST_BUFFER_MALLOCDATA(buffer);
  GST_BUFFER_SIZE(buffer) = fg_image->dimension;


In case it's your handoff callback that stops being called, run your program with

  GST_DEBUG=basesrc:5 yourapp

(or whatever the way to set an environment variable is on win32) to see why it stops/pauses (see 'flow' or 'reason').

 Cheers
  -Tim









More information about the gstreamer-devel mailing list