[gst-devel] CPU usage 100% in fakesrc example from manual

Riccardo Corona coronariccardo at gmail.com
Wed Jun 6 10:14:18 CEST 2007


Hi,
I've inserted the

gst_base_src_set_format((GstBaseSrc*)fakesrc,GST_FORMAT_TIME);

after creation  of the fakesrc element, and tried to make some timestamp
issue in the callback:


static void
cb_handoff (GstElement *fakesrc,
        GstBuffer  *buffer,
        GstPad     *pad,
        gpointer    user_data)
{
    static gboolean white = FALSE;

    GTimeVal gtime;
    g_get_current_time(&gtime);

    GstClockTime gstClock=GST_TIMEVAL_TO_TIME(gtime);

    buffer->timestamp=gstClock;

    memset (GST_BUFFER_DATA (buffer), white ? 0xff : 0x0,
      GST_BUFFER_SIZE (buffer));
    white = !white;

}

But the problems persists, there isn't a 1fps as set in the caps and cpu is
still 100%.
I can't understand how create a timestamp incremented 1 second by one with
Glib, is there a way to do this?
I wish to improve this example and then submit it the a future development
of the manual.

Thank's for any help.

Regards.


2007/6/5, Tim Muller <t.i.m at zen.co.uk>:
>
> Riccardo Corona <coronariccardo at gmail.com> wrote :
>
> > Hi,I've tried the fakesrc example from
>
> http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/section-data-spoof.html
> > it works well and display black & white images but it also
> > use all the cpu.Is there a way to avoid this
> > behaviour?
>
> Two problems here:
>
> (a) fakesrc will send a newsegment event in BYTES format,
>      not TIME format (which you could probably work around
>      by using gst_base_src_set_format() after creating the
>      fakesrc element (needs linking against libgstbase-0.10).
>
> (b) the example doesn't set timestamps on the buffers it
>      pushes out in the handoff callback.
>
> Probably not really a very good example :)
>
> Cheers
> -Tim
>
>
>
>
>
>


-- 
Riccardo Corona
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20070606/c0be07ed/attachment.htm>


More information about the gstreamer-devel mailing list