gstreamer/subprojects/gst-plugins-good/gst/rtp/gstrtppassthroughpay.h
Piotr Brzeziński 363154d855 rtppassthroughpay: Add ability to regenerate RTP timestamps
Timestamps are untouched by default, but the new mode can now be enabled to replace RTP timestamps
with ones generated from the buffer PTS. Making it an enum in case different modes are needed in the future.
That allows for a rtpjitterbuffer to do proper drift compensation, so that the stream coming out of gst-rtsp-server
is not drifting compared to the pipeline clock and also not compared to the RTCP NTP times.

Most of the code is borrowed from rtpbasepayload, as it's exactly its behaviour which I wanted to bring here.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7526>
2024-09-19 16:46:20 +00:00

86 lines
2.8 KiB
C

/*
* GStreamer
*
* Copyright (C) 2023 Sebastian Dröge <sebastian@centricular.com>
* Copyright (C) 2023 Jonas Danielsson <jonas.danielsson@spiideo.com>
*
* gstrtppassthroughpay.h:
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*/
#pragma once
#include <gst/gst.h>
G_BEGIN_DECLS
#define GST_TYPE_RTP_PASSTHROUGH_PAY (gst_rtp_passthrough_pay_get_type())
#define GST_RTP_PASSTHROUGH_PAY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_RTP_PASSTHROUGH_PAY, \
GstRtpPassthroughPay))
#define GST_RTP_PASSTHROUGH_PAY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_RTP_PASSTHROUGH_PAY, \
GstRtpPassthroughPayClass))
#define GST_IS_RTP_PASSTHROUGH_PAY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_RTP_PASSTHROUGH_PAY))
#define GST_IS_RTP_PASSTHROUGH_PAY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_RTP_PASSTHROUGH_PAY))
#define GST_RTP_PASSTHROUGH_PAY_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS((obj), GST_TYPE_RTP_PASSTHROUGH_PAY, \
GstRtpPassthroughPayClass))
typedef struct _GstRtpPassthroughPay GstRtpPassthroughPay;
typedef struct _GstRtpPassthroughPayClass GstRtpPassthroughPayClass;
/**
* GstRtpPassthroughPayRetimestampMode:
* @GST_RTPPASSTHROUGHPAY_RETIMESTAMP_MODE_DISABLED: Leave RTP timestamps unchanged
* @GST_RTPPASSTHROUGHPAY_RETIMESTAMP_MODE_ENABLED: Retimestamp based on buffer PTS
*
* Since: 1.26
*/
typedef enum
{
GST_RTPPASSTHROUGHPAY_RETIMESTAMP_MODE_DISABLED = 0,
GST_RTPPASSTHROUGHPAY_RETIMESTAMP_MODE_ENABLED = 1,
} GstRtpPassthroughPayRetimestampMode;
struct _GstRtpPassthroughPayClass
{
GstElementClass parent_class;
};
struct _GstRtpPassthroughPay
{
GstElement parent;
GstPad *sinkpad, *srcpad;
GstCaps *caps;
GstSegment segment;
guint clock_rate;
guint pt;
gboolean pt_override;
guint ssrc;
gboolean ssrc_set;
guint timestamp;
guint timestamp_offset;
gboolean timestamp_offset_set;
guint seqnum;
guint seqnum_offset;
GstClockTime pts_or_dts;
GstRtpPassthroughPayRetimestampMode retimestamp_mode;
};
GType gst_rtp_passthrough_pay_get_type (void);
G_END_DECLS