mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-22 17:51:16 +00:00
flvmux: add 'enforce-increasing-timestamps' property
The hack enforcing strictly increasing timestamps was, according to the code comments, because librtmp was confused with backwards timestamps. rtmp2sink is not using librtmp as rtmpsink did, so this is no longer required. Also changing the timestamps is causing audio glitches when streaming to Youtube. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5212>
This commit is contained in:
parent
6053650b85
commit
bc06c2109c
3 changed files with 40 additions and 1 deletions
|
@ -7258,6 +7258,18 @@
|
||||||
"type": "gchararray",
|
"type": "gchararray",
|
||||||
"writable": true
|
"writable": true
|
||||||
},
|
},
|
||||||
|
"enforce-increasing-timestamps": {
|
||||||
|
"blurb": "If set to true, flvmux will modify buffers timestamps to ensure they are always strictly increasing, inside one stream and also between the audio and video streams",
|
||||||
|
"conditionally-available": false,
|
||||||
|
"construct": false,
|
||||||
|
"construct-only": false,
|
||||||
|
"controllable": false,
|
||||||
|
"default": "true",
|
||||||
|
"mutable": "null",
|
||||||
|
"readable": true,
|
||||||
|
"type": "gboolean",
|
||||||
|
"writable": true
|
||||||
|
},
|
||||||
"metadatacreator": {
|
"metadatacreator": {
|
||||||
"blurb": "The value of metadatacreator in the meta packet.",
|
"blurb": "The value of metadatacreator in the meta packet.",
|
||||||
"conditionally-available": false,
|
"conditionally-available": false,
|
||||||
|
|
|
@ -59,12 +59,14 @@ enum
|
||||||
PROP_METADATACREATOR,
|
PROP_METADATACREATOR,
|
||||||
PROP_ENCODER,
|
PROP_ENCODER,
|
||||||
PROP_SKIP_BACKWARDS_STREAMS,
|
PROP_SKIP_BACKWARDS_STREAMS,
|
||||||
|
PROP_ENFORCE_INCREASING_TIMESTAMPS,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define DEFAULT_STREAMABLE FALSE
|
#define DEFAULT_STREAMABLE FALSE
|
||||||
#define MAX_INDEX_ENTRIES 128
|
#define MAX_INDEX_ENTRIES 128
|
||||||
#define DEFAULT_METADATACREATOR "GStreamer {VERSION} FLV muxer"
|
#define DEFAULT_METADATACREATOR "GStreamer {VERSION} FLV muxer"
|
||||||
#define DEFAULT_SKIP_BACKWARDS_STREAMS FALSE
|
#define DEFAULT_SKIP_BACKWARDS_STREAMS FALSE
|
||||||
|
#define DEFAULT_ENFORCE_INCREASING_TIMESTAMPS TRUE
|
||||||
|
|
||||||
static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src",
|
static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src",
|
||||||
GST_PAD_SRC,
|
GST_PAD_SRC,
|
||||||
|
@ -293,6 +295,23 @@ gst_flv_mux_class_init (GstFlvMuxClass * klass)
|
||||||
DEFAULT_SKIP_BACKWARDS_STREAMS,
|
DEFAULT_SKIP_BACKWARDS_STREAMS,
|
||||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GstFlvMux:enforce-increasing-timestamps:
|
||||||
|
*
|
||||||
|
* If set to true, flvmux will modify buffers timestamps to ensure they are always
|
||||||
|
* strictly increasing, inside one stream and also between the audio and video streams.
|
||||||
|
*
|
||||||
|
* Since: 1.24
|
||||||
|
*/
|
||||||
|
g_object_class_install_property (gobject_class,
|
||||||
|
PROP_ENFORCE_INCREASING_TIMESTAMPS,
|
||||||
|
g_param_spec_boolean ("enforce-increasing-timestamps",
|
||||||
|
"Enforce increasing timestamps",
|
||||||
|
"If set to true, flvmux will modify buffers timestamps to ensure they are always "
|
||||||
|
"strictly increasing, inside one stream and also between the audio and video streams",
|
||||||
|
DEFAULT_ENFORCE_INCREASING_TIMESTAMPS,
|
||||||
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
gstaggregator_class->create_new_pad =
|
gstaggregator_class->create_new_pad =
|
||||||
GST_DEBUG_FUNCPTR (gst_flv_mux_create_new_pad);
|
GST_DEBUG_FUNCPTR (gst_flv_mux_create_new_pad);
|
||||||
gstelement_class->release_pad = GST_DEBUG_FUNCPTR (gst_flv_mux_release_pad);
|
gstelement_class->release_pad = GST_DEBUG_FUNCPTR (gst_flv_mux_release_pad);
|
||||||
|
@ -330,6 +349,7 @@ gst_flv_mux_init (GstFlvMux * mux)
|
||||||
mux->streamable = DEFAULT_STREAMABLE;
|
mux->streamable = DEFAULT_STREAMABLE;
|
||||||
mux->metadatacreator = g_strdup (DEFAULT_METADATACREATOR);
|
mux->metadatacreator = g_strdup (DEFAULT_METADATACREATOR);
|
||||||
mux->encoder = g_strdup (DEFAULT_METADATACREATOR);
|
mux->encoder = g_strdup (DEFAULT_METADATACREATOR);
|
||||||
|
mux->enforce_increasing_timestamps = DEFAULT_ENFORCE_INCREASING_TIMESTAMPS;
|
||||||
|
|
||||||
mux->new_metadata = FALSE;
|
mux->new_metadata = FALSE;
|
||||||
|
|
||||||
|
@ -1263,7 +1283,7 @@ gst_flv_mux_buffer_to_tag_internal (GstFlvMux * mux, GstBuffer * buffer,
|
||||||
* it expects timestamps to go forward not only inside one stream, but
|
* it expects timestamps to go forward not only inside one stream, but
|
||||||
* also between the audio & video streams.
|
* also between the audio & video streams.
|
||||||
*/
|
*/
|
||||||
if (dts < mux->last_dts) {
|
if (dts < mux->last_dts && mux->enforce_increasing_timestamps) {
|
||||||
GST_WARNING_OBJECT (pad, "Got backwards dts! (%" GST_TIME_FORMAT
|
GST_WARNING_OBJECT (pad, "Got backwards dts! (%" GST_TIME_FORMAT
|
||||||
" < %" GST_TIME_FORMAT ")", GST_TIME_ARGS (dts * GST_MSECOND),
|
" < %" GST_TIME_FORMAT ")", GST_TIME_ARGS (dts * GST_MSECOND),
|
||||||
GST_TIME_ARGS (mux->last_dts * GST_MSECOND));
|
GST_TIME_ARGS (mux->last_dts * GST_MSECOND));
|
||||||
|
@ -2139,6 +2159,9 @@ gst_flv_mux_get_property (GObject * object,
|
||||||
case PROP_SKIP_BACKWARDS_STREAMS:
|
case PROP_SKIP_BACKWARDS_STREAMS:
|
||||||
g_value_set_boolean (value, mux->skip_backwards_streams);
|
g_value_set_boolean (value, mux->skip_backwards_streams);
|
||||||
break;
|
break;
|
||||||
|
case PROP_ENFORCE_INCREASING_TIMESTAMPS:
|
||||||
|
g_value_set_boolean (value, mux->enforce_increasing_timestamps);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
@ -2182,6 +2205,9 @@ gst_flv_mux_set_property (GObject * object,
|
||||||
case PROP_SKIP_BACKWARDS_STREAMS:
|
case PROP_SKIP_BACKWARDS_STREAMS:
|
||||||
mux->skip_backwards_streams = g_value_get_boolean (value);
|
mux->skip_backwards_streams = g_value_get_boolean (value);
|
||||||
break;
|
break;
|
||||||
|
case PROP_ENFORCE_INCREASING_TIMESTAMPS:
|
||||||
|
mux->enforce_increasing_timestamps = g_value_get_boolean (value);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -96,6 +96,7 @@ struct _GstFlvMux {
|
||||||
gchar *metadatacreator;
|
gchar *metadatacreator;
|
||||||
gchar *encoder;
|
gchar *encoder;
|
||||||
gboolean skip_backwards_streams;
|
gboolean skip_backwards_streams;
|
||||||
|
gboolean enforce_increasing_timestamps;
|
||||||
|
|
||||||
GstTagList *tags;
|
GstTagList *tags;
|
||||||
gboolean new_metadata;
|
gboolean new_metadata;
|
||||||
|
|
Loading…
Reference in a new issue