<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Jun 17, 2015 at 12:53 AM, Peter Körner <span dir="ltr"><<a href="mailto:osm-lists@mazdermind.de" target="_blank">osm-lists@mazdermind.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
Have you thought about implementing a custom GstClock subclass and<br>
provide your clocking that way? alsasink does that for example.<br>
<br>
Regarding your buffer Timestamps - and not being an expert in this - did<br>
you send a correct Segment-Event before starting to push buffers?<br>
<br>
See<br>
<<a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/section-clock-obligations-of-each-element.html" rel="noreferrer" target="_blank">http://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/section-clock-obligations-of-each-element.html</a>><br>
<br>
Regards, Peter<br></blockquote><div><br></div><div><br>Thank you for the pointer.  It is possible I am not doing this correctly:<br> <br><div class=""><div><div><h3 class="">Live source elements </h3></div></div></div><p>
        Live source elements must place a timestamp in each buffer that
        they deliver. They must choose the timestamps and the values of the
        SEGMENT event in such a way that the running-time of the buffer
        matches exactly the running-time of the pipeline clock when the first 
        byte in the buffer was captured. <br></p><p><br></p><p></p><p>Do you know of an example which implements that?</p><p>Thanks,</p><p></p><p>John<br></p><p><br></p></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div><div class="h5"><br>
<br>
On 17.06.2015 00:08, John P Poet wrote:<br>
> Hi all,<br>
><br>
> I am fairly new to gstreamer so I apologize for being clueless.  I have<br>
> tried to figure this out myself, but am just spinning my wheels at this<br>
> point.<br>
><br>
> I am working on writing a src plugin for the Euresys Picolo H.264 cards:<br>
> <a href="http://www.euresys.com/Products/picolo/PicoloH264series.asp" rel="noreferrer" target="_blank">http://www.euresys.com/Products/picolo/PicoloH264series.asp</a><br>
> which has an on-board 90KHz clock.<br>
><br>
> I decided to use Slomo's work on the decklink src as a template:<br>
> <a href="https://coaxion.net/blog/2014/12/improved-gstreamer-support-for-blackmagic-decklink-cards/" rel="noreferrer" target="_blank">https://coaxion.net/blog/2014/12/improved-gstreamer-support-for-blackmagic-decklink-cards/</a><br>
> and I generally have it working.  Except for the clock.<br>
><br>
> If I don't set the timestamp for the buffer at all, then it it seems to<br>
> work.  However if I include the line:<br>
><br>
> GST_BUFFER_TIMESTAMP (*buffer) = timestamp;<br>
><br>
> in my gst_picoloh264_video_src_create() and<br>
> gst_picoloh264_audio_src_create() routines then I run into trouble.<br>
><br>
> The timestamp coming from the Picolo H.264 is running at 90KHz.  I can<br>
> convert that to nanoseconds using:<br>
><br>
> time_stamp = gst_util_uint64_scale_int(time_stamp, 1000000, 90);<br>
><br>
> but that leads to my first question:  Should I be using<br>
> gst_clock_set_calibration() and gst_clock_get_calibration() somehow to<br>
> achieve this instead?<br>
><br>
> Video and Audio are read completely independently from each other and my<br>
> gstpicoloh264videosrc and gstpicoloh264videosrc work independently just<br>
> fine.  Like I said, I used Slomo's decklinksrc as a template, and the<br>
> only major change was to allow the audiosrc to be the master clock, if<br>
> the videosrc is not part of the pipeline.<br>
><br>
> I run into a problem, though, if both the audio and video are part of<br>
> the pipeline.<br>
><br>
> This works:<br>
> gst-launch-1.0 picoloh264videosrc location="/mnt/picolo_u16" connector=0<br>
> ! h264parse ! mux. mpegtsmux name=mux ! filesink location=picolo.ts<br>
><br>
> This works:<br>
> gst-launch-1.0 picoloh264audiosrc location="/mnt/picolo_u16" connector=0<br>
> ! audioconvert ! lamemp3enc ! queue ! mux. mpegtsmux name=mux ! filesink<br>
> location=picolo.ts<br>
><br>
> If I set the timestamp of each buffer, then this does not work:<br>
> gst-launch-1.0 picoloh264videosrc location="/mnt/picolo_u16" connector=0<br>
> ! h264parse ! queue ! mux. picoloh264audiosrc location="/mnt/picolo_u16"<br>
> connector=0 ! audioconvert ! lamemp3enc ! queue ! mux. mpegtsmux<br>
> name=mux ! filesink location=picolo.ts<br>
><br>
> The resulting file has video but no audio.  Looking at the logging,<br>
> picoloh264audiosrc generates about 8 packets and then stalls.  It looks<br>
> like those packets are making it to lamemp3enc but no further.<br>
><br>
> I discovered, that if I force the timestamps to start at zero that it<br>
> seems to solve the problem.  Doing something like:<br>
> timestamp -= self->input->clock_start_time;<br>
> results in perfect audio/video in the resulting transport stream -- for<br>
> a while.  After many hours, problems with the audio muxing re-appear.<br>
> That simple subtraction of the start_time does not deal with the<br>
> on-board clock wrapping to zero, so that may be the issue and I will<br>
> look into that.<br>
><br>
> However, I can't but help feel that I am doing something wrong.  Since<br>
> this is a 'live' source, why do I even need to force the timestamps to<br>
> start at zero?<br>
><br>
> Any help increasing my understanding of how this stuff works would be<br>
> greatly appreciated.<br>
><br>
> John<br>
><br>
><br>
><br>
><br>
</div></div>> _______________________________________________<br>
> gstreamer-devel mailing list<br>
> <a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" rel="noreferrer" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
><br>
<br>
<br>_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" rel="noreferrer" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
<br></blockquote></div><br></div></div>