|
|
NVIDIA DeepStream SDK API Reference
|
9.2 Release
|
Go to the documentation of this file.
21 #include <ucp/api/ucp.h>
24 #include <arpa/inet.h>
26 #include <gst/video/video.h>
27 #include <gst/base/gstpushsrc.h>
28 #include <gst/base/gstbasesink.h>
30 #include <cuda_runtime.h>
31 #include "nvbufsurface.h"
32 #include <nvbufaudio.h>
33 #include "gstnvdsmeta.h"
35 #include "gstnvdsbufferpool.h"
37 #include "gst-nvcommon.h"
38 #include "gst_nvdsaudio.h"
39 #include "nvbufaudio.h"
40 #include "nvdscustomusermeta.h"
41 #include "gst-nvevent.h"
42 #include "nvtx_helper.h"
43 #include "gst-nvquery.h"
44 #include "gst-nvquery-internal.h"
46 #define UCX_DEFAULT_ADDR "127.0.0.1"
47 #define UCX_DEFAULT_HIGH_PERF TRUE
48 #define UCX_HIGH_PERF_DISABLE_TLS "tcp,cuda"
49 #define UCX_MAX_PORT (65535)
50 #define UCX_DEFAULT_PORT (7174)
51 #define UCX_MAX_CONNS (4)
52 #define UCX_DEFAULT_CONNS (1)
53 #define IP_STRING_LEN (45)
54 #define PORT_STRING_LEN (8)
55 #define DEFAULT_ALLOCATOR_BPF (4)
56 #define DEFAULT_ALLOCATOR_BUF_LEN (441000)
57 #define DEFAULT_GPU_ID (0)
58 #define DEFAULT_NVBUF_MEMORY_TYPE NVBUF_MEM_CUDA_UNIFIED
59 #define MIN_NUM_NVBUF (0)
60 #define MAX_NUM_NVBUF (20)
61 #define DEFAULT_NUM_NVBUF (4)
62 #define MIN_NVBUF_BATCH_SIZE (1)
63 #define MAX_NVBUF_BATCH_SIZE INT_MAX
64 #define MIN_MAX_EP_NUM (1)
65 #define MAX_MAX_EP_NUM INT_MAX
66 #define DEFAULT_NVBUF_BATCH_SIZE (1)
67 #define DEFAULT_RAW_BUFFER_SIZE (1 << 13)
68 #define BATCH_END_TIMEOUT_SEC (10)
69 #define DEFAULT_MAX_EP_NUM (128)
70 #define CLIENT_ID_SIZE (32)
73 #define GST_CAPS_FEATURE_MEMORY_NVMM "memory:NVMM"
76 #define VIDEO_FORMATS "{ NV12, RGBA, I420 }"
79 #define AUDIO_FORMAT \
80 "S8, U8, S16LE, S16BE, U16LE, U16BE, S24_32LE, S24_32BE, " \
81 "U24_32LE, U24_32BE, S32LE, S32BE, U32LE, U32BE, S24LE, S24BE, " \
82 "U24LE, U24BE, S20LE, S20BE, U20LE, U20BE, S18LE, S18BE, U18LE, " \
83 "U18BE, F32LE, F32BE, F64LE, F64BE"
85 #define AUDIO_CHANNELS "[1, 2147483647]"
87 #define GST_AUDIO_CAPS_MAKE_WITH_FEATURES(features, format, channels) \
88 "audio/x-raw(" features "), " \
89 "format = (string) { " format \
92 "rate = [ 1, 2147483647 ], " \
93 "layout = (string) { interleaved, non-interleaved }, " \
94 "channels = (int)" channels
97 #define GST_TEXT_CAPS_MAKE(format) "text/x-raw, format=(string){" format "}"
100 #define NVTX_WRAPPER_START \
102 char context_name[256]; \
103 strcpy(context_name, __func__); \
104 nvtx_helper_start_end(context_name, &nvtx_id)
106 #define NVTX_WRAPPER_END \
107 nvtx_helper_start_end(NULL, &nvtx_id)
134 #define GST_TYPE_NVDSUCX_BUF_TYPE (gst_nvdsucx_buf_type_get_type ())
139 #define EVENT_DATA_MAX_LEN 1024
267 void **rdma_data_ptr,
NvDsUcxBuf * nv_dsucx_buf, GMutex * meta_lock);
271 const void *header,
size_t header_length,
void *
data,
272 size_t length,
const ucp_am_recv_param_t * param);
278 ucs_status_t
gst_ucp_send (ucp_worker_h ucp_worker, ucp_ep_h ep,
280 void *rdma_buffer,
size_t rdma_buffer_size);
282 void *msg,
size_t msg_len);
284 unsigned int am_tag);
287 NvDsUcxAmDesc * am_desc, GMutex * meta_lock, ucs_status_t *conn_status);
294 #define UCX_THREAD_DATA_COMMON_FIELDS gint batch_id; \
378 void **am_hdr_buf,
void **rdma_buffer,
379 size_t *rdma_buffer_size,
NvDsBatchMeta * batch_meta,
int batch_id,
382 void **rdma_buffer,
size_t *rdma_buffer_size,
391 int get_thread_num (gpointer ucxdata,
bool is_src,
bool is_server);
396 const GValue * value, GParamSpec * pspec);
398 const GValue * value, GParamSpec * pspec);
400 const GValue * value, GParamSpec * pspec);
402 const GValue * value, GParamSpec * pspec);
404 GValue * value, GParamSpec * pspec);
406 GValue * value, GParamSpec * pspec);
408 GValue * value, GParamSpec * pspec);
410 GValue * value, GParamSpec * pspec);
418 gboolean * send_event);
void gst_ucx_client_init(GstUcxClient *ucxclient)
ucp_context_h ucp_context
void gst_ucx_set_nvevent_data(GstEvent *event, NvDsUcxAmEventDesc *event_data, gboolean *send_event)
int ucx_src_init_buffer_type_attr(GstUcxSrc *ucxsrc)
int start_sink(GstUcxSink *ucxsink)
NvBufSurfaceParams nvbufsurf_params
int(* prep_am_meta)(void **am_hdr_meta_buf, void **rdma_buffer, size_t *rdma_buffer_size, NvDsBatchMeta *batch_meta, int batch_id)
GList * gst_ucx_server_conn_list
ucs_status_t gst_ucp_send_event(ucp_worker_h ucp_worker, ucp_ep_h ep, void *msg, size_t msg_len)
uint32_t num_surfaces_per_frame
NvBufAudioDsUcx nvbuf_audio
void stop_client(GstUcxClient *ucxclient)
void gst_ucx_server_init(GstUcxServer *ucxserver)
guint num_surfaces_per_frame
ucs_status_t gst_ucp_init_context(ucp_context_h *ucp_context, gboolean high_perf)
GstUcxThreadDataSource * threads_data
@ NVDSUCX_BUF_TYPE_AUDIO_NV
__host__ __device__ float length(float2 v)
Compute the Euclidean length of a vector.
gst_ucx_conn_req_ctx_t server_conn_ctx
GList * gst_ucx_nvevents_list
struct _GstUcxSrc GstUcxSrc
struct gst_ucp_conn_ctx gst_ucp_conn_ctx_t
struct _GstUcxSinkRdmaParams GstUcxRdmaParams
void stop_sink(GstUcxSink *ucxsink)
void stop_server(GstUcxServer *ucxserver)
size_t rdma_meta_buffer_size
NvGstBufferParams nvgstbuffer_params
ucs_status_t gst_ucp_send_only(ucp_worker_h ucp_worker, ucp_ep_h ep, unsigned int am_tag)
NvDsCustomMetaUcx nv_dscustom_buf
ucp_context_h ucp_context
struct __GstUcxThreadDataSource GstUcxThreadDataSource
#define EVENT_DATA_MAX_LEN
ucs_status_t gst_ucp_recv_meta(ucp_worker_h ucp_worker, GstBuffer **gst_buffer, NvDsUcxSrcPrepAmMetaFunc prep_am_meta, NvDsUcxAmDesc *am_desc, ucs_status_t *conn_status)
ucs_status_t gst_ucp_send(ucp_worker_h ucp_worker, ucp_ep_h ep, GstNvDsUcxAmId am_id, void *am_hdr_buf, size_t am_hdr_buf_size, void *rdma_buffer, size_t rdma_buffer_size)
gboolean batch_end_check_func(gpointer arg)
ucp_worker_h * data_worker
gst_ucp_conn_ctx_t gst_ucp_conn_ctx
@ NVDSUCX_BUF_TYPE_AUDIO_RAW
struct _GstUcxSink GstUcxSink
int get_thread_num(gpointer ucxdata, bool is_src, bool is_server)
void clear_gst_ucp_conn_ctx(gpointer data)
gboolean gst_ucx_is_recv_meta(GstUcxSrc *src, int batch_id)
GstUcxSinkAmHdrParams * am_hdrs
NvGstBufferParams nvgstbuffer_params
NvDsUcxSrcPrepAmFunc prep_am
GList * gst_ucx_conn_req_list
static void copy_nvbufaudio_params(NvBufAudioParams *in, NvBufAudioParams *out)
int start_server(gpointer data, bool is_src)
G_BEGIN_DECLS struct _GstUcxClient GstUcxClient
int gst_ucx_create_thread_pool(GstTaskPool **pool, gint nvbuf_batch_size)
void gst_ucx_sink_init(GstUcxSink *ucxsink)
struct _GstBuffer GstBuffer
NvDsUcxAmDesc am_desc_meta
struct _GstUcxThreadDataSink GstUcxThreadDataSink
void gst_ucx_src_init(GstUcxSrc *ucxsrc)
struct _GstUcxServerPriv GstUcxServerPriv
GstNvDsUcxBufType buf_type
struct _NvDsCustomMetaUcx NvDsCustomMetaUcx
Hold the information of single buffer in the batch.
UCX_THREAD_DATA_COMMON_FIELDS
NvGstBufferParams nvgstbuffer_params
GstTaskPool * thread_pool
bool gst_ucx_client_set_property(GstUcxClient *ucxclient, guint property_id, const GValue *value, GParamSpec *pspec)
volatile int stop_listener_thread
NvBufAudioParams nvbufaudio_params
NvDsUcxSrcPrepAmMetaFunc prep_am_meta
bool gst_ucx_client_get_property(GstUcxClient *ucxclient, guint property_id, GValue *value, GParamSpec *pspec)
bool gst_ucx_src_get_property(GstUcxSrc *ucxsrc, guint property_id, GValue *value, GParamSpec *pspec)
ucs_status_t gst_ucp_recv(ucp_worker_h ucp_worker, GstBuffer **gst_buffer, NvDsUcxSrcPrepAmFunc prep_am, NvDsUcxAmDesc *am_desc, GMutex *meta_lock, ucs_status_t *conn_status)
bool gst_ucx_src_set_property(GstUcxSrc *ucxsrc, guint property_id, const GValue *value, GParamSpec *pspec)
struct _NvBufRawDsUcx NvBufRawDsUcx
struct _NvBufAudioDsUcx NvBufAudioDsUcx
NvBufSurfaceMemType
Specifies memory types for NvBufSurface.
ucp_worker_h listen_worker
GstTaskPool * thread_pool
gboolean gst_ucx_sink_cap_event_handling(GstUcxSink *ucxsink, GstBaseSink *basesink, GstEvent *event, NvDsUcxAmEventDesc *event_data, gboolean *send_event)
size_t am_hdr_meta_buf_size
int start_src(GstUcxSrc *ucxsrc, GstBaseSrc *src)
void free_gst_ucp_conn_ctx(gpointer data)
guint num_surfaces_per_frame
struct _NvBufSurfaceDsUcx NvBufSurfaceDsUcx
ucs_status_t(* NvDsUcxAmHandlerFunc)(void *arg, const void *header, size_t header_length, void *data, size_t length, const ucp_am_recv_param_t *param)
int(* prep_am)(GstBuffer *gst_buffer, GstMapInfo *map_info, void **am_hdr_buf, void **rdma_buffer, size_t *rdma_buffer_size, NvDsBatchMeta *batch_meta, int batch_id, guint num_surfaces_per_frame, size_t rdma_meta_buffer_size)
struct _NvDsUcxAmDesc NvDsUcxAmDesc
gchar data[EVENT_DATA_MAX_LEN]
uint32_t num_surfaces_per_frame
GThread * listener_thread
NvBufSurfaceDsUcx nvbuf_surf
NvBufSurfaceMemType mem_type
GstNvDsUcxBufType buf_type
GType gst_nvdsucx_buf_type_get_type(void)
size_t rdma_frame_buffer_size
gboolean gst_ucx_src_buffer_pool_new(GstUcxSrc *ucxsrc, GstCaps *caps)
struct _GstUcxClientPriv GstUcxClientPriv
struct _GstUcxServer GstUcxServer
static G_END_DECLS void copy_gstbuf_info(NvGstBufferParams *inNvGst, GstBuffer *inGstBuf, NvGstBufferParams *outNvGst, GstBuffer *outGstBuf)
union _NvDsUcxBuf NvDsUcxBuf
struct _GstUcxSinkAmHdrParams GstUcxSinkAmHdrParams
struct _NvGstBufferParams NvGstBufferParams
void stop_src(GstUcxSrc *ucxsrc)
GstUcxThreadDataSink * threads_data
bool gst_ucx_sink_get_property(GstUcxSink *ucxsink, guint property_id, GValue *value, GParamSpec *pspec)
static void copy_nvbufsurf_params(NvBufSurfaceParams *in, NvBufSurfaceParams *out)
GList * gst_ucx_server_queued_conn_list
bool gst_ucx_sink_set_property(GstUcxSink *ucxsink, guint property_id, const GValue *value, GParamSpec *pspec)
G_BEGIN_DECLS struct _GstUcxClient GstUcxClient
struct gst_ucx_conn_req_ctx gst_ucx_conn_req_ctx_t
ucs_status_t(* NvDsUcxSrcPrepAmFunc)(GstBuffer **gst_buffer, void **rdma_data_ptr, NvDsUcxBuf *nv_dsucx_buf, GMutex *meta_lock)
UCX_THREAD_DATA_COMMON_FIELDS
int start_client(gpointer data, bool is_src)
gboolean gst_ucx_src_negotiate_caps(GstBaseSrc *src, GstUcxSrc *ucxsrc)
bool gst_ucx_server_set_property(GstUcxServer *ucxserver, guint property_id, const GValue *value, GParamSpec *pspec)
ucs_status_t(* NvDsUcxSrcPrepAmMetaFunc)(GstBuffer **gst_buffer, void **rdma_data_ptr, NvDsCustomMetaUcx nv_dsucx_meta)
struct _NvDsUcxAmEventDesc NvDsUcxAmEventDesc
bool gst_ucx_server_get_property(GstUcxServer *ucxserver, guint property_id, GValue *value, GParamSpec *pspec)