gstreamer/ext/avtp/gstavtpcvfpay.h
Ederson de Souza 12838af353 avtpcvfpay: Ensure NAL fragments are transmitted following stream specs
TSN streams are expected to send packets to the network in a well
defined "pace", which is arbitrarily defined for each stream. This pace
is defined by the "measurement interval" property of a stream.

When the AVTP CVF payloader element - avtpcvfpay - fragments a video
frame that is too big to be sent to the network, it currently defines
that all fragments should be transmitted at the same time (via DTS
property of GstBuffers generated, as sink will use those to time the
transmission of the AVTPDU). This doesn't comply with stream definition,
which also has a limit on how many packets can be sent on a given
measurement interval.

This patch solves that by spreading in time the DTS of the GstBuffers
containing the AVTPDUs. Two new properties, "measurement-interval" and
"max-interval-frames", added to avptcvfpay element so that it knows
stream measurement interval and how many AVTPDUs it can send on any of
them. More details on the method used to proper spread DTS/PTS according
to measurement interval can be found in a code commentary inside this patch.

Tests also added for the new property and behaviour.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1004>
2020-05-02 17:42:15 +00:00

69 lines
2 KiB
C

/*
* GStreamer AVTP Plugin
* Copyright (C) 2019 Intel Corporation
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
#ifndef __GST_AVTP_CVF_PAY_H__
#define __GST_AVTP_CVF_PAY_H__
#include <gst/gst.h>
#include "gstavtpbasepayload.h"
G_BEGIN_DECLS
#define GST_TYPE_AVTP_CVF_PAY (gst_avtp_cvf_pay_get_type())
#define GST_AVTP_CVF_PAY(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AVTP_CVF_PAY,GstAvtpCvfPay))
#define GST_AVTP_CVF_PAY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AVTP_CVF_PAY,GstAvtpCvfPayClass))
#define GST_IS_AVTP_CVF_PAY(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AVTP_CVF_PAY))
#define GST_IS_AVTP_CVF_PAY_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AVTP_CVF_PAY))
typedef struct _GstAvtpCvfPay GstAvtpCvfPay;
typedef struct _GstAvtpCvfPayClass GstAvtpCvfPayClass;
struct _GstAvtpCvfPay
{
GstAvtpBasePayload payload;
GstBuffer *header;
guint mtu;
guint64 measurement_interval;
guint max_interval_frames;
guint64 last_interval_ct;
/* H.264 specific information */
guint8 nal_length_size;
};
struct _GstAvtpCvfPayClass
{
GstAvtpBasePayloadClass parent_class;
};
GType gst_avtp_cvf_pay_get_type (void);
gboolean gst_avtp_cvf_pay_plugin_init (GstPlugin * plugin);
G_END_DECLS
#endif /* __GST_AVTP_CVF_PAY_H__ */