Jetson Inference
DNN Vision Library
gstWebRTC.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20  * DEALINGS IN THE SOFTWARE.
21  */
22 
23 #ifndef __GSTREAMER_WEBRTC_H__
24 #define __GSTREAMER_WEBRTC_H__
25 
26 #include "WebRTCServer.h"
27 #include "gstUtility.h"
28 
29 #define GST_USE_UNSTABLE_API
30 #include <gst/webrtc/webrtc.h>
31 
32 
38 class gstWebRTC
39 {
40 public:
44  struct PeerContext
45  {
46  PeerContext() { webrtcbin = NULL; queue = NULL; }
47 
48  GstElement* webrtcbin; // used by gstEncoder + gstDecoder
49  GstElement* queue; // used by gstEncoder only
50  };
51 
56  static void onNegotiationNeeded( GstElement* webrtcbin, void* user_data );
57 
62  static void onCreateOffer( GstPromise* promise, void* user_data );
63 
68  static void onIceCandidate( GstElement* webrtcbin, uint32_t mline_index, char* candidate, void* user_data );
69 
75  static void onWebsocketMessage( WebRTCPeer* peer, const char* message, size_t message_size, void* user_data );
76 };
77 
78 
79 #endif
WebRTCServer.h
gstWebRTC::onNegotiationNeeded
static void onNegotiationNeeded(GstElement *webrtcbin, void *user_data)
Callback for handling webrtcbin "on-negotation-needed" signal.
gstWebRTC::PeerContext::PeerContext
PeerContext()
Definition: gstWebRTC.h:46
gstWebRTC::PeerContext::queue
GstElement * queue
Definition: gstWebRTC.h:49
gstUtility.h
gstWebRTC::onWebsocketMessage
static void onWebsocketMessage(WebRTCPeer *peer, const char *message, size_t message_size, void *user_data)
Handle incoming websocket messages from the client.
gstWebRTC::onIceCandidate
static void onIceCandidate(GstElement *webrtcbin, uint32_t mline_index, char *candidate, void *user_data)
Callback for handling webrtcbin "on-ice-candidate" signal.
gstWebRTC
Static class for common WebRTC utility functions used with GStreamer.
Definition: gstWebRTC.h:38
gstWebRTC::onCreateOffer
static void onCreateOffer(GstPromise *promise, void *user_data)
Callback for handling webrtcbin "create-offer" signal.
gstWebRTC::PeerContext
GStreamer-specific context for each WebRTCPeer.
Definition: gstWebRTC.h:44
gstWebRTC::PeerContext::webrtcbin
GstElement * webrtcbin
Definition: gstWebRTC.h:48
WebRTCPeer
Remote peer that has connected.
Definition: WebRTCServer.h:85