NVIDIA DeepStream SDK API Reference

9.1 Release
9.1/sources/gst-plugins/gst-nvmultistream2/gstnvtimesynch.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef __GST_NVTIMESYNC_H__
19 #define __GST_NVTIMESYNC_H__
20 
21 #include <gst/gst.h>
22 #include "nvstreammux.h"
23 #include "nvstreammux_batch.h"
24 #include "nvstreammux_pads.h"
25 #include <unordered_map>
26 #include <mutex>
27 
28 class NvTimeSync : public ISynchronizeBuffer
29 {
30 
31  public:
32  NvTimeSync(GstElement* el)
33  : plugin(el), pipelineLatency(0), upstreamLatency(0),
34  minFpsDuration(0),
35  segments(), mutex()
36  {}
37 
38 
40  void removing_old_buffer(BufferWrapper* buffer);
41 
54  void SetPipelineLatency(GstClockTime latency);
55 
60  void SetUpstreamLatency(GstClockTime latency);
61 
62  GstClockTime GetUpstreamLatency();
63 
64  GstClockTime GetCurrentRunningTime();
65 
66  void SetSegment(unsigned int stream_id, const GstSegment* segment);
67 
69 
71 
72 
73  uint64_t GetBufferRunningTime(uint64_t pts, unsigned int stream_id);
74 
75  private:
76  GstElement* plugin;
77  GstClockTime pipelineLatency;
78  GstClockTime upstreamLatency;
79  GstClockTime minFpsDuration;
80  GstClockTime bufferWasEarlyByTime;
81  std::unordered_map<unsigned int, GstSegment*> segments;
82  std::mutex mutex;
83 };
84 
85 
86 #endif
NvTimeSync::GetCurrentRunningTime
GstClockTime GetCurrentRunningTime()
NvTimeSync::get_buffer_earlyby_time
NanoSecondsType get_buffer_earlyby_time()
NvTimeSync::NvTimeSync
NvTimeSync(GstElement *el)
Definition: 9.1/sources/gst-plugins/gst-nvmultistream2/gstnvtimesynch.h:32
BufferWrapper
Definition: sources/libs/nvstreammux/include/nvstreammux_pads.h:97
BUFFER_TS_STATUS
BUFFER_TS_STATUS
Definition: sources/libs/nvstreammux/include/nvstreammux_pads.h:71
NvTimeSync::GetUpstreamLatency
GstClockTime GetUpstreamLatency()
NvTimeSync::removing_old_buffer
void removing_old_buffer(BufferWrapper *buffer)
NvTimeSync::get_synch_info
BUFFER_TS_STATUS get_synch_info(BufferWrapper *buffer)
NvTimeSync::SetOperatingMinFpsDuration
void SetOperatingMinFpsDuration(NanoSecondsType min_fps_dur)
NanoSecondsType
std::chrono::duration< double, std::nano > NanoSecondsType
Definition: sources/libs/nvstreammux/include/nvstreammux_pads.h:27
NvTimeSync::SetSegment
void SetSegment(unsigned int stream_id, const GstSegment *segment)
NvTimeSync::GetBufferRunningTime
uint64_t GetBufferRunningTime(uint64_t pts, unsigned int stream_id)
NvTimeSync::SetPipelineLatency
void SetPipelineLatency(GstClockTime latency)
Set the downstream latency Note: Currently the whole pipelineLatency value is used in timesynch logic...
NvTimeSync::SetUpstreamLatency
void SetUpstreamLatency(GstClockTime latency)
Set the upstream latency.
ISynchronizeBuffer
Definition: sources/libs/nvstreammux/include/nvstreammux_pads.h:347
NvTimeSync
Definition: sources/gst-plugins/gst-nvmultistream2/gstnvtimesynch.h:28