Revert "webrtcbin: fix msid line and allow customization"
This reverts commit 3cad3455377d5a22faa138d9df840257059776c8. That commit was breaking the association between an audio and a video track in the standard case. In practice, to support carrying separate MediaStream, we are going a way to map what MediaStreamTrack belong to what MediaStream, but that will require some thinking about the API. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2023>
This commit is contained in:
parent
fabf948194
commit
29de0e8e1d
@ -2724,23 +2724,6 @@ typedef struct
|
|||||||
WebRTCTransceiver *trans;
|
WebRTCTransceiver *trans;
|
||||||
} RtxSsrcData;
|
} RtxSsrcData;
|
||||||
|
|
||||||
/* https://tools.ietf.org/html/draft-ietf-mmusic-msid-16 */
|
|
||||||
static gchar *
|
|
||||||
_construct_msid (WebRTCTransceiver * trans, guint ssrc)
|
|
||||||
{
|
|
||||||
gchar *ret;
|
|
||||||
|
|
||||||
if (trans->msid_appdata) {
|
|
||||||
ret =
|
|
||||||
g_strdup_printf ("%u msid:%s %s", ssrc, GST_OBJECT_NAME (trans),
|
|
||||||
trans->msid_appdata);
|
|
||||||
} else {
|
|
||||||
ret = g_strdup_printf ("%u msid:%s", ssrc, GST_OBJECT_NAME (trans));
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
_media_add_rtx_ssrc (GQuark field_id, const GValue * value, RtxSsrcData * data)
|
_media_add_rtx_ssrc (GQuark field_id, const GValue * value, RtxSsrcData * data)
|
||||||
{
|
{
|
||||||
@ -2752,8 +2735,10 @@ _media_add_rtx_ssrc (GQuark field_id, const GValue * value, RtxSsrcData * data)
|
|||||||
/* http://www.freesoft.org/CIE/RFC/1889/24.htm */
|
/* http://www.freesoft.org/CIE/RFC/1889/24.htm */
|
||||||
cname = gst_structure_get_string (sdes, "cname");
|
cname = gst_structure_get_string (sdes, "cname");
|
||||||
|
|
||||||
str = _construct_msid (data->trans, g_value_get_uint (value));
|
/* https://tools.ietf.org/html/draft-ietf-mmusic-msid-16 */
|
||||||
|
str =
|
||||||
|
g_strdup_printf ("%u msid:%s %s", g_value_get_uint (value),
|
||||||
|
cname, GST_OBJECT_NAME (data->trans));
|
||||||
gst_sdp_media_add_attribute (data->media, "ssrc", str);
|
gst_sdp_media_add_attribute (data->media, "ssrc", str);
|
||||||
g_free (str);
|
g_free (str);
|
||||||
|
|
||||||
@ -2790,8 +2775,10 @@ _media_add_ssrcs (GstSDPMedia * media, GstCaps * caps, GstWebRTCBin * webrtc,
|
|||||||
if (gst_structure_get_uint (s, "ssrc", &ssrc)) {
|
if (gst_structure_get_uint (s, "ssrc", &ssrc)) {
|
||||||
gchar *str;
|
gchar *str;
|
||||||
|
|
||||||
str = _construct_msid (trans, ssrc);
|
/* https://tools.ietf.org/html/draft-ietf-mmusic-msid-16 */
|
||||||
|
str =
|
||||||
|
g_strdup_printf ("%u msid:%s %s", ssrc, cname,
|
||||||
|
GST_OBJECT_NAME (trans));
|
||||||
gst_sdp_media_add_attribute (media, "ssrc", str);
|
gst_sdp_media_add_attribute (media, "ssrc", str);
|
||||||
g_free (str);
|
g_free (str);
|
||||||
|
|
||||||
|
@ -38,7 +38,6 @@ G_DEFINE_TYPE_WITH_CODE (WebRTCTransceiver, webrtc_transceiver,
|
|||||||
#define DEFAULT_FEC_TYPE GST_WEBRTC_FEC_TYPE_NONE
|
#define DEFAULT_FEC_TYPE GST_WEBRTC_FEC_TYPE_NONE
|
||||||
#define DEFAULT_DO_NACK FALSE
|
#define DEFAULT_DO_NACK FALSE
|
||||||
#define DEFAULT_FEC_PERCENTAGE 100
|
#define DEFAULT_FEC_PERCENTAGE 100
|
||||||
#define DEFAULT_MSID_APPDATA NULL
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
@ -47,7 +46,6 @@ enum
|
|||||||
PROP_FEC_TYPE,
|
PROP_FEC_TYPE,
|
||||||
PROP_FEC_PERCENTAGE,
|
PROP_FEC_PERCENTAGE,
|
||||||
PROP_DO_NACK,
|
PROP_DO_NACK,
|
||||||
PROP_MSID_APPDATA,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -114,22 +112,6 @@ webrtc_transceiver_set_property (GObject * object, guint prop_id,
|
|||||||
case PROP_FEC_PERCENTAGE:
|
case PROP_FEC_PERCENTAGE:
|
||||||
trans->fec_percentage = g_value_get_uint (value);
|
trans->fec_percentage = g_value_get_uint (value);
|
||||||
break;
|
break;
|
||||||
case PROP_MSID_APPDATA:
|
|
||||||
{
|
|
||||||
gchar *new_msid_appdata = g_value_dup_string (value);
|
|
||||||
|
|
||||||
if (new_msid_appdata && strlen (new_msid_appdata) > 64) {
|
|
||||||
g_warning ("Msid appdata exceeds 64 characters: %s", new_msid_appdata);
|
|
||||||
g_free (new_msid_appdata);
|
|
||||||
} else {
|
|
||||||
if (trans->msid_appdata)
|
|
||||||
g_free (trans->msid_appdata);
|
|
||||||
|
|
||||||
trans->msid_appdata = new_msid_appdata;
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
||||||
@ -154,9 +136,6 @@ webrtc_transceiver_get_property (GObject * object, guint prop_id,
|
|||||||
case PROP_FEC_PERCENTAGE:
|
case PROP_FEC_PERCENTAGE:
|
||||||
g_value_set_uint (value, trans->fec_percentage);
|
g_value_set_uint (value, trans->fec_percentage);
|
||||||
break;
|
break;
|
||||||
case PROP_MSID_APPDATA:
|
|
||||||
g_value_set_string (value, trans->msid_appdata);
|
|
||||||
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;
|
||||||
@ -173,7 +152,6 @@ webrtc_transceiver_finalize (GObject * object)
|
|||||||
gst_clear_object (&trans->ulpfecdec);
|
gst_clear_object (&trans->ulpfecdec);
|
||||||
gst_clear_object (&trans->ulpfecenc);
|
gst_clear_object (&trans->ulpfecenc);
|
||||||
gst_clear_object (&trans->redenc);
|
gst_clear_object (&trans->redenc);
|
||||||
g_clear_pointer (&trans->msid_appdata, g_free);
|
|
||||||
|
|
||||||
if (trans->local_rtx_ssrc_map)
|
if (trans->local_rtx_ssrc_map)
|
||||||
gst_structure_free (trans->local_rtx_ssrc_map);
|
gst_structure_free (trans->local_rtx_ssrc_map);
|
||||||
@ -225,23 +203,6 @@ webrtc_transceiver_class_init (WebRTCTransceiverClass * klass)
|
|||||||
"The amount of Forward Error Correction to apply",
|
"The amount of Forward Error Correction to apply",
|
||||||
0, 100, DEFAULT_FEC_PERCENTAGE,
|
0, 100, DEFAULT_FEC_PERCENTAGE,
|
||||||
G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
/**
|
|
||||||
* WebRTCTransceiver:msid-appdata:
|
|
||||||
*
|
|
||||||
* The appdata part of the media stream id, must not exceed 64 characters.
|
|
||||||
*
|
|
||||||
* Consult https://datatracker.ietf.org/doc/html/draft-ietf-mmusic-msid-16#section-2
|
|
||||||
* for more details.
|
|
||||||
*
|
|
||||||
* Since: 1.22
|
|
||||||
*/
|
|
||||||
g_object_class_install_property (gobject_class,
|
|
||||||
PROP_MSID_APPDATA,
|
|
||||||
g_param_spec_string ("msid-appdata", "Msid appdata",
|
|
||||||
"The appdata part of the media stream id, must not exceed 64 characters",
|
|
||||||
NULL,
|
|
||||||
G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -47,7 +47,6 @@ struct _WebRTCTransceiver
|
|||||||
GstWebRTCFECType fec_type;
|
GstWebRTCFECType fec_type;
|
||||||
guint fec_percentage;
|
guint fec_percentage;
|
||||||
gboolean do_nack;
|
gboolean do_nack;
|
||||||
gchar *msid_appdata;
|
|
||||||
|
|
||||||
GstCaps *last_configured_caps;
|
GstCaps *last_configured_caps;
|
||||||
|
|
||||||
|
@ -4425,66 +4425,6 @@ GST_START_TEST (test_renego_rtx)
|
|||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
|
||||||
static void
|
|
||||||
_check_msid_appdata (struct test_webrtc *t, GstElement * element,
|
|
||||||
GstWebRTCSessionDescription * desc, gpointer expected)
|
|
||||||
{
|
|
||||||
guint i = 0;
|
|
||||||
|
|
||||||
for (i = 0; i < gst_sdp_message_medias_len (desc->sdp); i++) {
|
|
||||||
const GstSDPMedia *media = gst_sdp_message_get_media (desc->sdp, i);
|
|
||||||
|
|
||||||
if (g_strcmp0 (gst_sdp_media_get_media (media), "audio") == 0
|
|
||||||
|| g_strcmp0 (gst_sdp_media_get_media (media), "video") == 0) {
|
|
||||||
int j;
|
|
||||||
|
|
||||||
for (j = 0; j < gst_sdp_media_attributes_len (media); j++) {
|
|
||||||
const GstSDPAttribute *attr = gst_sdp_media_get_attribute (media, j);
|
|
||||||
|
|
||||||
if (!g_strcmp0 (attr->key, "ssrc")) {
|
|
||||||
gchar **split = g_strsplit (attr->value, " ", 3);
|
|
||||||
|
|
||||||
fail_unless (g_strv_length (split) >= 2);
|
|
||||||
|
|
||||||
if (g_str_has_prefix (split[1], "msid:")) {
|
|
||||||
if (expected) {
|
|
||||||
fail_unless_equals_int (g_strv_length (split), 3);
|
|
||||||
fail_unless_equals_string (split[2], expected);
|
|
||||||
} else {
|
|
||||||
fail_unless_equals_int (g_strv_length (split), 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
g_strfreev (split);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
GST_START_TEST (test_msid_appdata)
|
|
||||||
{
|
|
||||||
struct test_webrtc *t = create_audio_test ();
|
|
||||||
gchar *expected = g_strdup ("foobar");
|
|
||||||
GstWebRTCRTPTransceiver *trans;
|
|
||||||
|
|
||||||
VAL_SDP_INIT (offer, _check_msid_appdata, expected, NULL);
|
|
||||||
VAL_SDP_INIT (answer, _check_msid_appdata, expected, NULL);
|
|
||||||
|
|
||||||
g_signal_emit_by_name (t->webrtc1, "get-transceiver", 0, &trans);
|
|
||||||
g_object_set (trans, "msid-appdata", expected, NULL);
|
|
||||||
g_clear_object (&trans);
|
|
||||||
|
|
||||||
test_validate_sdp (t, &offer, &answer);
|
|
||||||
|
|
||||||
g_free (expected);
|
|
||||||
|
|
||||||
test_webrtc_free (t);
|
|
||||||
}
|
|
||||||
|
|
||||||
GST_END_TEST;
|
|
||||||
|
|
||||||
|
|
||||||
static Suite *
|
static Suite *
|
||||||
webrtcbin_suite (void)
|
webrtcbin_suite (void)
|
||||||
{
|
{
|
||||||
@ -4540,7 +4480,6 @@ webrtcbin_suite (void)
|
|||||||
tcase_add_test (tc, test_codec_preferences_incompatible_extmaps);
|
tcase_add_test (tc, test_codec_preferences_incompatible_extmaps);
|
||||||
tcase_add_test (tc, test_codec_preferences_invalid_extmap);
|
tcase_add_test (tc, test_codec_preferences_invalid_extmap);
|
||||||
tcase_add_test (tc, test_renego_rtx);
|
tcase_add_test (tc, test_renego_rtx);
|
||||||
tcase_add_test (tc, test_msid_appdata);
|
|
||||||
if (sctpenc && sctpdec) {
|
if (sctpenc && sctpdec) {
|
||||||
tcase_add_test (tc, test_data_channel_create);
|
tcase_add_test (tc, test_data_channel_create);
|
||||||
tcase_add_test (tc, test_data_channel_remote_notify);
|
tcase_add_test (tc, test_data_channel_remote_notify);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user