mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-09 17:05:52 +00:00
rtprtx: don't access type-system per buffer
When doing only a single stream of audio/video this hardly matters, but when doing many at the same time, the fact that you have to get a hold of the glib global type-system lock every time you process a buffer, means that there is a limit to how many streams you can process in parallel. Luckily the fix is very simple, by doing a cast rather than a full type-check. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1873>
This commit is contained in:
parent
2a26daee46
commit
a475c93346
4 changed files with 24 additions and 19 deletions
|
@ -258,7 +258,7 @@ gst_rtp_rtx_receive_reset (GstRtpRtxReceive * rtx)
|
||||||
static void
|
static void
|
||||||
gst_rtp_rtx_receive_finalize (GObject * object)
|
gst_rtp_rtx_receive_finalize (GObject * object)
|
||||||
{
|
{
|
||||||
GstRtpRtxReceive *rtx = GST_RTP_RTX_RECEIVE (object);
|
GstRtpRtxReceive *rtx = GST_RTP_RTX_RECEIVE_CAST (object);
|
||||||
|
|
||||||
g_hash_table_unref (rtx->ssrc2_ssrc1_map);
|
g_hash_table_unref (rtx->ssrc2_ssrc1_map);
|
||||||
g_hash_table_unref (rtx->seqnum_ssrc1_map);
|
g_hash_table_unref (rtx->seqnum_ssrc1_map);
|
||||||
|
@ -326,7 +326,7 @@ static gboolean
|
||||||
gst_rtp_rtx_receive_src_event (GstPad * pad, GstObject * parent,
|
gst_rtp_rtx_receive_src_event (GstPad * pad, GstObject * parent,
|
||||||
GstEvent * event)
|
GstEvent * event)
|
||||||
{
|
{
|
||||||
GstRtpRtxReceive *rtx = GST_RTP_RTX_RECEIVE (parent);
|
GstRtpRtxReceive *rtx = GST_RTP_RTX_RECEIVE_CAST (parent);
|
||||||
gboolean res;
|
gboolean res;
|
||||||
|
|
||||||
switch (GST_EVENT_TYPE (event)) {
|
switch (GST_EVENT_TYPE (event)) {
|
||||||
|
@ -515,7 +515,7 @@ _gst_rtp_buffer_new_from_rtx (GstRTPBuffer * rtp, guint32 ssrc1,
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_rtp_rtx_receive_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
|
gst_rtp_rtx_receive_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
|
||||||
{
|
{
|
||||||
GstRtpRtxReceive *rtx = GST_RTP_RTX_RECEIVE (parent);
|
GstRtpRtxReceive *rtx = GST_RTP_RTX_RECEIVE_CAST (parent);
|
||||||
GstRTPBuffer rtp = GST_RTP_BUFFER_INIT;
|
GstRTPBuffer rtp = GST_RTP_BUFFER_INIT;
|
||||||
GstFlowReturn ret = GST_FLOW_OK;
|
GstFlowReturn ret = GST_FLOW_OK;
|
||||||
GstBuffer *new_buffer = NULL;
|
GstBuffer *new_buffer = NULL;
|
||||||
|
@ -692,7 +692,7 @@ static void
|
||||||
gst_rtp_rtx_receive_get_property (GObject * object,
|
gst_rtp_rtx_receive_get_property (GObject * object,
|
||||||
guint prop_id, GValue * value, GParamSpec * pspec)
|
guint prop_id, GValue * value, GParamSpec * pspec)
|
||||||
{
|
{
|
||||||
GstRtpRtxReceive *rtx = GST_RTP_RTX_RECEIVE (object);
|
GstRtpRtxReceive *rtx = GST_RTP_RTX_RECEIVE_CAST (object);
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_PAYLOAD_TYPE_MAP:
|
case PROP_PAYLOAD_TYPE_MAP:
|
||||||
|
@ -742,7 +742,7 @@ static void
|
||||||
gst_rtp_rtx_receive_set_property (GObject * object,
|
gst_rtp_rtx_receive_set_property (GObject * object,
|
||||||
guint prop_id, const GValue * value, GParamSpec * pspec)
|
guint prop_id, const GValue * value, GParamSpec * pspec)
|
||||||
{
|
{
|
||||||
GstRtpRtxReceive *rtx = GST_RTP_RTX_RECEIVE (object);
|
GstRtpRtxReceive *rtx = GST_RTP_RTX_RECEIVE_CAST (object);
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_PAYLOAD_TYPE_MAP:
|
case PROP_PAYLOAD_TYPE_MAP:
|
||||||
|
@ -768,7 +768,7 @@ gst_rtp_rtx_receive_change_state (GstElement * element,
|
||||||
GstStateChangeReturn ret;
|
GstStateChangeReturn ret;
|
||||||
GstRtpRtxReceive *rtx;
|
GstRtpRtxReceive *rtx;
|
||||||
|
|
||||||
rtx = GST_RTP_RTX_RECEIVE (element);
|
rtx = GST_RTP_RTX_RECEIVE_CAST (element);
|
||||||
|
|
||||||
switch (transition) {
|
switch (transition) {
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -28,14 +28,16 @@
|
||||||
#include <gst/rtp/gstrtpbuffer.h>
|
#include <gst/rtp/gstrtpbuffer.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
typedef struct _GstRtpRtxReceive GstRtpRtxReceive;
|
||||||
|
typedef struct _GstRtpRtxReceiveClass GstRtpRtxReceiveClass;
|
||||||
|
|
||||||
#define GST_TYPE_RTP_RTX_RECEIVE (gst_rtp_rtx_receive_get_type())
|
#define GST_TYPE_RTP_RTX_RECEIVE (gst_rtp_rtx_receive_get_type())
|
||||||
#define GST_RTP_RTX_RECEIVE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_RTX_RECEIVE, GstRtpRtxReceive))
|
#define GST_RTP_RTX_RECEIVE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_RTX_RECEIVE, GstRtpRtxReceive))
|
||||||
#define GST_RTP_RTX_RECEIVE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_RTX_RECEIVE, GstRtpRtxReceiveClass))
|
#define GST_RTP_RTX_RECEIVE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_RTX_RECEIVE, GstRtpRtxReceiveClass))
|
||||||
#define GST_RTP_RTX_RECEIVE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTP_RTX_RECEIVE, GstRtpRtxReceiveClass))
|
#define GST_RTP_RTX_RECEIVE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTP_RTX_RECEIVE, GstRtpRtxReceiveClass))
|
||||||
#define GST_IS_RTP_RTX_RECEIVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_RTX_RECEIVE))
|
#define GST_IS_RTP_RTX_RECEIVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_RTX_RECEIVE))
|
||||||
#define GST_IS_RTP_RTX_RECEIVE_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_RTX_RECEIVE))
|
#define GST_IS_RTP_RTX_RECEIVE_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_RTX_RECEIVE))
|
||||||
typedef struct _GstRtpRtxReceive GstRtpRtxReceive;
|
#define GST_RTP_RTX_RECEIVE_CAST(obj) ((GstRtpRtxReceive *)(obj))
|
||||||
typedef struct _GstRtpRtxReceiveClass GstRtpRtxReceiveClass;
|
|
||||||
|
|
||||||
struct _GstRtpRtxReceive
|
struct _GstRtpRtxReceive
|
||||||
{
|
{
|
||||||
|
|
|
@ -229,7 +229,7 @@ gst_rtp_rtx_send_reset (GstRtpRtxSend * rtx)
|
||||||
static void
|
static void
|
||||||
gst_rtp_rtx_send_finalize (GObject * object)
|
gst_rtp_rtx_send_finalize (GObject * object)
|
||||||
{
|
{
|
||||||
GstRtpRtxSend *rtx = GST_RTP_RTX_SEND (object);
|
GstRtpRtxSend *rtx = GST_RTP_RTX_SEND_CAST (object);
|
||||||
|
|
||||||
g_hash_table_unref (rtx->ssrc_data);
|
g_hash_table_unref (rtx->ssrc_data);
|
||||||
g_hash_table_unref (rtx->rtx_ssrcs);
|
g_hash_table_unref (rtx->rtx_ssrcs);
|
||||||
|
@ -464,7 +464,7 @@ buffer_queue_items_cmp (BufferQueueItem * a, BufferQueueItem * b,
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_rtp_rtx_send_src_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
gst_rtp_rtx_send_src_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
||||||
{
|
{
|
||||||
GstRtpRtxSend *rtx = GST_RTP_RTX_SEND (parent);
|
GstRtpRtxSend *rtx = GST_RTP_RTX_SEND_CAST (parent);
|
||||||
gboolean res;
|
gboolean res;
|
||||||
|
|
||||||
switch (GST_EVENT_TYPE (event)) {
|
switch (GST_EVENT_TYPE (event)) {
|
||||||
|
@ -604,7 +604,7 @@ gst_rtp_rtx_send_src_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_rtp_rtx_send_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
gst_rtp_rtx_send_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
||||||
{
|
{
|
||||||
GstRtpRtxSend *rtx = GST_RTP_RTX_SEND (parent);
|
GstRtpRtxSend *rtx = GST_RTP_RTX_SEND_CAST (parent);
|
||||||
|
|
||||||
switch (GST_EVENT_TYPE (event)) {
|
switch (GST_EVENT_TYPE (event)) {
|
||||||
case GST_EVENT_FLUSH_START:
|
case GST_EVENT_FLUSH_START:
|
||||||
|
@ -768,7 +768,7 @@ process_buffer (GstRtpRtxSend * rtx, GstBuffer * buffer)
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_rtp_rtx_send_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
|
gst_rtp_rtx_send_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
|
||||||
{
|
{
|
||||||
GstRtpRtxSend *rtx = GST_RTP_RTX_SEND (parent);
|
GstRtpRtxSend *rtx = GST_RTP_RTX_SEND_CAST (parent);
|
||||||
GstFlowReturn ret;
|
GstFlowReturn ret;
|
||||||
|
|
||||||
GST_OBJECT_LOCK (rtx);
|
GST_OBJECT_LOCK (rtx);
|
||||||
|
@ -790,7 +790,7 @@ static GstFlowReturn
|
||||||
gst_rtp_rtx_send_chain_list (GstPad * pad, GstObject * parent,
|
gst_rtp_rtx_send_chain_list (GstPad * pad, GstObject * parent,
|
||||||
GstBufferList * list)
|
GstBufferList * list)
|
||||||
{
|
{
|
||||||
GstRtpRtxSend *rtx = GST_RTP_RTX_SEND (parent);
|
GstRtpRtxSend *rtx = GST_RTP_RTX_SEND_CAST (parent);
|
||||||
GstFlowReturn ret;
|
GstFlowReturn ret;
|
||||||
|
|
||||||
GST_OBJECT_LOCK (rtx);
|
GST_OBJECT_LOCK (rtx);
|
||||||
|
@ -841,7 +841,7 @@ static gboolean
|
||||||
gst_rtp_rtx_send_activate_mode (GstPad * pad, GstObject * parent,
|
gst_rtp_rtx_send_activate_mode (GstPad * pad, GstObject * parent,
|
||||||
GstPadMode mode, gboolean active)
|
GstPadMode mode, gboolean active)
|
||||||
{
|
{
|
||||||
GstRtpRtxSend *rtx = GST_RTP_RTX_SEND (parent);
|
GstRtpRtxSend *rtx = GST_RTP_RTX_SEND_CAST (parent);
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
|
@ -866,7 +866,7 @@ static void
|
||||||
gst_rtp_rtx_send_get_property (GObject * object,
|
gst_rtp_rtx_send_get_property (GObject * object,
|
||||||
guint prop_id, GValue * value, GParamSpec * pspec)
|
guint prop_id, GValue * value, GParamSpec * pspec)
|
||||||
{
|
{
|
||||||
GstRtpRtxSend *rtx = GST_RTP_RTX_SEND (object);
|
GstRtpRtxSend *rtx = GST_RTP_RTX_SEND_CAST (object);
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_PAYLOAD_TYPE_MAP:
|
case PROP_PAYLOAD_TYPE_MAP:
|
||||||
|
@ -925,7 +925,7 @@ static void
|
||||||
gst_rtp_rtx_send_set_property (GObject * object,
|
gst_rtp_rtx_send_set_property (GObject * object,
|
||||||
guint prop_id, const GValue * value, GParamSpec * pspec)
|
guint prop_id, const GValue * value, GParamSpec * pspec)
|
||||||
{
|
{
|
||||||
GstRtpRtxSend *rtx = GST_RTP_RTX_SEND (object);
|
GstRtpRtxSend *rtx = GST_RTP_RTX_SEND_CAST (object);
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_SSRC_MAP:
|
case PROP_SSRC_MAP:
|
||||||
|
@ -977,7 +977,7 @@ gst_rtp_rtx_send_change_state (GstElement * element, GstStateChange transition)
|
||||||
GstStateChangeReturn ret;
|
GstStateChangeReturn ret;
|
||||||
GstRtpRtxSend *rtx;
|
GstRtpRtxSend *rtx;
|
||||||
|
|
||||||
rtx = GST_RTP_RTX_SEND (element);
|
rtx = GST_RTP_RTX_SEND_CAST (element);
|
||||||
|
|
||||||
switch (transition) {
|
switch (transition) {
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -29,14 +29,17 @@
|
||||||
#include <gst/base/gstdataqueue.h>
|
#include <gst/base/gstdataqueue.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
typedef struct _GstRtpRtxSend GstRtpRtxSend;
|
||||||
|
typedef struct _GstRtpRtxSendClass GstRtpRtxSendClass;
|
||||||
|
|
||||||
#define GST_TYPE_RTP_RTX_SEND (gst_rtp_rtx_send_get_type())
|
#define GST_TYPE_RTP_RTX_SEND (gst_rtp_rtx_send_get_type())
|
||||||
#define GST_RTP_RTX_SEND(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_RTX_SEND, GstRtpRtxSend))
|
#define GST_RTP_RTX_SEND(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_RTX_SEND, GstRtpRtxSend))
|
||||||
#define GST_RTP_RTX_SEND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_RTX_SEND, GstRtpRtxSendClass))
|
#define GST_RTP_RTX_SEND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_RTX_SEND, GstRtpRtxSendClass))
|
||||||
#define GST_RTP_RTX_SEND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTP_RTX_SEND, GstRtpRtxSendClass))
|
#define GST_RTP_RTX_SEND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTP_RTX_SEND, GstRtpRtxSendClass))
|
||||||
#define GST_IS_RTP_RTX_SEND(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_RTX_SEND))
|
#define GST_IS_RTP_RTX_SEND(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_RTX_SEND))
|
||||||
#define GST_IS_RTP_RTX_SEND_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_RTX_SEND))
|
#define GST_IS_RTP_RTX_SEND_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_RTX_SEND))
|
||||||
typedef struct _GstRtpRtxSend GstRtpRtxSend;
|
#define GST_RTP_RTX_SEND_CAST(obj) ((GstRtpRtxSend *)(obj))
|
||||||
typedef struct _GstRtpRtxSendClass GstRtpRtxSendClass;
|
|
||||||
|
|
||||||
struct _GstRtpRtxSend
|
struct _GstRtpRtxSend
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue