NVIDIA DeepStream SDK API Reference

7.0 Release
infer_stream_manager.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
4  *
5  * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
6  * property and proprietary rights in and to this material, related
7  * documentation and any modifications thereto. Any use, reproduction,
8  * disclosure or distribution of this material and related documentation
9  * without an express license agreement from NVIDIA CORPORATION or
10  * its affiliates is strictly prohibited.
11  */
12 
13 #ifndef __INFER_STREAM_MANAGER_H__
14 #define __INFER_STREAM_MANAGER_H__
15 
16 #include <functional>
17 #include <queue>
18 
19 #include "infer_common.h"
20 #include "infer_utils.h"
21 
22 namespace nvdsinferserver {
23 
24 // When loop is enabled, for full frame processing only
25 //
27 public:
28  using StreamId = uint64_t;
29 
31  ~StreamManager() = default;
32  // wait until the streaming update from running(kRunning) to other state
34  // start a stream into waiting list, update status into kRunning
35  NvDsInferStatus startStream(StreamId id, int64_t timestamp, void* userptr);
36  // stop a stream, set it to kStopped but keep in the list
38  // update stream state into kReady
40  void notifyError(NvDsInferStatus status);
41 
42  // Information
43  // max_size; timeout_list;
44 private:
45  enum class ProgressType : int {
46  kStopped = 0,
47  kReady = 1,
48  kRunning = 2,
49  };
50 
51  struct StreamState {
52  int64_t timestamp = 0;
53  ProgressType progress = ProgressType::kReady;
54  void* reserved = nullptr;
55  };
56  using StreamList = std::unordered_map<StreamId, StreamState>;
57 
58  bool isRunning() const { return !m_Stopping; }
59  bool popDeprecatedStream();
60 
61  StreamList m_StreamList;
62  uint32_t m_MaxStreamSize = 256;
63  bool m_Stopping = false;
64  std::mutex m_Mutex;
65  std::condition_variable m_Cond;
66 };
67 
68 } // namespace nvdsinferserver
69 
70 #endif
nvdsinferserver::StreamManager
Definition: infer_stream_manager.h:26
nvdsinferserver::StreamManager::waitStream
NvDsInferStatus waitStream(StreamId id)
nvdsinferserver
This is a header file for pre-processing cuda kernels with normalization and mean subtraction require...
Definition: infer_custom_process.h:24
nvdsinferserver::StreamManager::StreamManager
StreamManager()
Definition: infer_stream_manager.h:30
nvdsinferserver::StreamManager::startStream
NvDsInferStatus startStream(StreamId id, int64_t timestamp, void *userptr)
infer_utils.h
Header file containing utility functions and classes used by the nvinferserver low level library.
nvdsinferserver::StreamManager::streamInferDone
NvDsInferStatus streamInferDone(StreamId id, SharedBatchArray &outTensors)
infer_common.h
Header file of the common declarations for the nvinferserver library.
nvdsinferserver::StreamManager::StreamId
uint64_t StreamId
Definition: infer_stream_manager.h:28
nvdsinferserver::StreamManager::stopStream
NvDsInferStatus stopStream(StreamId id)
nvdsinferserver::StreamManager::notifyError
void notifyError(NvDsInferStatus status)
nvdsinferserver::SharedBatchArray
std::shared_ptr< BaseBatchArray > SharedBatchArray
Definition: infer_common.h:75
nvdsinferserver::StreamManager::~StreamManager
~StreamManager()=default
NvDsInferStatus
NvDsInferStatus
Enum for the status codes returned by NvDsInferContext.
Definition: nvdsinfer.h:218