NVIDIA DeepStream SDK API Reference

6.4 Release
infer_stream_manager.h
Go to the documentation of this file.
1 
12 #ifndef __INFER_STREAM_MANAGER_H__
13 #define __INFER_STREAM_MANAGER_H__
14 
15 #include <functional>
16 #include <queue>
17 
18 #include "infer_common.h"
19 #include "infer_utils.h"
20 
21 namespace nvdsinferserver {
22 
23 // When loop is enabled, for full frame processing only
24 //
26 public:
27  using StreamId = uint64_t;
28 
30  ~StreamManager() = default;
31  // wait until the streaming update from running(kRunning) to other state
33  // start a stream into waiting list, update status into kRunning
34  NvDsInferStatus startStream(StreamId id, int64_t timestamp, void* userptr);
35  // stop a stream, set it to kStopped but keep in the list
37  // update stream state into kReady
39  void notifyError(NvDsInferStatus status);
40 
41  // Information
42  // max_size; timeout_list;
43 private:
44  enum class ProgressType : int {
45  kStopped = 0,
46  kReady = 1,
47  kRunning = 2,
48  };
49 
50  struct StreamState {
51  int64_t timestamp = 0;
52  ProgressType progress = ProgressType::kReady;
53  void* reserved = nullptr;
54  };
55  using StreamList = std::unordered_map<StreamId, StreamState>;
56 
57  bool isRunning() const { return !m_Stopping; }
58  bool popDeprecatedStream();
59 
60  StreamList m_StreamList;
61  uint32_t m_MaxStreamSize = 256;
62  bool m_Stopping = false;
63  std::mutex m_Mutex;
64  std::condition_variable m_Cond;
65 };
66 
67 } // namespace nvdsinferserver
68 
69 #endif
nvdsinferserver::StreamManager
Definition: infer_stream_manager.h:25
nvdsinferserver::StreamManager::waitStream
NvDsInferStatus waitStream(StreamId id)
nvdsinferserver
Copyright (c) 2021, NVIDIA CORPORATION.
Definition: infer_custom_process.h:28
nvdsinferserver::StreamManager::StreamManager
StreamManager()
Definition: infer_stream_manager.h:29
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:27
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