Timestamp problem...

Eric Trousset etrousset at awox.com
Wed Nov 27 02:50:46 PST 2013


Hi,

Yes my element is in a pipeline.

What I do is that  I create mySrcElement, the videomixer and the autovideosink in a GstBin. Link them together.

Then I create a pipeline, add the bin to the pipeline, and then set the pipeline to GST_STATE_PLAYING.

This should display the image I generate in my src, (caps are "video/x-raw, width=640, height=400, format=ARGB");
The first one is displayed, but then when I update my resource and unblock my create function, it seems the image is droped.

If I add a pad to the bin and link it to the videomixer, and set the bin as a video-sink of my playbin, then the pipeline doesn't play, (only the first frame is displayed, and we can ear about 1sec of sound)
But if I remove, my src element, the media plays fine.

So it looks like I do something wrong in my srcElement, but can't figure out what? 

In my src alement :
- in _init() I set the format to GST_FORMAT_TIME, and set do_timestamp to TRUE,
- in set_property() when I get my resource, I set the blocksize to the width * height * 4, and set the call gst_base_src_set_caps with a new caps
- in _dispose(), I release my resource
- in get_caps() I return the current caps of my resource
- in create() : wait for my resource to update, allocate the buffer, fill the buffer, try to timestamp it like this :
		GST_BUFFER_PTS(*buf) = GST_ELEMENT_CLOCK(src)?gst_clock_get_time(GST_ELEMENT_CLOCK(src)) - gst_element_get_base_time(GST_ELEMENT(src)) : 0;

Am I missing some important point here?

Regars,
Eric T.




> -----Original Message-----
> From: Sebastian Dröge [mailto:sebastian at centricular.com]
> Sent: mercredi 27 novembre 2013 10:57
> To: Discussion of the development of and with GStreamer
> Subject: Re: Timestamp problem...
> 
> On Mi, 2013-11-27 at 10:32 +0100, Eric Trousset wrote:
> > Hi,
> > It looks like my source element never gets a clock, nor is its base_time set.
> >
> > Should I provide the clock myself (maybe when receiving the new_clock
> message on the bus)?
> 
> No, GstPipeline and GstBin does all that for you in theory. Is your element
> inside a GstPipeline, and you set the complete pipeline to PLAYING state?
> 
> You'll receive the new-clock message on the bus after the pipeline has
> decided on a clock. If you get that message, you should have a clock in your
> element.
> 
> > Where would it be best to save the base_time? I tried in the start method
> but it seems the pipeline clock can change afterward.
> 
> You should get the base_time immediately before using it in calculations, it
> could change. Same goes for the clock.
> 
> --
> Sebastian Dröge <sebastian at centricular.com> Centricular Ltd -
> http://www.centricular.com Expertise, Straight from the Source


More information about the gstreamer-devel mailing list