#else
PROP_LATENCY,
PROP_NETSIM,
- PROP_DROP_PROBABILITY_SENDER
+ PROP_DROP_PROBABILITY_SENDER,
+ PROP_DROP_PROBABILITY_RECEIVER
#endif
};
#ifdef TIZEN_FEATURE_IMPORT_NETSIM
static void
_insert_netsim_element_between (GstWebRTCBin * webrtc, GstElement * srcbin,
- const gchar * srcpadname, GstElement * sinkbin, const gchar * sinkpadname)
+ const gchar * srcpadname, GstElement * sinkbin, const gchar * sinkpadname,
+ uint32_t idx)
{
- GstElement *netsim = gst_element_factory_make ("netsim", NULL);
+ gboolean send = !g_strcmp0 (sinkpadname, "rtp_sink");
+ gchar *netsim_name = g_strdup_printf ("netsim_%s_%u",
+ send ? "send" : "recv", idx);
+ GstElement *netsim = gst_element_factory_make ("netsim", netsim_name);
+ g_free (netsim_name);
+
gst_bin_add (GST_BIN (webrtc), netsim);
- g_object_set (netsim, "drop-probability", webrtc->priv->drop_probability_sender, NULL);
+ g_object_set (netsim, "drop-probability",
+ send ? webrtc->priv->drop_probability_sender :
+ webrtc->priv->drop_probability_receiver, NULL);
gst_element_sync_state_with_parent (netsim);
if (!gst_element_link_pads (srcbin, srcpadname, netsim, "sink"))
#ifdef TIZEN_FEATURE_IMPORT_NETSIM
if (webrtc->priv->netsim) {
_insert_netsim_element_between (webrtc, GST_ELEMENT (webrtc->rtpbin), pad_name,
- GST_ELEMENT (trans->stream->send_bin), "rtp_sink");
+ GST_ELEMENT (trans->stream->send_bin), "rtp_sink", pad->mlineindex);
} else {
#endif
if (!gst_element_link_pads (GST_ELEMENT (webrtc->rtpbin), pad_name,
session_id, stream);
pad_name = g_strdup_printf ("recv_rtp_sink_%u", session_id);
+#ifdef TIZEN_FEATURE_IMPORT_NETSIM
+ if (webrtc->priv->netsim) {
+ _insert_netsim_element_between (webrtc, GST_ELEMENT (stream->receive_bin),
+ "rtp_src", GST_ELEMENT (webrtc->rtpbin), pad_name, session_id);
+ } else {
+#endif
if (!gst_element_link_pads (GST_ELEMENT (stream->receive_bin),
"rtp_src", GST_ELEMENT (webrtc->rtpbin), pad_name))
g_warn_if_reached ();
+#ifdef TIZEN_FEATURE_IMPORT_NETSIM
+ }
+#endif
g_free (pad_name);
gst_element_sync_state_with_parent (GST_ELEMENT (stream->receive_bin));
#ifdef TIZEN_FEATURE_IMPORT_NETSIM
if (webrtc->priv->netsim) {
_insert_netsim_element_between (webrtc, GST_ELEMENT (webrtc->rtpbin), pad_name,
- GST_ELEMENT (stream->send_bin), "rtp_sink");
+ GST_ELEMENT (stream->send_bin), "rtp_sink", session_id);
} else {
#endif
if (!gst_element_link_pads (GST_ELEMENT (webrtc->rtpbin), pad_name,
#ifdef TIZEN_FEATURE_IMPORT_NETSIM
static void
-_update_drop_probability (GstWebRTCBin * webrtc, gfloat probability)
+_update_drop_probability (GstWebRTCBin * webrtc, gfloat probability, gboolean sender)
{
GValue value = G_VALUE_INIT;
GstElement *element;
while (gst_iterator_next (bin_iterator, &value) == GST_ITERATOR_OK) {
element = GST_ELEMENT (g_value_get_object (&value));
- if (g_strrstr (GST_ELEMENT_NAME (element), "netsim"))
+ if (g_strrstr (GST_ELEMENT_NAME (element), sender ? "netsim_send" : "netsim_recv"))
g_object_set (element, "drop-probability", probability, NULL);
g_value_reset (&value);
}
case PROP_NETSIM:
webrtc->priv->netsim = g_value_get_boolean (value);
_update_drop_probability (webrtc, webrtc->priv->netsim ?
- webrtc->priv->drop_probability_sender : 0.0);
+ webrtc->priv->drop_probability_sender : 0.0, TRUE);
+ _update_drop_probability (webrtc, webrtc->priv->netsim ?
+ webrtc->priv->drop_probability_receiver : 0.0, FALSE);
break;
case PROP_DROP_PROBABILITY_SENDER:
webrtc->priv->drop_probability_sender = g_value_get_float (value);
- _update_drop_probability (webrtc, webrtc->priv->drop_probability_sender);
+ _update_drop_probability (webrtc, webrtc->priv->drop_probability_sender, TRUE);
+ break;
+ case PROP_DROP_PROBABILITY_RECEIVER:
+ webrtc->priv->drop_probability_receiver = g_value_get_float (value);
+ _update_drop_probability (webrtc, webrtc->priv->drop_probability_receiver, FALSE);
break;
#endif
default:
case PROP_DROP_PROBABILITY_SENDER:
g_value_set_float (value, webrtc->priv->drop_probability_sender);
break;
+ case PROP_DROP_PROBABILITY_RECEIVER:
+ g_value_set_float (value, webrtc->priv->drop_probability_receiver);
+ break;
#endif
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
0.0, 1.0, 0.0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (gobject_class,
+ PROP_DROP_PROBABILITY_RECEIVER,
+ g_param_spec_float ("drop-probability-receiver", "Drop Probability for receiver",
+ "The Probability a received RTP buffer is dropped",
+ 0.0, 1.0, 0.0,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS));
+
#endif
/**
* GstWebRTCBin::create-offer: