<div dir="auto"><div dir="auto">Thanks a lot! </div><div dir="auto">I'm gonna do more investigation with your advice.</div><div dir="auto"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">2021년 8월 27일 (금) 오전 5:03, Nicolas Dufresne <<a href="mailto:nicolas@ndufresne.ca" target="_blank" rel="noreferrer">nicolas@ndufresne.ca</a>>님이 작성:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Le vendredi 27 août 2021 à 03:32 +0900, 이병헌 a écrit :<br>
> Thanks for your wonderful answer<br>
> <br>
> Now I can understand about qurstion #2 and I will do more investigation on #3 as<br>
> you said.<br>
> But I still can't understand concept of running-time and segment you said.<br>
> <br>
> Before all, I would explain my problem again.<br>
> I need common absolute clock between many rtsp cameras to compare consistence of<br>
> each buffers from those cameras.<br>
> I will compare those buffers to know which buffers are recored at the same time.<br>
> This mean I need to get absolute recoded time from rtsp packets.<br>
> So I wanna know whether it possible or not<br>
> And If possible then how<br>
> <br>
> First, after I get your answer, I tried to read gstreamer document about segment<br>
> and running time.<br>
> In my understand, segment is a bundle of data that composed of buffers.<br>
> And buffer running time is relative timescale between buffers to play on right<br>
> time.<br>
> And segment event is event to set segment start and rate and some more of stream<br>
> inform <br>
> <br>
> So I have more questions here<br>
> <br>
> 1. can you explain more about segment, segment event and running time with<br>
> specific example?<br>
<br>
<a href="https://gstreamer.freedesktop.org/documentation/plugin-development/advanced/clock.html?gi-language=c#clock-runningtime" rel="noreferrer noreferrer noreferrer" target="_blank">https://gstreamer.freedesktop.org/documentation/plugin-development/advanced/clock.html?gi-language=c#clock-runningtime</a><br>
<br>
As you are targeting RTP, you might need to learn how to enable RFC7273 to get<br>
more accurate reconstruction of the remote clock and timestamps (I don't myself<br>
know how to use this). But as soon as you got this right, there should be no<br>
difference, and running-time becomes the canonical timescale to compare<br>
timestamp against each other.<br>
<br>
<br>
> 2. If I don't use any segment event while stream, then PTS of buffer is always<br>
> same as running time? <br>
<br>
This is quite possible that your segment are start=0 without any offset, but I<br>
would not rely on this, as not using a segment in one element/decoder other is<br>
no an API. If we have a good reason to modify the segment later on, your<br>
application will break and it will be application fault.<br>
<br>
> <br>
> Sorry for being dumb..<br>
> <br>
> Thanks <br>
> <br>
> <br>
> <br>
> <br>
> <br>
> <br>
> 2021년 8월 26일 (목) 오후 10:46, Nicolas Dufresne <<a href="mailto:nicolas@ndufresne.ca" rel="noreferrer noreferrer" target="_blank">nicolas@ndufresne.ca</a>>님이 작성:<br>
> > Le jeudi 26 août 2021 à 18:45 +0900, 이병헌 via gstreamer-devel a écrit :<br>
> > > Hi, I’m new on gstreamer now<br>
> > > And my first language is not an English<br>
> > > So if my questions are not good to be understood I would say sorry first..<br>
> > > <br>
> > > Anyway now I’m trying to make application that need function of<br>
> > > synchronize<br>
> > > buffers between multiple pipeline<br>
> > > So I’m trying to sync those buffers by Lockstep method with their<br>
> > > timestamp<br>
> > > value in those buffers<br>
> > > But there have three problem<br>
> > > <br>
> > > This is my pipeline blueprint<br>
> > > <br>
> > > rtspsrc ! h265depay ! av_dech265 ! videoscale ! videoconvert ! caps-filter<br>
> > > !<br>
> > > queue ! videoscale ! tensor_converter ! tensor_filter ! tensor_sink —— get<br>
> > > buffer from sink by callback and put buffers to — > Ring buffer - - \<br>
> > > ! rtspsrc ! h265depay ! av_dech265 ! videoscale ! videoconvert ! caps-<br>
> > > filter<br>
> > !<br>
> > > queue ! videoscale ! tensor_converter ! tensor_filter ! tensor_sink —— get<br>
> > > buffer from sink by callback and put buffers to — > Ring buffer —- - ><br>
> > > lockstep sync —> some association logics ...<br>
> > > ! rtspsrc ! h265depayl ! av_dech265 ! videoscale ! videoconvert ! caps-<br>
> > filter<br>
> > > ! queue ! videoscale ! tensor_converter ! tensor_filter ! tensor_sink ——<br>
> > > get<br>
> > > buffer from sink by callback and put buffers to — > Ring buffer —/<br>
> > >  <br>
> > > First , PTS is not wall clock time or ntp time<br>
> > > Second, DTS value is always -1<br>
> > > Third, when I check pts values at source element, pts values are always<br>
> > > increment. But when I check my ring buffer element, some value of pts are<br>
> > > decrease between adjacent buffer, this mean order of input buffer can be<br>
> > > shuffled while streaming<br>
> > > <br>
> > > So.. my questions are these<br>
> > > <br>
> > > 1. How to get wall clock PTS value from rtsp packets in gstreamer?<br>
> > <br>
> > In GStreamer we have the concept of "running-time", this is the timescale<br>
> > you<br>
> > must use to compare GST_BUFFER_DTS_OR_PTS() (that macro takes care of<br>
> > picking<br>
> > the right TS) against each other.<br>
> > <br>
> > In order to get running-time from a buffer PTS, you have to track the<br>
> > GstSegment<br>
> > that is propagated using the GST_EVENT_SEGMENT. You can then convert using<br>
> > gst_segment_to_running_time() or gst_segment_to_running_time_full(). The<br>
> > full<br>
> > version supports negative running time, this might not be needed for your<br>
> > use<br>
> > case.<br>
> > <br>
> > > 2. Meaning of DTS value -1<br>
> > <br>
> > DTS stands for decoting timestamp. In your example, you are dealing with raw<br>
> > data, so decoding does not make sense, so that TS is set to<br>
> > GST_CLOCK_TIME_INVALID. It's not really -1, since this is unsigned integer.<br>
> > <br>
> > Note that DTS is optional, it is mostly useful for streams were the decoding<br>
> > order differ from the presentation order, or when there is a delay (like in<br>
> > opus) with some initial data that should be skipped.<br>
> > <br>
> > > 3. Is it possible to get different order of buffer from input buffer order<br>
> > at<br>
> > > some elements in pipeline? If can, then do I have to sort those buffers<br>
> > > with<br>
> > > their timestamp with some priority queue rather than ring buffer ?<br>
> > <br>
> > In your case, it looks like getting backward timestamp is a bug. Could be on<br>
> > the<br>
> > RTSP server side, this requires deep investigation to figure-out.<br>
> > <br>
> > > <br>
> > > Sorry for writing that hard to understand <br>
> > > and I would give more inform if it is not enough to answer<br>
> > > <br>
> > > Thanks<br>
> > <br>
> > <br>
<br>
<br>
</blockquote></div></div>