Audio-Video Sync for Transport Stream Files

ktg ktg.andr at
Tue Apr 23 06:57:34 PDT 2013

Hello All,
I am a newbie to GStreamer.
I am writing an application to play a TS File

I am facing a problem in setting the timestamp.

I am getting the timestamp from the stream and I am trying to set the same
timestamp for the pipeline.
pipeline_set_clock() is returning TRUE

But when I query the current time,  I am getting values like, 1, 2, 3 etc
but not the new time

Here is my code snippet:

// Element creation
audSrc   = gst_element_factory_make("appsrc", "file-source");

// Pushing the buffer and setting the timestamp
GST_BUFFER_TIMESTAMP(audioBuffer) = TimeStamp_FromStream in nanoseconds;
gst_app_src_push_buffer (GST_APP_SRC (audSrc), audioBuffer);

// Setting the pipeline clock
//When I receive the first Audio buffer, I am setting the same timestamp to
GstClock* audioclock = gst_element_provide_clock(audSrc);
gboolean bRet = gst_pipeline_set_clock(GST_PIPELINE(gstPipeline),

bRet is returning TRUE

// Retrieving the clock
GstClock* localClock =  gst_pipeline_get_clock(GST_PIPELINE(gstPipeline)); 
GstClockTime curClock = gst_clock_get_time(localClock);

At this point, curClock -- always returns 1/2/3 but not the timestamp of the

I googled about setting the clock to pipeline but couldnt really get any

Please let me know, how can I set the clock to pipeline?
Thanks in advance..

View this message in context:
Sent from the GStreamer-devel mailing list archive at

More information about the gstreamer-devel mailing list