NVIDIA DeepStream SDK API Reference

6.4 Release
gstnvtimesynch.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2021-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: MIT
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in
13  * all copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21  * DEALINGS IN THE SOFTWARE.
22  */
23 
24 #ifndef __GST_NVTIMESYNC_H__
25 #define __GST_NVTIMESYNC_H__
26 
27 #include <gst/gst.h>
28 #include "nvstreammux.h"
29 #include "nvstreammux_batch.h"
30 #include "nvstreammux_pads.h"
31 #include <unordered_map>
32 #include <mutex>
33 
35 {
36 
37  public:
38  NvTimeSync(GstElement* el)
39  : plugin(el), pipelineLatency(0), upstreamLatency(0),
40  minFpsDuration(0),
41  segments(), mutex()
42  {}
43 
44 
46  void removing_old_buffer(BufferWrapper* buffer);
47 
60  void SetPipelineLatency(GstClockTime latency);
61 
66  void SetUpstreamLatency(GstClockTime latency);
67 
68  GstClockTime GetUpstreamLatency();
69 
70  GstClockTime GetCurrentRunningTime();
71 
72  void SetSegment(unsigned int stream_id, const GstSegment* segment);
73 
75 
77 
78 
79  uint64_t GetBufferRunningTime(uint64_t pts, unsigned int stream_id);
80 
81  private:
82  GstElement* plugin;
83  GstClockTime pipelineLatency;
84  GstClockTime upstreamLatency;
85  GstClockTime minFpsDuration;
86  GstClockTime bufferWasEarlyByTime;
87  std::unordered_map<unsigned int, GstSegment*> segments;
88  std::mutex mutex;
89 };
90 
91 
92 #endif
NvTimeSync::GetCurrentRunningTime
GstClockTime GetCurrentRunningTime()
nvstreammux.h
NvTimeSync::get_buffer_earlyby_time
NanoSecondsType get_buffer_earlyby_time()
NvTimeSync::NvTimeSync
NvTimeSync(GstElement *el)
Definition: gstnvtimesynch.h:38
BufferWrapper
Definition: nvstreammux_pads.h:103
NvTimeSync::GetUpstreamLatency
GstClockTime GetUpstreamLatency()
BUFFER_TS_STATUS
BUFFER_TS_STATUS
Definition: nvstreammux_pads.h:77
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)
NvTimeSync::SetSegment
void SetSegment(unsigned int stream_id, const GstSegment *segment)
NvTimeSync::GetBufferRunningTime
uint64_t GetBufferRunningTime(uint64_t pts, unsigned int stream_id)
NanoSecondsType
std::chrono::duration< double, std::nano > NanoSecondsType
Definition: nvstreammux_pads.h:33
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: nvstreammux_pads.h:353
nvstreammux_batch.h
NvTimeSync
Definition: gstnvtimesynch.h:34
nvstreammux_pads.h