rtmp2: Allow setting flash-version

In case the application has to deal with fussy servers. User agent
sniffing is so last decade.

Adds a property to set the Flash version on both the sink and the src.
The default stays the same (IIRC, Flash plugin for Linux from 2009).
This commit is contained in:
Jan Alexander Steffens (heftig) 2020-02-25 14:58:23 +01:00
parent 69ef74d96a
commit 91a033a85e
No known key found for this signature in database
GPG key ID: DE5E0C5F25941CA5
4 changed files with 37 additions and 1 deletions

View file

@ -33,6 +33,7 @@
#define DEFAULT_PASSWORD NULL
#define DEFAULT_AUTHMOD GST_RTMP_AUTHMOD_AUTO
#define DEFAULT_TIMEOUT 5
#define DEFAULT_FLASH_VERSION "LNX 10,0,32,18"
G_DEFINE_INTERFACE (GstRtmpLocationHandler, gst_rtmp_location_handler, 0);
@ -88,6 +89,10 @@ gst_rtmp_location_handler_default_init (GstRtmpLocationHandlerInterface * iface)
"TLS validation flags to use", G_TYPE_TLS_CERTIFICATE_FLAGS,
G_TLS_CERTIFICATE_VALIDATE_ALL,
G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_interface_install_property (iface,
g_param_spec_string ("flash-version", "Flash version",
"Flash version reported to the server", DEFAULT_FLASH_VERSION,
G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
}
static GstURIType

View file

@ -141,6 +141,7 @@ enum
PROP_AUTHMOD,
PROP_TIMEOUT,
PROP_TLS_VALIDATION_FLAGS,
PROP_FLASH_VERSION,
PROP_ASYNC_CONNECT,
PROP_PEAK_KBPS,
PROP_CHUNK_SIZE,
@ -201,6 +202,8 @@ gst_rtmp2_sink_class_init (GstRtmp2SinkClass * klass)
g_object_class_override_property (gobject_class, PROP_TIMEOUT, "timeout");
g_object_class_override_property (gobject_class, PROP_TLS_VALIDATION_FLAGS,
"tls-validation-flags");
g_object_class_override_property (gobject_class, PROP_FLASH_VERSION,
"flash-version");
g_object_class_install_property (gobject_class, PROP_ASYNC_CONNECT,
g_param_spec_boolean ("async-connect", "Async connect",
@ -323,6 +326,12 @@ gst_rtmp2_sink_set_property (GObject * object, guint property_id,
self->location.tls_flags = g_value_get_flags (value);
GST_OBJECT_UNLOCK (self);
break;
case PROP_FLASH_VERSION:
GST_OBJECT_LOCK (self);
g_free (self->location.flash_ver);
self->location.flash_ver = g_value_dup_string (value);
GST_OBJECT_UNLOCK (self);
break;
case PROP_ASYNC_CONNECT:
GST_OBJECT_LOCK (self);
self->async_connect = g_value_get_boolean (value);
@ -422,6 +431,11 @@ gst_rtmp2_sink_get_property (GObject * object, guint property_id,
g_value_set_flags (value, self->location.tls_flags);
GST_OBJECT_UNLOCK (self);
break;
case PROP_FLASH_VERSION:
GST_OBJECT_LOCK (self);
g_value_set_string (value, self->location.flash_ver);
GST_OBJECT_UNLOCK (self);
break;
case PROP_ASYNC_CONNECT:
GST_OBJECT_LOCK (self);
g_value_set_boolean (value, self->async_connect);

View file

@ -130,6 +130,7 @@ enum
PROP_AUTHMOD,
PROP_TIMEOUT,
PROP_TLS_VALIDATION_FLAGS,
PROP_FLASH_VERSION,
PROP_ASYNC_CONNECT,
PROP_STATS,
};
@ -187,6 +188,8 @@ gst_rtmp2_src_class_init (GstRtmp2SrcClass * klass)
g_object_class_override_property (gobject_class, PROP_TIMEOUT, "timeout");
g_object_class_override_property (gobject_class, PROP_TLS_VALIDATION_FLAGS,
"tls-validation-flags");
g_object_class_override_property (gobject_class, PROP_FLASH_VERSION,
"flash-version");
g_object_class_install_property (gobject_class, PROP_ASYNC_CONNECT,
g_param_spec_boolean ("async-connect", "Async connect",
@ -292,6 +295,12 @@ gst_rtmp2_src_set_property (GObject * object, guint property_id,
self->location.tls_flags = g_value_get_flags (value);
GST_OBJECT_UNLOCK (self);
break;
case PROP_FLASH_VERSION:
GST_OBJECT_LOCK (self);
g_free (self->location.flash_ver);
self->location.flash_ver = g_value_dup_string (value);
GST_OBJECT_UNLOCK (self);
break;
case PROP_ASYNC_CONNECT:
GST_OBJECT_LOCK (self);
self->async_connect = g_value_get_boolean (value);
@ -371,6 +380,11 @@ gst_rtmp2_src_get_property (GObject * object, guint property_id,
g_value_set_flags (value, self->location.tls_flags);
GST_OBJECT_UNLOCK (self);
break;
case PROP_FLASH_VERSION:
GST_OBJECT_LOCK (self);
g_value_set_string (value, self->location.flash_ver);
GST_OBJECT_UNLOCK (self);
break;
case PROP_ASYNC_CONNECT:
GST_OBJECT_LOCK (self);
g_value_set_boolean (value, self->async_connect);

View file

@ -513,7 +513,10 @@ send_connect (GTask * task)
}
if (!flash_ver) {
flash_ver = "LNX 10,0,32,18";
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_NOT_INITIALIZED,
"Flash version is not set");
g_object_unref (task);
goto out;
}
if (data->auth_query) {