rtspsrc: use use-rtsp-buffering property of rtpbin
[platform/upstream/gst-plugins-good.git] / gst / rtsp / gstrtspsrc.c
index d636073..bad09a3 100644 (file)
@@ -42,6 +42,7 @@
  */
 /**
  * SECTION:element-rtspsrc
+ * @title: rtspsrc
  *
  * Makes a connection to an RTSP server and read the data.
  * rtspsrc strictly follows RFC 2326 and therefore does not (yet) support
  * rtspsrc acts like a live source and will therefore only generate data in the
  * PLAYING state.
  *
- * <refsect2>
- * <title>Example launch line</title>
+ * If a RTP session times out then the rtspsrc will generate an element message
+ * named "GstRTSPSrcTimeout". Currently this is only supported for timeouts
+ * triggered by RTCP.
+ *
+ * The message's structure contains three fields:
+ *
+ *   #GstRTSPSrcTimeoutCause `cause`: the cause of the timeout.
+ *
+ *   #gint `stream-number`: an internal identifier of the stream that timed out.
+ *
+ *   #guint `ssrc`: the SSRC of the stream that timed out.
+ *
+ * ## Example launch line
  * |[
  * gst-launch-1.0 rtspsrc location=rtsp://some.server/url ! fakesink
  * ]| Establish a connection to an RTSP server and send the raw RTP packets to a
  * fakesink.
- * </refsect2>
+ *
  */
 
 #ifdef HAVE_CONFIG_H
@@ -126,6 +138,10 @@ enum
   SIGNAL_REQUEST_RTCP_KEY,
   SIGNAL_ACCEPT_CERTIFICATE,
   SIGNAL_BEFORE_SEND,
+  SIGNAL_PUSH_BACKCHANNEL_BUFFER,
+  SIGNAL_GET_PARAMETER,
+  SIGNAL_GET_PARAMETERS,
+  SIGNAL_SET_PARAMETER,
   LAST_SIGNAL
 };
 
@@ -200,6 +216,32 @@ gst_rtsp_src_ntp_time_source_get_type (void)
   return ntp_time_source_type;
 }
 
+enum _GstRtspBackchannel
+{
+  BACKCHANNEL_NONE,
+  BACKCHANNEL_ONVIF
+};
+
+#define GST_TYPE_RTSP_BACKCHANNEL (gst_rtsp_backchannel_get_type())
+static GType
+gst_rtsp_backchannel_get_type (void)
+{
+  static GType backchannel_type = 0;
+  static const GEnumValue backchannel_values[] = {
+    {BACKCHANNEL_NONE, "No backchannel", "none"},
+    {BACKCHANNEL_ONVIF, "ONVIF audio backchannel", "onvif"},
+    {0, NULL, NULL},
+  };
+
+  if (G_UNLIKELY (backchannel_type == 0)) {
+    backchannel_type =
+        g_enum_register_static ("GstRTSPBackchannel", backchannel_values);
+  }
+  return backchannel_type;
+}
+
+#define BACKCHANNEL_ONVIF_HDR_REQUIRE_VAL "www.onvif.org/ver20/backchannel"
+
 #define DEFAULT_LOCATION         NULL
 #define DEFAULT_PROTOCOLS        GST_RTSP_LOWER_TRANS_UDP | GST_RTSP_LOWER_TRANS_UDP_MCAST | GST_RTSP_LOWER_TRANS_TCP
 #define DEFAULT_DEBUG            FALSE
@@ -236,6 +278,12 @@ gst_rtsp_src_ntp_time_source_get_type (void)
 #define DEFAULT_MAX_TS_OFFSET_ADJUSTMENT   G_GUINT64_CONSTANT(0)
 #define DEFAULT_MAX_TS_OFFSET   G_GINT64_CONSTANT(3000000000)
 #define DEFAULT_VERSION         GST_RTSP_VERSION_1_0
+#define DEFAULT_BACKCHANNEL  GST_RTSP_BACKCHANNEL_NONE
+#define DEFAULT_TEARDOWN_TIMEOUT  (100 * GST_MSECOND)
+
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+#define DEFAULT_START_POSITION   0
+#endif
 
 enum
 {
@@ -245,6 +293,10 @@ enum
   PROP_DEBUG,
   PROP_RETRY,
   PROP_TIMEOUT,
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+  PROP_START_POSITION,
+  PROP_RESUME_POSITION,
+#endif
   PROP_TCP_TIMEOUT,
   PROP_LATENCY,
   PROP_DROP_ON_LATENCY,
@@ -279,6 +331,8 @@ enum
   PROP_MAX_TS_OFFSET_ADJUSTMENT,
   PROP_MAX_TS_OFFSET,
   PROP_DEFAULT_VERSION,
+  PROP_BACKCHANNEL,
+  PROP_TEARDOWN_TIMEOUT,
 };
 
 #define GST_TYPE_RTSP_NAT_METHOD (gst_rtsp_nat_method_get_type())
@@ -307,6 +361,14 @@ gst_rtsp_nat_method_get_type (void)
          "rtsp-status-reason", G_TYPE_STRING, GST_STR_NULL((response_msg)->type_data.response.reason), NULL)); \
   } while (0)
 
+typedef struct _ParameterRequest
+{
+  gint cmd;
+  gchar *content_type;
+  GString *body;
+  GstPromise *promise;
+} ParameterRequest;
+
 static void gst_rtspsrc_finalize (GObject * object);
 
 static void gst_rtspsrc_set_property (GObject * object, guint prop_id,
@@ -359,6 +421,24 @@ gst_rtspsrc_print_rtsp_message (GstRTSPSrc * src, const GstRTSPMessage * msg);
 static void
 gst_rtspsrc_print_sdp_message (GstRTSPSrc * src, const GstSDPMessage * msg);
 
+static GstRTSPResult
+gst_rtspsrc_get_parameter (GstRTSPSrc * src, ParameterRequest * req);
+
+static GstRTSPResult
+gst_rtspsrc_set_parameter (GstRTSPSrc * src, ParameterRequest * req);
+
+static gboolean get_parameter (GstRTSPSrc * src, const gchar * parameter,
+    const gchar * content_type, GstPromise * promise);
+
+static gboolean get_parameters (GstRTSPSrc * src, gchar ** parameters,
+    const gchar * content_type, GstPromise * promise);
+
+static gboolean set_parameter (GstRTSPSrc * src, const gchar * name,
+    const gchar * value, const gchar * content_type, GstPromise * promise);
+
+static GstFlowReturn gst_rtspsrc_push_backchannel_buffer (GstRTSPSrc * src,
+    guint id, GstSample * sample);
+
 typedef struct
 {
   guint8 pt;
@@ -366,16 +446,18 @@ typedef struct
 } PtMapItem;
 
 /* commands we send to out loop to notify it of events */
-#define CMD_OPEN       (1 << 0)
-#define CMD_PLAY       (1 << 1)
-#define CMD_PAUSE      (1 << 2)
-#define CMD_CLOSE      (1 << 3)
-#define CMD_WAIT       (1 << 4)
-#define CMD_RECONNECT  (1 << 5)
-#define CMD_LOOP       (1 << 6)
+#define CMD_OPEN            (1 << 0)
+#define CMD_PLAY            (1 << 1)
+#define CMD_PAUSE           (1 << 2)
+#define CMD_CLOSE           (1 << 3)
+#define CMD_WAIT            (1 << 4)
+#define CMD_RECONNECT       (1 << 5)
+#define CMD_LOOP            (1 << 6)
+#define CMD_GET_PARAMETER   (1 << 7)
+#define CMD_SET_PARAMETER   (1 << 8)
 
 /* mask for all commands */
-#define CMD_ALL         ((CMD_LOOP << 1) - 1)
+#define CMD_ALL         ((CMD_SET_PARAMETER << 1) - 1)
 
 #define GST_ELEMENT_PROGRESS(el, type, code, text)      \
 G_STMT_START {                                          \
@@ -411,12 +493,42 @@ cmd_to_string (guint cmd)
       return "RECONNECT";
     case CMD_LOOP:
       return "LOOP";
+    case CMD_GET_PARAMETER:
+      return "GET_PARAMETER";
+    case CMD_SET_PARAMETER:
+      return "SET_PARAMETER";
   }
 
   return "unknown";
 }
 #endif
 
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+static void
+gst_rtspsrc_post_error_message (GstRTSPSrc * src, GstRTSPSrcError error_id,
+    const gchar * error_string)
+{
+  GstMessage *message;
+  GstStructure *structure;
+  gboolean ret = TRUE;
+
+  GST_ERROR_OBJECT (src, "[%d] %s", error_id, error_string);
+
+  structure = gst_structure_new ("streaming_error",
+      "error_id", G_TYPE_UINT, error_id,
+      "error_string", G_TYPE_STRING, error_string, NULL);
+
+  message =
+      gst_message_new_custom (GST_MESSAGE_ERROR, GST_OBJECT (src), structure);
+
+  ret = gst_element_post_message (GST_ELEMENT (src), message);
+  if (!ret)
+    GST_ERROR_OBJECT (src, "fail to post error message.");
+
+  return;
+}
+#endif
+
 static gboolean
 default_select_stream (GstRTSPSrc * src, guint id, GstCaps * caps)
 {
@@ -504,7 +616,18 @@ gst_rtspsrc_class_init (GstRTSPSrcClass * klass)
           "Retry TCP transport after UDP timeout microseconds (0 = disabled)",
           0, G_MAXUINT64, DEFAULT_TIMEOUT,
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
-
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+  g_object_class_install_property (gobject_class, PROP_START_POSITION,
+      g_param_spec_uint64 ("pending-start-position", "set start position",
+          "Set start position before PLAYING request.",
+          0, G_MAXUINT64, DEFAULT_START_POSITION,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+  g_object_class_install_property (gobject_class, PROP_RESUME_POSITION,
+      g_param_spec_uint64 ("resume-position", "set resume position",
+          "Set resume position before PLAYING request after pause.",
+          0, G_MAXUINT64, DEFAULT_START_POSITION,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+#endif
   g_object_class_install_property (gobject_class, PROP_TCP_TIMEOUT,
       g_param_spec_uint64 ("tcp-timeout", "TCP Timeout",
           "Fail after timeout microseconds on TCP connections (0 = disabled)",
@@ -627,7 +750,7 @@ gst_rtspsrc_class_init (GstRTSPSrcClass * klass)
   /**
    * GstRTSPSrc:port-range:
    *
-   * Configure the client port numbers that can be used to recieve RTP and
+   * Configure the client port numbers that can be used to receive RTP and
    * RTCP.
    */
   g_object_class_install_property (gobject_class, PROP_PORT_RANGE,
@@ -816,7 +939,7 @@ gst_rtspsrc_class_init (GstRTSPSrcClass * klass)
           G_PARAM_STATIC_STRINGS));
 
   /**
-   * GstRtpBin:max-ts-offset:
+   * GstRTSPSrc:max-ts-offset:
    *
    * Used to set an upper limit of how large a time offset may be. This
    * is used to protect against unrealistic values as a result of either
@@ -830,6 +953,35 @@ gst_rtspsrc_class_init (GstRTSPSrcClass * klass)
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
   /**
+   * GstRTSPSrc:backchannel
+   *
+   * Select a type of backchannel to setup with the RTSP server.
+   * Default value is "none". Allowed values are "none" and "onvif".
+   *
+   * Since: 1.14
+   */
+  g_object_class_install_property (gobject_class, PROP_BACKCHANNEL,
+      g_param_spec_enum ("backchannel", "Backchannel type",
+          "The type of backchannel to setup. Default is 'none'.",
+          GST_TYPE_RTSP_BACKCHANNEL, BACKCHANNEL_NONE,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  /**
+   * GstRtspSrc:teardown-timeout
+   *
+   * When transitioning PAUSED-READY, allow up to timeout (in nanoseconds)
+   * delay in order to send teardown (0 = disabled)
+   *
+   * Since: 1.14
+   */
+  g_object_class_install_property (gobject_class, PROP_TEARDOWN_TIMEOUT,
+      g_param_spec_uint64 ("teardown-timeout", "Teardown Timeout",
+          "When transitioning PAUSED-READY, allow up to timeout (in nanoseconds) "
+          "delay in order to send teardown (0 = disabled)",
+          0, G_MAXUINT64, DEFAULT_TEARDOWN_TIMEOUT,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  /**
    * GstRTSPSrc::handle-request:
    * @rtspsrc: a #GstRTSPSrc
    * @request: a #GstRTSPMessage
@@ -855,7 +1007,7 @@ gst_rtspsrc_class_init (GstRTSPSrcClass * klass)
    * @rtspsrc: a #GstRTSPSrc
    * @sdp: a #GstSDPMessage
    *
-   * Emited when the client has retrieved the SDP and before it configures the
+   * Emitted when the client has retrieved the SDP and before it configures the
    * streams in the SDP. @sdp can be inspected and modified.
    *
    * This signal is called from the streaming thread, you should therefore not
@@ -877,7 +1029,7 @@ gst_rtspsrc_class_init (GstRTSPSrcClass * klass)
    * @num: the stream number
    * @caps: the stream caps
    *
-   * Emited before the client decides to configure the stream @num with
+   * Emitted before the client decides to configure the stream @num with
    * @caps.
    *
    * Returns: %TRUE when the stream should be selected, %FALSE when the stream
@@ -896,7 +1048,7 @@ gst_rtspsrc_class_init (GstRTSPSrcClass * klass)
    * @rtspsrc: a #GstRTSPSrc
    * @manager: a #GstElement
    *
-   * Emited after a new manager (like rtpbin) was created and the default
+   * Emitted after a new manager (like rtpbin) was created and the default
    * properties were configured.
    *
    * Since: 1.4
@@ -911,7 +1063,7 @@ gst_rtspsrc_class_init (GstRTSPSrcClass * klass)
    * @rtspsrc: a #GstRTSPSrc
    * @num: the stream number
    *
-   * Signal emited to get the crypto parameters relevant to the RTCP
+   * Signal emitted to get the crypto parameters relevant to the RTCP
    * stream. User should provide the key and the RTCP encryption ciphers
    * and authentication, and return them wrapped in a GstCaps.
    *
@@ -965,6 +1117,75 @@ gst_rtspsrc_class_init (GstRTSPSrcClass * klass)
       g_cclosure_marshal_generic, G_TYPE_BOOLEAN,
       1, GST_TYPE_RTSP_MESSAGE | G_SIGNAL_TYPE_STATIC_SCOPE);
 
+  /**
+   * GstRTSPSrc::push-backchannel-buffer:
+   * @rtspsrc: a #GstRTSPSrc
+   * @buffer: RTP buffer to send back
+   *
+   *
+   */
+  gst_rtspsrc_signals[SIGNAL_PUSH_BACKCHANNEL_BUFFER] =
+      g_signal_new ("push-backchannel-buffer", G_TYPE_FROM_CLASS (klass),
+      G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GstRTSPSrcClass,
+          push_backchannel_buffer), NULL, NULL, NULL, GST_TYPE_FLOW_RETURN, 2,
+      G_TYPE_UINT, GST_TYPE_BUFFER);
+
+  /**
+   * GstRTSPSrc::get-parameter:
+   * @rtspsrc: a #GstRTSPSrc
+   * @parameter: the parameter name
+   * @parameter: the content type
+   * @parameter: a pointer to #GstPromise
+   *
+   * Handle the GET_PARAMETER signal.
+   *
+   * Returns: %TRUE when the command could be issued, %FALSE otherwise
+   *
+   */
+  gst_rtspsrc_signals[SIGNAL_GET_PARAMETER] =
+      g_signal_new ("get-parameter", G_TYPE_FROM_CLASS (klass),
+      G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GstRTSPSrcClass,
+          get_parameter), NULL, NULL, g_cclosure_marshal_generic,
+      G_TYPE_BOOLEAN, 3, G_TYPE_STRING, G_TYPE_STRING, GST_TYPE_PROMISE);
+
+  /**
+   * GstRTSPSrc::get-parameters:
+   * @rtspsrc: a #GstRTSPSrc
+   * @parameter: a NULL-terminated array of parameters
+   * @parameter: the content type
+   * @parameter: a pointer to #GstPromise
+   *
+   * Handle the GET_PARAMETERS signal.
+   *
+   * Returns: %TRUE when the command could be issued, %FALSE otherwise
+   *
+   */
+  gst_rtspsrc_signals[SIGNAL_GET_PARAMETERS] =
+      g_signal_new ("get-parameters", G_TYPE_FROM_CLASS (klass),
+      G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GstRTSPSrcClass,
+          get_parameters), NULL, NULL, g_cclosure_marshal_generic,
+      G_TYPE_BOOLEAN, 3, G_TYPE_STRV, G_TYPE_STRING, GST_TYPE_PROMISE);
+
+  /**
+   * GstRTSPSrc::set-parameter:
+   * @rtspsrc: a #GstRTSPSrc
+   * @parameter: the parameter name
+   * @parameter: the parameter value
+   * @parameter: the content type
+   * @parameter: a pointer to #GstPromise
+   *
+   * Handle the SET_PARAMETER signal.
+   *
+   * Returns: %TRUE when the command could be issued, %FALSE otherwise
+   *
+   */
+  gst_rtspsrc_signals[SIGNAL_SET_PARAMETER] =
+      g_signal_new ("set-parameter", G_TYPE_FROM_CLASS (klass),
+      G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GstRTSPSrcClass,
+          set_parameter), NULL, NULL, g_cclosure_marshal_generic,
+      G_TYPE_BOOLEAN, 4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
+      GST_TYPE_PROMISE);
+
   gstelement_class->send_event = gst_rtspsrc_send_event;
   gstelement_class->provide_clock = gst_rtspsrc_provide_clock;
   gstelement_class->change_state = gst_rtspsrc_change_state;
@@ -980,9 +1201,142 @@ gst_rtspsrc_class_init (GstRTSPSrcClass * klass)
 
   gstbin_class->handle_message = gst_rtspsrc_handle_message;
 
+  klass->push_backchannel_buffer = gst_rtspsrc_push_backchannel_buffer;
+  klass->get_parameter = GST_DEBUG_FUNCPTR (get_parameter);
+  klass->get_parameters = GST_DEBUG_FUNCPTR (get_parameters);
+  klass->set_parameter = GST_DEBUG_FUNCPTR (set_parameter);
+
   gst_rtsp_ext_list_init ();
 }
 
+static gboolean
+validate_set_get_parameter_name (const gchar * parameter_name)
+{
+  gchar *ptr = (gchar *) parameter_name;
+
+  while (*ptr) {
+    /* Don't allow '\r', '\n', \'t', ' ' etc in the parameter name */
+    if (g_ascii_isspace (*ptr) || g_ascii_iscntrl (*ptr)) {
+      GST_DEBUG ("invalid parameter name '%s'", parameter_name);
+      return FALSE;
+    }
+    ptr++;
+  }
+  return TRUE;
+}
+
+static gboolean
+validate_set_get_parameters (gchar ** parameter_names)
+{
+  while (*parameter_names) {
+    if (!validate_set_get_parameter_name (*parameter_names)) {
+      return FALSE;
+    }
+    parameter_names++;
+  }
+  return TRUE;
+}
+
+static gboolean
+get_parameter (GstRTSPSrc * src, const gchar * parameter,
+    const gchar * content_type, GstPromise * promise)
+{
+  gchar *parameters[] = { (gchar *) parameter, NULL };
+
+  GST_LOG_OBJECT (src, "get_parameter: %s", GST_STR_NULL (parameter));
+
+  if (parameter == NULL || parameter[0] == '\0' || promise == NULL) {
+    GST_DEBUG ("invalid input");
+    return FALSE;
+  }
+
+  return get_parameters (src, parameters, content_type, promise);
+}
+
+static gboolean
+get_parameters (GstRTSPSrc * src, gchar ** parameters,
+    const gchar * content_type, GstPromise * promise)
+{
+  ParameterRequest *req;
+
+  GST_LOG_OBJECT (src, "get_parameters: %d", g_strv_length (parameters));
+
+  if (parameters == NULL || promise == NULL) {
+    GST_DEBUG ("invalid input");
+    return FALSE;
+  }
+
+  if (src->state == GST_RTSP_STATE_INVALID) {
+    GST_DEBUG ("invalid state");
+    return FALSE;
+  }
+
+  if (!validate_set_get_parameters (parameters)) {
+    return FALSE;
+  }
+
+  req = g_new0 (ParameterRequest, 1);
+  req->promise = gst_promise_ref (promise);
+  req->cmd = CMD_GET_PARAMETER;
+  /* Set the request body according to RFC 2326 or RFC 7826 */
+  req->body = g_string_new (NULL);
+  while (*parameters) {
+    g_string_append_printf (req->body, "%s:\r\n", *parameters);
+    parameters++;
+  }
+  if (content_type)
+    req->content_type = g_strdup (content_type);
+
+  GST_OBJECT_LOCK (src);
+  g_queue_push_tail (&src->set_get_param_q, req);
+  GST_OBJECT_UNLOCK (src);
+
+  gst_rtspsrc_loop_send_cmd (src, CMD_GET_PARAMETER, CMD_LOOP);
+
+  return TRUE;
+}
+
+static gboolean
+set_parameter (GstRTSPSrc * src, const gchar * name, const gchar * value,
+    const gchar * content_type, GstPromise * promise)
+{
+  ParameterRequest *req;
+
+  GST_LOG_OBJECT (src, "set_parameter: %s: %s", GST_STR_NULL (name),
+      GST_STR_NULL (value));
+
+  if (name == NULL || name[0] == '\0' || value == NULL || promise == NULL) {
+    GST_DEBUG ("invalid input");
+    return FALSE;
+  }
+
+  if (src->state == GST_RTSP_STATE_INVALID) {
+    GST_DEBUG ("invalid state");
+    return FALSE;
+  }
+
+  if (!validate_set_get_parameter_name (name)) {
+    return FALSE;
+  }
+
+  req = g_new0 (ParameterRequest, 1);
+  req->cmd = CMD_SET_PARAMETER;
+  req->promise = gst_promise_ref (promise);
+  req->body = g_string_new (NULL);
+  /* Set the request body according to RFC 2326 or RFC 7826 */
+  g_string_append_printf (req->body, "%s: %s\r\n", name, value);
+  if (content_type)
+    req->content_type = g_strdup (content_type);
+
+  GST_OBJECT_LOCK (src);
+  g_queue_push_tail (&src->set_get_param_q, req);
+  GST_OBJECT_UNLOCK (src);
+
+  gst_rtspsrc_loop_send_cmd (src, CMD_SET_PARAMETER, CMD_LOOP);
+
+  return TRUE;
+}
+
 static void
 gst_rtspsrc_init (GstRTSPSrc * src)
 {
@@ -991,6 +1345,14 @@ gst_rtspsrc_init (GstRTSPSrc * src)
   src->debug = DEFAULT_DEBUG;
   src->retry = DEFAULT_RETRY;
   src->udp_timeout = DEFAULT_TIMEOUT;
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+  src->start_position = DEFAULT_START_POSITION;
+  src->is_audio_codec_supported = FALSE;
+  src->is_video_codec_supported = FALSE;
+  src->audio_codec = NULL;
+  src->video_codec = NULL;
+  src->video_frame_size = NULL;
+#endif
   gst_rtspsrc_set_tcp_timeout (src, DEFAULT_TCP_TIMEOUT);
   src->latency = DEFAULT_LATENCY_MS;
   src->drop_on_latency = DEFAULT_DROP_ON_LATENCY;
@@ -1026,7 +1388,12 @@ gst_rtspsrc_init (GstRTSPSrc * src)
   src->max_ts_offset_is_set = FALSE;
   src->default_version = DEFAULT_VERSION;
   src->version = GST_RTSP_VERSION_INVALID;
+  src->teardown_timeout = DEFAULT_TEARDOWN_TIMEOUT;
 
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+  g_mutex_init (&(src)->pause_lock);
+  g_cond_init (&(src)->open_end);
+#endif
   /* get a list of all extensions */
   src->extensions = gst_rtsp_ext_list_get ();
 
@@ -1041,10 +1408,13 @@ gst_rtspsrc_init (GstRTSPSrc * src)
   /* protects our state changes from multiple invocations */
   g_rec_mutex_init (&src->state_rec_lock);
 
+  g_queue_init (&src->set_get_param_q);
+
   src->state = GST_RTSP_STATE_INVALID;
 
   g_mutex_init (&src->conninfo.send_lock);
   g_mutex_init (&src->conninfo.recv_lock);
+  g_cond_init (&src->cmd_cond);
 
   GST_OBJECT_FLAG_SET (src, GST_ELEMENT_FLAG_SOURCE);
   gst_bin_set_suppressed_flags (GST_BIN (src),
@@ -1052,12 +1422,47 @@ gst_rtspsrc_init (GstRTSPSrc * src)
 }
 
 static void
+free_param_data (ParameterRequest * req)
+{
+  gst_promise_unref (req->promise);
+  if (req->body)
+    g_string_free (req->body, TRUE);
+  g_free (req->content_type);
+  g_free (req);
+}
+
+static void
+free_param_queue (gpointer data)
+{
+  ParameterRequest *req = data;
+
+  gst_promise_expire (req->promise);
+  free_param_data (req);
+}
+
+static void
 gst_rtspsrc_finalize (GObject * object)
 {
   GstRTSPSrc *rtspsrc;
 
   rtspsrc = GST_RTSPSRC (object);
 
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+  rtspsrc->is_audio_codec_supported = FALSE;
+  rtspsrc->is_video_codec_supported = FALSE;
+  if (rtspsrc->audio_codec) {
+    g_free (rtspsrc->audio_codec);
+    rtspsrc->audio_codec = NULL;
+  }
+  if (rtspsrc->video_codec) {
+    g_free (rtspsrc->video_codec);
+    rtspsrc->video_codec = NULL;
+  }
+  if (rtspsrc->video_frame_size) {
+    g_free (rtspsrc->video_frame_size);
+    rtspsrc->video_frame_size = NULL;
+  }
+#endif
   gst_rtsp_ext_list_free (rtspsrc->extensions);
   g_free (rtspsrc->conninfo.location);
   gst_rtsp_url_free (rtspsrc->conninfo.url);
@@ -1067,6 +1472,11 @@ gst_rtspsrc_finalize (GObject * object)
   g_free (rtspsrc->multi_iface);
   g_free (rtspsrc->user_agent);
 
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+  g_mutex_clear (&(rtspsrc)->pause_lock);
+  g_cond_clear (&(rtspsrc)->open_end);
+#endif
+
   if (rtspsrc->sdp) {
     gst_sdp_message_free (rtspsrc->sdp);
     rtspsrc->sdp = NULL;
@@ -1089,6 +1499,7 @@ gst_rtspsrc_finalize (GObject * object)
 
   g_mutex_clear (&rtspsrc->conninfo.send_lock);
   g_mutex_clear (&rtspsrc->conninfo.recv_lock);
+  g_cond_clear (&rtspsrc->cmd_cond);
 
   G_OBJECT_CLASS (parent_class)->finalize (object);
 }
@@ -1202,6 +1613,16 @@ gst_rtspsrc_set_property (GObject * object, guint prop_id, const GValue * value,
     case PROP_TIMEOUT:
       rtspsrc->udp_timeout = g_value_get_uint64 (value);
       break;
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+    case PROP_START_POSITION:
+      rtspsrc->start_position = g_value_get_uint64 (value);
+      break;
+    case PROP_RESUME_POSITION:
+      rtspsrc->last_pos = g_value_get_uint64 (value);
+      GST_DEBUG_OBJECT (rtspsrc, "src->last_pos value set to %" GST_TIME_FORMAT,
+          GST_TIME_ARGS (rtspsrc->last_pos));
+      break;
+#endif
     case PROP_TCP_TIMEOUT:
       gst_rtspsrc_set_tcp_timeout (rtspsrc, g_value_get_uint64 (value));
       break;
@@ -1253,7 +1674,7 @@ gst_rtspsrc_set_property (GObject * object, guint prop_id, const GValue * value,
       const gchar *str;
 
       str = g_value_get_string (value);
-      if (sscanf (str, "%u-%u", &rtspsrc->client_port_range.min,
+      if (str == NULL || sscanf (str, "%u-%u", &rtspsrc->client_port_range.min,
               &rtspsrc->client_port_range.max) != 2) {
         rtspsrc->client_port_range.min = 0;
         rtspsrc->client_port_range.max = 0;
@@ -1335,6 +1756,12 @@ gst_rtspsrc_set_property (GObject * object, guint prop_id, const GValue * value,
     case PROP_DEFAULT_VERSION:
       rtspsrc->default_version = g_value_get_enum (value);
       break;
+    case PROP_BACKCHANNEL:
+      rtspsrc->backchannel = g_value_get_enum (value);
+      break;
+    case PROP_TEARDOWN_TIMEOUT:
+      rtspsrc->teardown_timeout = g_value_get_uint64 (value);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -1365,6 +1792,14 @@ gst_rtspsrc_get_property (GObject * object, guint prop_id, GValue * value,
     case PROP_TIMEOUT:
       g_value_set_uint64 (value, rtspsrc->udp_timeout);
       break;
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+    case PROP_START_POSITION:
+      g_value_set_uint64 (value, rtspsrc->start_position);
+      break;
+    case PROP_RESUME_POSITION:
+      g_value_set_uint64 (value, rtspsrc->last_pos);
+      break;
+#endif
     case PROP_TCP_TIMEOUT:
     {
       guint64 timeout;
@@ -1493,6 +1928,12 @@ gst_rtspsrc_get_property (GObject * object, guint prop_id, GValue * value,
     case PROP_DEFAULT_VERSION:
       g_value_set_enum (value, rtspsrc->default_version);
       break;
+    case PROP_BACKCHANNEL:
+      g_value_set_enum (value, rtspsrc->backchannel);
+      break;
+    case PROP_TEARDOWN_TIMEOUT:
+      g_value_set_uint64 (value, rtspsrc->teardown_timeout);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -1705,8 +2146,10 @@ gst_rtspsrc_collect_payloads (GstRTSPSrc * src, const GstSDPMessage * sdp,
   else
     goto unknown_proto;
 
-  if (gst_sdp_media_get_attribute_val (media, "recvonly") != NULL)
-    goto recvonly_media;
+  if (gst_sdp_media_get_attribute_val (media, "sendonly") != NULL &&
+      /* We want to setup caps for streams configured as backchannel */
+      !stream->is_backchannel && src->backchannel != BACKCHANNEL_NONE)
+    goto sendonly_media;
 
   /* Parse global SDP attributes once */
   global_caps = gst_caps_new_empty_simple ("application/x-unknown");
@@ -1727,7 +2170,9 @@ gst_rtspsrc_collect_payloads (GstRTSPSrc * src, const GstSDPMessage * sdp,
     GstStructure *s;
     const gchar *enc;
     PtMapItem item;
-
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+    const gchar *encoder, *mediatype;
+#endif
     pt = atoi (gst_sdp_media_get_format (media, i));
 
     GST_DEBUG_OBJECT (src, " looking at %d pt: %d", i, pt);
@@ -1746,6 +2191,51 @@ gst_rtspsrc_collect_payloads (GstRTSPSrc * src, const GstSDPMessage * sdp,
       if (strcmp (enc, "X-ASF-PF") == 0)
         stream->container = TRUE;
     }
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+    if ((mediatype = gst_structure_get_string (s, "media"))) {
+      GST_DEBUG_OBJECT (src, " mediatype : %s", mediatype);
+      if (!strcmp (mediatype, "video")) {
+        if ((encoder = gst_structure_get_string (s, "encoding-name"))) {
+          GST_DEBUG_OBJECT (src, " encoder : %s", encoder);
+          if ((!strcmp (encoder, "H261")) ||
+              (!strcmp (encoder, "H263")) ||
+              (!strcmp (encoder, "H263-1998"))
+              || (!strcmp (encoder, "H263-2000")) || (!strcmp (encoder, "H264"))
+              || (!strcmp (encoder, "MP4V-ES"))) {
+            src->is_video_codec_supported = TRUE;
+            GST_DEBUG_OBJECT (src, "Supported Video Codec %s", encoder);
+          } else {
+            GST_DEBUG_OBJECT (src, "Unsupported Video Codec %s", encoder);
+          }
+        }
+
+        src->video_codec = g_strdup (encoder);
+        src->video_frame_size =
+            g_strdup (gst_structure_get_string (s, "a-framesize"));
+        GST_DEBUG_OBJECT (src, "video_codec %s , video_frame_size %s ",
+            src->video_codec, src->video_frame_size);
+      } else if (!strcmp (mediatype, "audio")) {
+        if ((encoder = gst_structure_get_string (s, "encoding-name"))) {
+          GST_DEBUG_OBJECT (src, " encoder : %s", encoder);
+          if ((!strcmp (encoder, "MP4A-LATM")) ||
+              (!strcmp (encoder, "AMR")) || (!strcmp (encoder, "AMR-WB"))
+              || (!strcmp (encoder, "AMR-NB"))
+              || (!strcmp (encoder, "mpeg4-generic"))
+              || (!strcmp (encoder, "MPEG4-GENERIC"))
+              || (!strcmp (encoder, "QCELP")) || ((strstr (encoder, "G726"))
+                  || (strstr (encoder, "PCMU")))) {
+            src->is_audio_codec_supported = TRUE;
+            GST_DEBUG_OBJECT (src, "Supported Audio Codec %s", encoder);
+          } else {
+            GST_DEBUG_OBJECT (src, "Unsupported Audio Codec %s", encoder);
+          }
+        }
+
+        src->audio_codec = g_strdup (encoder);
+        GST_DEBUG_OBJECT (src, "audio_codec %s ", src->audio_codec);
+      }
+    }
+#endif
 
     /* Merge in global caps */
     /* Intersect will merge in missing fields to the current caps */
@@ -1777,9 +2267,9 @@ unknown_proto:
     GST_ERROR_OBJECT (src, "unknown proto in media: '%s'", proto);
     return;
   }
-recvonly_media:
+sendonly_media:
   {
-    GST_DEBUG_OBJECT (src, "recvonly media ignored");
+    GST_DEBUG_OBJECT (src, "sendonly media ignored, no backchannel");
     return;
   }
 }
@@ -1839,10 +2329,16 @@ gst_rtspsrc_create_stream (GstRTSPSrc * src, GstSDPMessage * sdp, gint idx,
   stream->ptmap = g_array_new (FALSE, FALSE, sizeof (PtMapItem));
   stream->mikey = NULL;
   stream->stream_id = NULL;
+  stream->is_backchannel = FALSE;
   g_mutex_init (&stream->conninfo.send_lock);
   g_mutex_init (&stream->conninfo.recv_lock);
   g_array_set_clear_func (stream->ptmap, (GDestroyNotify) clear_ptmap_item);
 
+  /* stream is sendonly and onvif backchannel is requested */
+  if (gst_sdp_media_get_attribute_val (media, "sendonly") != NULL &&
+      src->backchannel != BACKCHANNEL_NONE)
+    stream->is_backchannel = TRUE;
+
   /* collect bandwidth information for this steam. FIXME, configure in the RTP
    * session manager to scale RTCP. */
   gst_rtspsrc_collect_bandwidth (src, sdp, media, stream);
@@ -1928,7 +2424,9 @@ gst_rtspsrc_stream_free (GstRTSPSrc * src, GstRTSPStream * stream)
   for (i = 0; i < 2; i++) {
     if (stream->udpsrc[i]) {
       gst_element_set_state (stream->udpsrc[i], GST_STATE_NULL);
-      gst_bin_remove (GST_BIN_CAST (src), stream->udpsrc[i]);
+      if (gst_object_has_as_parent (GST_OBJECT (stream->udpsrc[i]),
+              GST_OBJECT (src)))
+        gst_bin_remove (GST_BIN_CAST (src), stream->udpsrc[i]);
       gst_object_unref (stream->udpsrc[i]);
     }
     if (stream->channelpad[i])
@@ -1936,14 +2434,16 @@ gst_rtspsrc_stream_free (GstRTSPSrc * src, GstRTSPStream * stream)
 
     if (stream->udpsink[i]) {
       gst_element_set_state (stream->udpsink[i], GST_STATE_NULL);
-      gst_bin_remove (GST_BIN_CAST (src), stream->udpsink[i]);
+      if (gst_object_has_as_parent (GST_OBJECT (stream->udpsink[i]),
+              GST_OBJECT (src)))
+        gst_bin_remove (GST_BIN_CAST (src), stream->udpsink[i]);
       gst_object_unref (stream->udpsink[i]);
     }
   }
-  if (stream->fakesrc) {
-    gst_element_set_state (stream->fakesrc, GST_STATE_NULL);
-    gst_bin_remove (GST_BIN_CAST (src), stream->fakesrc);
-    gst_object_unref (stream->fakesrc);
+  if (stream->rtpsrc) {
+    gst_element_set_state (stream->rtpsrc, GST_STATE_NULL);
+    gst_bin_remove (GST_BIN_CAST (src), stream->rtpsrc);
+    gst_object_unref (stream->rtpsrc);
   }
   if (stream->srcpad) {
     gst_pad_set_active (stream->srcpad, FALSE);
@@ -2020,6 +2520,11 @@ gst_rtspsrc_cleanup (GstRTSPSrc * src)
     gst_object_unref (src->provided_clock);
     src->provided_clock = NULL;
   }
+
+  /* free parameter requests queue */
+  if (!g_queue_is_empty (&src->set_get_param_q))
+    g_queue_free_full (&src->set_get_param_q, free_param_queue);
+
 }
 
 static gboolean
@@ -2205,6 +2710,11 @@ gst_rtspsrc_set_state (GstRTSPSrc * src, GstState state)
 {
   GList *walk;
 
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+  GST_WARNING_OBJECT (src, "Setting [%s] element state to: %s \n",
+      GST_ELEMENT_NAME (GST_ELEMENT_CAST (src)),
+      gst_element_state_get_name (state));
+#endif
   if (src->manager)
     gst_element_set_state (GST_ELEMENT_CAST (src->manager), state);
 
@@ -2220,7 +2730,8 @@ gst_rtspsrc_set_state (GstRTSPSrc * src, GstState state)
 }
 
 static void
-gst_rtspsrc_flush (GstRTSPSrc * src, gboolean flush, gboolean playing)
+gst_rtspsrc_flush (GstRTSPSrc * src, gboolean flush, gboolean playing,
+    guint32 seqnum)
 {
   GstEvent *event;
   gint cmd;
@@ -2228,11 +2739,13 @@ gst_rtspsrc_flush (GstRTSPSrc * src, gboolean flush, gboolean playing)
 
   if (flush) {
     event = gst_event_new_flush_start ();
+    gst_event_set_seqnum (event, seqnum);
     GST_DEBUG_OBJECT (src, "start flush");
     cmd = CMD_WAIT;
     state = GST_STATE_PAUSED;
   } else {
     event = gst_event_new_flush_stop (FALSE);
+    gst_event_set_seqnum (event, seqnum);
     GST_DEBUG_OBJECT (src, "stop flush; playing %d", playing);
     cmd = CMD_LOOP;
     if (playing)
@@ -2325,33 +2838,29 @@ gst_rtspsrc_perform_seek (GstRTSPSrc * src, GstEvent * event)
   GList *walk;
   const gchar *seek_style = NULL;
 
-  if (event) {
-    GST_DEBUG_OBJECT (src, "doing seek with event %" GST_PTR_FORMAT, event);
+  GST_DEBUG_OBJECT (src, "doing seek with event %" GST_PTR_FORMAT, event);
 
-    gst_event_parse_seek (event, &rate, &format, &flags,
-        &cur_type, &cur, &stop_type, &stop);
+  gst_event_parse_seek (event, &rate, &format, &flags,
+      &cur_type, &cur, &stop_type, &stop);
 
-    /* no negative rates yet */
-    if (rate < 0.0)
-      goto negative_rate;
+  /* no negative rates yet */
+  if (rate < 0.0)
+    goto negative_rate;
 
-    /* we need TIME format */
-    if (format != src->segment.format)
-      goto no_format;
+  /* we need TIME format */
+  if (format != src->segment.format)
+    goto no_format;
 
-    /* Check if we are not at all seekable */
-    if (src->seekable == -1.0)
-      goto not_seekable;
+  /* Check if we are not at all seekable */
+  if (src->seekable == -1.0)
+    goto not_seekable;
 
-    /* Additional seeking-to-beginning-only check */
-    if (src->seekable == 0.0 && cur != 0)
-      goto not_seekable;
-  } else {
-    GST_DEBUG_OBJECT (src, "doing seek without event");
-    flags = 0;
-    cur_type = GST_SEEK_TYPE_SET;
-    stop_type = GST_SEEK_TYPE_SET;
-  }
+  /* Additional seeking-to-beginning-only check */
+  if (src->seekable == 0.0 && cur != 0)
+    goto not_seekable;
+
+  if (flags & GST_SEEK_FLAG_SEGMENT)
+    goto invalid_segment_flag;
 
   /* get flush flag */
   flush = flags & GST_SEEK_FLAG_FLUSH;
@@ -2365,7 +2874,7 @@ gst_rtspsrc_perform_seek (GstRTSPSrc * src, GstEvent * event)
    * blocking in preroll). */
   if (flush) {
     GST_DEBUG_OBJECT (src, "starting flush");
-    gst_rtspsrc_flush (src, TRUE, FALSE);
+    gst_rtspsrc_flush (src, TRUE, FALSE, gst_event_get_seqnum (event));
   } else {
     if (src->task) {
       gst_task_pause (src->task);
@@ -2387,11 +2896,9 @@ gst_rtspsrc_perform_seek (GstRTSPSrc * src, GstEvent * event)
 
   /* configure the seek parameters in the seeksegment. We will then have the
    * right values in the segment to perform the seek */
-  if (event) {
-    GST_DEBUG_OBJECT (src, "configuring seek");
-    gst_segment_do_seek (&seeksegment, rate, format, flags,
-        cur_type, cur, stop_type, stop, &update);
-  }
+  GST_DEBUG_OBJECT (src, "configuring seek");
+  gst_segment_do_seek (&seeksegment, rate, format, flags,
+      cur_type, cur, stop_type, stop, &update);
 
   /* figure out the last position we need to play. If it's configured (stop !=
    * -1), use that, else we play until the total duration of the file */
@@ -2416,7 +2923,7 @@ gst_rtspsrc_perform_seek (GstRTSPSrc * src, GstEvent * event)
   if (flush) {
     /* if we started flush, we stop now */
     GST_DEBUG_OBJECT (src, "stopping flush");
-    gst_rtspsrc_flush (src, FALSE, playing);
+    gst_rtspsrc_flush (src, FALSE, playing, gst_event_get_seqnum (event));
   }
 
   /* now we did the seek and can activate the new segment values */
@@ -2482,6 +2989,11 @@ not_seekable:
     GST_DEBUG_OBJECT (src, "stream is not seekable");
     return FALSE;
   }
+invalid_segment_flag:
+  {
+    GST_WARNING_OBJECT (src, "Segment seeks not supported");
+    return FALSE;
+  }
 }
 
 static gboolean
@@ -2763,6 +3275,71 @@ gst_rtspsrc_sink_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
   return res;
 }
 
+static GstFlowReturn
+gst_rtspsrc_push_backchannel_buffer (GstRTSPSrc * src, guint id,
+    GstSample * sample)
+{
+  GstFlowReturn res = GST_FLOW_OK;
+  GstRTSPStream *stream;
+
+  if (!src->conninfo.connected || src->state != GST_RTSP_STATE_PLAYING)
+    goto out;
+
+  stream = find_stream (src, &id, (gpointer) find_stream_by_id);
+  if (stream == NULL) {
+    GST_ERROR_OBJECT (src, "no stream with id %u", id);
+    goto out;
+  }
+
+  if (src->interleaved) {
+    GstBuffer *buffer;
+    GstMapInfo map;
+    guint8 *data;
+    guint size;
+    GstRTSPResult ret;
+    GstRTSPMessage message = { 0 };
+    GstRTSPConnInfo *conninfo;
+
+    buffer = gst_sample_get_buffer (sample);
+
+    gst_buffer_map (buffer, &map, GST_MAP_READ);
+    size = map.size;
+    data = map.data;
+
+    gst_rtsp_message_init_data (&message, stream->channel[0]);
+
+    /* lend the body data to the message */
+    gst_rtsp_message_take_body (&message, data, size);
+
+    if (stream->conninfo.connection)
+      conninfo = &stream->conninfo;
+    else
+      conninfo = &src->conninfo;
+
+    GST_DEBUG_OBJECT (src, "sending %u bytes backchannel RTP", size);
+    ret = gst_rtspsrc_connection_send (src, conninfo, &message, NULL);
+    GST_DEBUG_OBJECT (src, "sent backchannel RTP, %d", ret);
+
+    /* and steal it away again because we will free it when unreffing the
+     * buffer */
+    gst_rtsp_message_steal_body (&message, &data, &size);
+    gst_rtsp_message_unset (&message);
+
+    gst_buffer_unmap (buffer, &map);
+
+    res = GST_FLOW_OK;
+  } else {
+    g_signal_emit_by_name (stream->rtpsrc, "push-sample", sample, &res);
+    GST_DEBUG_OBJECT (src, "sent backchannel RTP sample %p: %s", sample,
+        gst_flow_get_name (res));
+  }
+
+out:
+  gst_sample_unref (sample);
+
+  return res;
+}
+
 static GstPadProbeReturn
 pad_blocked (GstPad * pad, GstPadProbeInfo * info, gpointer user_data)
 {
@@ -2790,6 +3367,24 @@ was_ok:
   }
 }
 
+static GstPadProbeReturn
+udpsrc_probe_cb (GstPad * pad, GstPadProbeInfo * info, gpointer user_data)
+{
+  guint32 *segment_seqnum = user_data;
+
+  switch (GST_EVENT_TYPE (info->data)) {
+    case GST_EVENT_SEGMENT:
+      if (!gst_event_is_writable (info->data))
+        info->data = gst_event_make_writable (info->data);
+
+      *segment_seqnum = gst_event_get_seqnum (info->data);
+    default:
+      break;
+  }
+
+  return GST_PAD_PROBE_OK;
+}
+
 static gboolean
 copy_sticky_events (GstPad * pad, GstEvent ** event, gpointer user_data)
 {
@@ -2801,6 +3396,35 @@ copy_sticky_events (GstPad * pad, GstEvent ** event, gpointer user_data)
   return TRUE;
 }
 
+static gboolean
+add_backchannel_fakesink (GstRTSPSrc * src, GstRTSPStream * stream,
+    GstPad * srcpad)
+{
+  GstPad *sinkpad;
+  GstElement *fakesink;
+
+  fakesink = gst_element_factory_make ("fakesink", NULL);
+  if (fakesink == NULL) {
+    GST_ERROR_OBJECT (src, "no fakesink");
+    return FALSE;
+  }
+
+  sinkpad = gst_element_get_static_pad (fakesink, "sink");
+
+  GST_DEBUG_OBJECT (src, "backchannel stream %p, hooking fakesink", stream);
+
+  gst_bin_add (GST_BIN_CAST (src), fakesink);
+  if (gst_pad_link (srcpad, sinkpad) != GST_PAD_LINK_OK) {
+    GST_WARNING_OBJECT (src, "could not link to fakesink");
+    return FALSE;
+  }
+
+  gst_object_unref (sinkpad);
+
+  gst_element_sync_state_with_parent (fakesink);
+  return TRUE;
+}
+
 /* this callback is called when the session manager generated a new src pad with
  * payloaded RTP packets. We simply ghost the pad here. */
 static void
@@ -2868,7 +3492,12 @@ new_manager_pad (GstElement * manager, GstPad * pad, GstRTSPSrc * src)
   gst_pad_set_query_function (stream->srcpad, gst_rtspsrc_handle_src_query);
   gst_pad_set_active (stream->srcpad, TRUE);
   gst_pad_sticky_events_foreach (pad, copy_sticky_events, stream->srcpad);
-  gst_element_add_pad (GST_ELEMENT_CAST (src), stream->srcpad);
+
+  /* don't add the srcpad if this is a sendonly stream */
+  if (stream->is_backchannel)
+    add_backchannel_fakesink (src, stream, stream->srcpad);
+  else
+    gst_element_add_pad (GST_ELEMENT_CAST (src), stream->srcpad);
 
   if (all_added) {
     GST_DEBUG_OBJECT (src, "We added all streams");
@@ -2966,7 +3595,7 @@ on_bye_ssrc (GObject * session, GObject * source, GstRTSPStream * stream)
 }
 
 static void
-on_timeout (GObject * session, GObject * source, GstRTSPStream * stream)
+on_timeout_common (GObject * session, GObject * source, GstRTSPStream * stream)
 {
   GstRTSPSrc *src = stream->parent;
   guint ssrc;
@@ -2981,6 +3610,22 @@ on_timeout (GObject * session, GObject * source, GstRTSPStream * stream)
 }
 
 static void
+on_timeout (GObject * session, GObject * source, GstRTSPStream * stream)
+{
+  GstRTSPSrc *src = stream->parent;
+
+  /* timeout, post element message */
+  gst_element_post_message (GST_ELEMENT_CAST (src),
+      gst_message_new_element (GST_OBJECT_CAST (src),
+          gst_structure_new ("GstRTSPSrcTimeout",
+              "cause", G_TYPE_ENUM, GST_RTSP_SRC_TIMEOUT_CAUSE_RTCP,
+              "stream-number", G_TYPE_INT, stream->id, "ssrc", G_TYPE_UINT,
+              stream->ssrc, NULL)));
+
+  on_timeout_common (session, source, stream);
+}
+
+static void
 on_npt_stop (GstElement * rtpbin, guint session, guint ssrc, GstRTSPSrc * src)
 {
   GstRTSPStream *stream;
@@ -3327,6 +3972,12 @@ gst_rtspsrc_stream_configure_manager (GstRTSPSrc * src, GstRTSPStream * stream,
         if (!(src->manager = gst_element_factory_make (manager, "manager")))
           goto manager_failed;
       }
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+      if (g_strcmp0 (manager, "rtpbin") == 0) {
+          /* set for player rtsp buffering */
+          g_object_set (src->manager, "use-rtsp-buffering", TRUE, NULL);
+      }
+#endif
 
       /* we manage this element */
       gst_element_set_locked_state (src->manager, TRUE);
@@ -3497,8 +4148,8 @@ gst_rtspsrc_stream_configure_manager (GstRTSPSrc * src, GstRTSPStream * stream,
 
         g_signal_connect (rtpsession, "on-bye-ssrc", (GCallback) on_bye_ssrc,
             stream);
-        g_signal_connect (rtpsession, "on-bye-timeout", (GCallback) on_timeout,
-            stream);
+        g_signal_connect (rtpsession, "on-bye-timeout",
+            (GCallback) on_timeout_common, stream);
         g_signal_connect (rtpsession, "on-timeout", (GCallback) on_timeout,
             stream);
         g_signal_connect (rtpsession, "on-ssrc-active",
@@ -3825,6 +4476,10 @@ gst_rtspsrc_stream_configure_udp (GstRTSPSrc * src, GstRTSPStream * stream,
         GST_PAD_PROBE_TYPE_BLOCK | GST_PAD_PROBE_TYPE_BUFFER |
         GST_PAD_PROBE_TYPE_BUFFER_LIST, pad_blocked, src, NULL);
 
+    gst_pad_add_probe (stream->blockedpad,
+        GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM, udpsrc_probe_cb,
+        &(stream->segment_seqnum[0]), NULL);
+
     if (stream->channelpad[0]) {
       GST_DEBUG_OBJECT (src, "connecting UDP source 0 to manager");
       /* configure for UDP delivery, we need to connect the UDP pads to
@@ -3860,6 +4515,9 @@ gst_rtspsrc_stream_configure_udp (GstRTSPSrc * src, GstRTSPStream * stream,
       GST_DEBUG_OBJECT (src, "connecting UDP source 1 to manager");
 
       pad = gst_element_get_static_pad (stream->udpsrc[1], "src");
+      gst_pad_add_probe (pad,
+          GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM, udpsrc_probe_cb,
+          &(stream->segment_seqnum[1]), NULL);
       gst_pad_link_full (pad, stream->channelpad[1],
           GST_PAD_LINK_CHECK_NOTHING);
       gst_object_unref (pad);
@@ -3898,7 +4556,7 @@ gst_rtspsrc_stream_configure_udp_sinks (GstRTSPSrc * src,
     goto no_destination;
 
   /* try to construct the fakesrc to the RTP port of the server to open up any
-   * NAT firewalls */
+   * NAT firewalls or, if backchannel, construct an appsrc */
   if (do_rtp) {
     GST_DEBUG_OBJECT (src, "configure RTP UDP sink for %s:%d", destination,
         rtp_port);
@@ -3932,25 +4590,36 @@ gst_rtspsrc_stream_configure_udp_sinks (GstRTSPSrc * src,
       g_object_unref (socket);
     }
 
-    /* the source for the dummy packets to open up NAT */
-    stream->fakesrc = gst_element_factory_make ("fakesrc", NULL);
-    if (stream->fakesrc == NULL)
-      goto no_fakesrc_element;
+    if (stream->is_backchannel) {
+      /* appsrc is for the app to shovel data using push-backchannel-buffer */
+      stream->rtpsrc = gst_element_factory_make ("appsrc", NULL);
+      if (stream->rtpsrc == NULL)
+        goto no_appsrc_element;
 
-    /* random data in 5 buffers, a size of 200 bytes should be fine */
-    g_object_set (G_OBJECT (stream->fakesrc), "filltype", 3, "num-buffers", 5,
-        "sizetype", 2, "sizemax", 200, "silent", TRUE, NULL);
+      /* interal use only, don't emit signals */
+      g_object_set (G_OBJECT (stream->rtpsrc), "emit-signals", TRUE,
+          "is-live", TRUE, NULL);
+    } else {
+      /* the source for the dummy packets to open up NAT */
+      stream->rtpsrc = gst_element_factory_make ("fakesrc", NULL);
+      if (stream->rtpsrc == NULL)
+        goto no_fakesrc_element;
+
+      /* random data in 5 buffers, a size of 200 bytes should be fine */
+      g_object_set (G_OBJECT (stream->rtpsrc), "filltype", 3, "num-buffers", 5,
+          "sizetype", 2, "sizemax", 200, "silent", TRUE, NULL);
+    }
 
     /* keep everything locked */
     gst_element_set_locked_state (stream->udpsink[0], TRUE);
-    gst_element_set_locked_state (stream->fakesrc, TRUE);
+    gst_element_set_locked_state (stream->rtpsrc, TRUE);
 
     gst_object_ref (stream->udpsink[0]);
     gst_bin_add (GST_BIN_CAST (src), stream->udpsink[0]);
-    gst_object_ref (stream->fakesrc);
-    gst_bin_add (GST_BIN_CAST (src), stream->fakesrc);
+    gst_object_ref (stream->rtpsrc);
+    gst_bin_add (GST_BIN_CAST (src), stream->rtpsrc);
 
-    gst_element_link_pads_full (stream->fakesrc, "src", stream->udpsink[0],
+    gst_element_link_pads_full (stream->rtpsrc, "src", stream->udpsink[0],
         "sink", GST_PAD_LINK_CHECK_NOTHING);
   }
   if (do_rtcp) {
@@ -4021,6 +4690,11 @@ no_sink_element:
     GST_ERROR_OBJECT (src, "no UDP sink element found");
     return FALSE;
   }
+no_appsrc_element:
+  {
+    GST_ERROR_OBJECT (src, "no appsrc element found");
+    return FALSE;
+  }
 no_fakesrc_element:
   {
     GST_ERROR_OBJECT (src, "no fakesrc element found");
@@ -4094,8 +4768,8 @@ gst_rtspsrc_stream_configure_transport (GstRTSPStream * stream,
     case GST_RTSP_LOWER_TRANS_UDP:
       if (!gst_rtspsrc_stream_configure_udp (src, stream, transport, &outpad))
         goto transport_failed;
-      /* configure udpsinks back to the server for RTCP messages and for the
-       * dummy RTP messages to open NAT. */
+      /* configure udpsinks back to the server for RTCP messages, for the
+       * dummy RTP messages to open NAT, and for the backchannel */
       if (!gst_rtspsrc_stream_configure_udp_sinks (src, stream, transport))
         goto transport_failed;
       break;
@@ -4103,8 +4777,12 @@ gst_rtspsrc_stream_configure_transport (GstRTSPStream * stream,
       goto unknown_transport;
   }
 
-  if (outpad) {
-    GST_DEBUG_OBJECT (src, "creating ghostpad");
+  /* using backchannel and no manager, hence no srcpad for this stream */
+  if (outpad && stream->is_backchannel) {
+    add_backchannel_fakesink (src, stream, outpad);
+    gst_object_unref (outpad);
+  } else if (outpad) {
+    GST_DEBUG_OBJECT (src, "creating ghostpad for stream %p", stream);
 
     gst_pad_use_fixed_caps (outpad);
 
@@ -4128,17 +4806,17 @@ gst_rtspsrc_stream_configure_transport (GstRTSPStream * stream,
   /* ERRORS */
 transport_failed:
   {
-    GST_DEBUG_OBJECT (src, "failed to configure transport");
+    GST_WARNING_OBJECT (src, "failed to configure transport");
     return FALSE;
   }
 unknown_transport:
   {
-    GST_DEBUG_OBJECT (src, "unknown transport");
+    GST_WARNING_OBJECT (src, "unknown transport");
     return FALSE;
   }
 no_manager:
   {
-    GST_DEBUG_OBJECT (src, "cannot get a session manager");
+    GST_WARNING_OBJECT (src, "cannot get a session manager");
     return FALSE;
   }
 }
@@ -4157,13 +4835,18 @@ gst_rtspsrc_send_dummy_packets (GstRTSPSrc * src)
   for (walk = src->streams; walk; walk = g_list_next (walk)) {
     GstRTSPStream *stream = (GstRTSPStream *) walk->data;
 
-    if (stream->fakesrc && stream->udpsink[0]) {
+    if (!stream->rtpsrc || !stream->udpsink[0])
+      continue;
+
+    if (stream->is_backchannel)
+      GST_DEBUG_OBJECT (src, "starting backchannel stream %p", stream);
+    else
       GST_DEBUG_OBJECT (src, "sending dummy packet to stream %p", stream);
-      gst_element_set_state (stream->udpsink[0], GST_STATE_NULL);
-      gst_element_set_state (stream->fakesrc, GST_STATE_NULL);
-      gst_element_set_state (stream->udpsink[0], GST_STATE_PLAYING);
-      gst_element_set_state (stream->fakesrc, GST_STATE_PLAYING);
-    }
+
+    gst_element_set_state (stream->udpsink[0], GST_STATE_NULL);
+    gst_element_set_state (stream->rtpsrc, GST_STATE_NULL);
+    gst_element_set_state (stream->udpsink[0], GST_STATE_PLAYING);
+    gst_element_set_state (stream->rtpsrc, GST_STATE_PLAYING);
   }
   return TRUE;
 }
@@ -4205,7 +4888,10 @@ gst_rtspsrc_activate_streams (GstRTSPSrc * src)
       /* add the pad */
       if (!stream->added) {
         GST_DEBUG_OBJECT (src, "adding stream pad %p", stream);
-        gst_element_add_pad (GST_ELEMENT_CAST (src), stream->srcpad);
+        if (stream->is_backchannel)
+          add_backchannel_fakesink (src, stream, stream->srcpad);
+        else
+          gst_element_add_pad (GST_ELEMENT_CAST (src), stream->srcpad);
         stream->added = TRUE;
       }
     }
@@ -4331,8 +5017,16 @@ gst_rtspsrc_stream_push_event (GstRTSPSrc * src, GstRTSPStream * stream,
     goto done;
 
   if (stream->udpsrc[0]) {
-    gst_event_ref (event);
-    res = gst_element_send_event (stream->udpsrc[0], event);
+    GstEvent *sent_event;
+
+    if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) {
+      sent_event = gst_event_new_eos ();
+      gst_event_set_seqnum (sent_event, stream->segment_seqnum[0]);
+    } else {
+      sent_event = gst_event_ref (event);
+    }
+
+    res = gst_element_send_event (stream->udpsrc[0], sent_event);
   } else if (stream->channelpad[0]) {
     gst_event_ref (event);
     if (GST_PAD_IS_SRC (stream->channelpad[0]))
@@ -4342,8 +5036,18 @@ gst_rtspsrc_stream_push_event (GstRTSPSrc * src, GstRTSPStream * stream,
   }
 
   if (stream->udpsrc[1]) {
-    gst_event_ref (event);
-    res &= gst_element_send_event (stream->udpsrc[1], event);
+    GstEvent *sent_event;
+
+    if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) {
+      sent_event = gst_event_new_eos ();
+      if (stream->segment_seqnum[1] != GST_SEQNUM_INVALID) {
+        gst_event_set_seqnum (sent_event, stream->segment_seqnum[1]);
+      }
+    } else {
+      sent_event = gst_event_ref (event);
+    }
+
+    res &= gst_element_send_event (stream->udpsrc[1], sent_event);
   } else if (stream->channelpad[1]) {
     gst_event_ref (event);
     if (GST_PAD_IS_SRC (stream->channelpad[1]))
@@ -5006,8 +5710,13 @@ receive_error:
   {
     gchar *str = gst_rtsp_strresult (res);
 
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+    gst_rtspsrc_post_error_message (src, GST_RTSPSRC_ERROR_BAD_SERVER,
+        "Could not receive message.");
+#else
     GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
         ("Could not receive message. (%s)", str));
+#endif
     g_free (str);
 
     gst_rtsp_message_unset (&message);
@@ -5017,8 +5726,13 @@ handle_request_failed:
   {
     gchar *str = gst_rtsp_strresult (res);
 
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+    gst_rtspsrc_post_error_message (src, GST_RTSPSRC_ERROR_SERVICE_UNAVAILABLE,
+        "Could not handle server message.");
+#else
     GST_ELEMENT_ERROR (src, RESOURCE, WRITE, (NULL),
         ("Could not handle server message. (%s)", str));
+#endif
     g_free (str);
     gst_rtsp_message_unset (&message);
     return GST_FLOW_ERROR;
@@ -5138,8 +5852,13 @@ connect_error:
 
     src->conninfo.connected = FALSE;
     if (res != GST_RTSP_EINTR) {
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+      gst_rtspsrc_post_error_message (src, GST_RTSPSRC_ERROR_CONNECTION_FAIL,
+          "Could not connect to server.");
+#else
       GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ_WRITE, (NULL),
           ("Could not connect to server. (%s)", str));
+#endif
       g_free (str);
       ret = GST_FLOW_ERROR;
     } else {
@@ -5151,8 +5870,13 @@ receive_error:
   {
     gchar *str = gst_rtsp_strresult (res);
 
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+    gst_rtspsrc_post_error_message (src, GST_RTSPSRC_ERROR_SERVER_DISCONNECTED,
+        "Could not receive message.");
+#else
     GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
         ("Could not receive message. (%s)", str));
+#endif
     g_free (str);
     return GST_FLOW_ERROR;
   }
@@ -5163,8 +5887,14 @@ handle_request_failed:
 
     gst_rtsp_message_unset (&message);
     if (res != GST_RTSP_EINTR) {
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+      gst_rtspsrc_post_error_message (src,
+          GST_RTSPSRC_ERROR_SERVICE_UNAVAILABLE,
+          "Could not handle server message.");
+#else
       GST_ELEMENT_ERROR (src, RESOURCE, WRITE, (NULL),
           ("Could not handle server message. (%s)", str));
+#endif
       g_free (str);
       ret = GST_FLOW_ERROR;
     } else {
@@ -5236,10 +5966,15 @@ no_protocols:
   {
     src->cur_protocols = 0;
     /* no transport possible, post an error and stop */
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+    gst_rtspsrc_post_error_message (src, GST_RTSPSRC_ERROR_BAD_TRANSPORT,
+        "Could not receive any UDP packets for seconds, maybe your firewall is blocking it. No other protocols to try.");
+#else
     GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
         ("Could not receive any UDP packets for %.4f seconds, maybe your "
             "firewall is blocking it. No other protocols to try.",
             gst_guint64_to_gdouble (src->udp_timeout) / 1000000.0));
+#endif
     return GST_RTSP_ERROR;
   }
 open_failed:
@@ -5267,6 +6002,14 @@ gst_rtspsrc_loop_start_cmd (GstRTSPSrc * src, gint cmd)
     case CMD_PAUSE:
       GST_ELEMENT_PROGRESS (src, START, "request", ("Sending PAUSE request"));
       break;
+    case CMD_GET_PARAMETER:
+      GST_ELEMENT_PROGRESS (src, START, "request",
+          ("Sending GET_PARAMETER request"));
+      break;
+    case CMD_SET_PARAMETER:
+      GST_ELEMENT_PROGRESS (src, START, "request",
+          ("Sending SET_PARAMETER request"));
+      break;
     case CMD_CLOSE:
       GST_ELEMENT_PROGRESS (src, START, "close", ("Closing Stream"));
       break;
@@ -5278,9 +6021,38 @@ gst_rtspsrc_loop_start_cmd (GstRTSPSrc * src, gint cmd)
 static void
 gst_rtspsrc_loop_complete_cmd (GstRTSPSrc * src, gint cmd)
 {
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+  GstMessage *s;
+  GST_WARNING_OBJECT (src, "Got cmd %s", cmd_to_string (cmd));
+#endif
+
   switch (cmd) {
     case CMD_OPEN:
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+      GST_DEBUG_OBJECT (src,
+          "rtsp_duration %" GST_TIME_FORMAT
+          ", rtsp_audio_codec %s , rtsp_video_codec %s , rtsp_video_frame_size %s",
+          GST_TIME_ARGS (src->segment.duration), src->audio_codec,
+          src->video_codec, src->video_frame_size);
+
+      /* post message */
+      s = gst_message_new_element (GST_OBJECT_CAST (src),
+          gst_structure_new ("rtspsrc_properties",
+              "rtsp_duration", G_TYPE_UINT64, src->segment.duration,
+              "rtsp_audio_codec", G_TYPE_STRING, src->audio_codec,
+              "rtsp_video_codec", G_TYPE_STRING, src->video_codec,
+              "rtsp_video_frame_size", G_TYPE_STRING, src->video_frame_size,
+              NULL));
+
+      gst_element_post_message (GST_ELEMENT_CAST (src), s);
+#endif
       GST_ELEMENT_PROGRESS (src, COMPLETE, "open", ("Opened Stream"));
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+      /* rtspsrc PAUSE state should be here for parsing sdp before PAUSE state changed. */
+      g_mutex_lock (&(src)->pause_lock);
+      g_cond_signal (&(src)->open_end);
+      g_mutex_unlock (&(src)->pause_lock);
+#endif
       break;
     case CMD_PLAY:
       GST_ELEMENT_PROGRESS (src, COMPLETE, "request", ("Sent PLAY request"));
@@ -5288,6 +6060,14 @@ gst_rtspsrc_loop_complete_cmd (GstRTSPSrc * src, gint cmd)
     case CMD_PAUSE:
       GST_ELEMENT_PROGRESS (src, COMPLETE, "request", ("Sent PAUSE request"));
       break;
+    case CMD_GET_PARAMETER:
+      GST_ELEMENT_PROGRESS (src, COMPLETE, "request",
+          ("Sent GET_PARAMETER request"));
+      break;
+    case CMD_SET_PARAMETER:
+      GST_ELEMENT_PROGRESS (src, COMPLETE, "request",
+          ("Sent SET_PARAMETER request"));
+      break;
     case CMD_CLOSE:
       GST_ELEMENT_PROGRESS (src, COMPLETE, "close", ("Closed Stream"));
       break;
@@ -5309,6 +6089,14 @@ gst_rtspsrc_loop_cancel_cmd (GstRTSPSrc * src, gint cmd)
     case CMD_PAUSE:
       GST_ELEMENT_PROGRESS (src, CANCELED, "request", ("PAUSE canceled"));
       break;
+    case CMD_GET_PARAMETER:
+      GST_ELEMENT_PROGRESS (src, CANCELED, "request",
+          ("GET_PARAMETER canceled"));
+      break;
+    case CMD_SET_PARAMETER:
+      GST_ELEMENT_PROGRESS (src, CANCELED, "request",
+          ("SET_PARAMETER canceled"));
+      break;
     case CMD_CLOSE:
       GST_ELEMENT_PROGRESS (src, CANCELED, "close", ("Close canceled"));
       break;
@@ -5323,6 +6111,14 @@ gst_rtspsrc_loop_error_cmd (GstRTSPSrc * src, gint cmd)
   switch (cmd) {
     case CMD_OPEN:
       GST_ELEMENT_PROGRESS (src, ERROR, "open", ("Open failed"));
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+      /* Ending conditional wait for pause when open fails.*/
+      g_mutex_lock (&(src)->pause_lock);
+      g_cond_signal (&(src)->open_end);
+      g_mutex_unlock (&(src)->pause_lock);
+      GST_WARNING_OBJECT (src,
+          "ending conditional wait for pause as open is failed.");
+#endif
       break;
     case CMD_PLAY:
       GST_ELEMENT_PROGRESS (src, ERROR, "request", ("PLAY failed"));
@@ -5330,6 +6126,12 @@ gst_rtspsrc_loop_error_cmd (GstRTSPSrc * src, gint cmd)
     case CMD_PAUSE:
       GST_ELEMENT_PROGRESS (src, ERROR, "request", ("PAUSE failed"));
       break;
+    case CMD_GET_PARAMETER:
+      GST_ELEMENT_PROGRESS (src, ERROR, "request", ("GET_PARAMETER failed"));
+      break;
+    case CMD_SET_PARAMETER:
+      GST_ELEMENT_PROGRESS (src, ERROR, "request", ("SET_PARAMETER failed"));
+      break;
     case CMD_CLOSE:
       GST_ELEMENT_PROGRESS (src, ERROR, "close", ("Close failed"));
       break;
@@ -5362,6 +6164,7 @@ gst_rtspsrc_loop_send_cmd (GstRTSPSrc * src, gint cmd, gint mask)
 
   GST_OBJECT_LOCK (src);
   old = src->pending_cmd;
+
   if (old == CMD_RECONNECT) {
     GST_DEBUG_OBJECT (src, "ignore, we were reconnecting");
     cmd = CMD_RECONNECT;
@@ -5372,6 +6175,12 @@ gst_rtspsrc_loop_send_cmd (GstRTSPSrc * src, gint cmd, gint mask)
      * still the pending command. */
     GST_DEBUG_OBJECT (src, "ignore, we were closing");
     cmd = CMD_CLOSE;
+  } else if (old == CMD_SET_PARAMETER) {
+    GST_DEBUG_OBJECT (src, "ignore, we have a pending %s", cmd_to_string (old));
+    cmd = CMD_SET_PARAMETER;
+  } else if (old == CMD_GET_PARAMETER) {
+    GST_DEBUG_OBJECT (src, "ignore, we have a pending %s", cmd_to_string (old));
+    cmd = CMD_GET_PARAMETER;
   } else if (old != CMD_WAIT) {
     src->pending_cmd = CMD_WAIT;
     GST_OBJECT_UNLOCK (src);
@@ -5399,6 +6208,28 @@ gst_rtspsrc_loop_send_cmd (GstRTSPSrc * src, gint cmd, gint mask)
 }
 
 static gboolean
+gst_rtspsrc_loop_send_cmd_and_wait (GstRTSPSrc * src, gint cmd, gint mask,
+    GstClockTime timeout)
+{
+  gboolean flushed = gst_rtspsrc_loop_send_cmd (src, cmd, mask);
+
+  if (timeout > 0) {
+    gint64 end_time = g_get_monotonic_time () + (timeout / 1000);
+    GST_OBJECT_LOCK (src);
+    while (src->pending_cmd == cmd || src->busy_cmd == cmd) {
+      if (!g_cond_wait_until (&src->cmd_cond, GST_OBJECT_GET_LOCK (src),
+              end_time)) {
+        GST_WARNING_OBJECT (src,
+            "Timed out waiting for TEARDOWN to be processed.");
+        break;                  /* timeout passed */
+      }
+    }
+    GST_OBJECT_UNLOCK (src);
+  }
+  return flushed;
+}
+
+static gboolean
 gst_rtspsrc_loop (GstRTSPSrc * src)
 {
   GstFlowReturn ret;
@@ -5619,8 +6450,13 @@ no_auth_available:
   {
     /* Output an error indicating that we couldn't connect because there were
      * no supported authentication protocols */
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+    gst_rtspsrc_post_error_message (src, GST_RTSPSRC_ERROR_NOT_AUTHORIZED,
+        "No supported authentication protocol was found");
+#else
     GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL),
         ("No supported authentication protocol was found"));
+#endif
     return FALSE;
   }
 no_user_pass:
@@ -5707,8 +6543,14 @@ receive_error:
         gchar *str = gst_rtsp_strresult (res);
 
         if (res != GST_RTSP_EINTR) {
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+          gst_rtspsrc_post_error_message (src,
+              GST_RTSPSRC_ERROR_SERVER_DISCONNECTED,
+              "Could not receive message.");
+#else
           GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
               ("Could not receive message. (%s)", str));
+#endif
         } else {
           GST_WARNING_OBJECT (src, "receive interrupted");
         }
@@ -5787,8 +6629,13 @@ send_error:
     gchar *str = gst_rtsp_strresult (res);
 
     if (res != GST_RTSP_EINTR) {
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+      gst_rtspsrc_post_error_message (src, GST_RTSPSRC_ERROR_CONNECTION_FAIL,
+          "Could not send message.");
+#else
       GST_ELEMENT_ERROR (src, RESOURCE, WRITE, (NULL),
           ("Could not send message. (%s)", str));
+#endif
     } else {
       GST_WARNING_OBJECT (src, "send interrupted");
     }
@@ -5902,12 +6749,22 @@ error_response:
 
     switch (response->type_data.response.code) {
       case GST_RTSP_STS_NOT_FOUND:
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+        gst_rtspsrc_post_error_message (src, GST_RTSPSRC_ERROR_BAD_REQUEST,
+            "STS NOT FOUND");
+#else
         RTSP_SRC_RESPONSE_ERROR (src, response, RESOURCE, NOT_FOUND,
             "Not found");
+#endif
         break;
       case GST_RTSP_STS_UNAUTHORIZED:
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+        gst_rtspsrc_post_error_message (src, GST_RTSPSRC_ERROR_NOT_AUTHORIZED,
+            "STS NOT AUTHORIZED");
+#else
         RTSP_SRC_RESPONSE_ERROR (src, response, RESOURCE, NOT_AUTHORIZED,
             "Unauthorized");
+#endif
         break;
       case GST_RTSP_STS_MOVED_PERMANENTLY:
       case GST_RTSP_STS_MOVE_TEMPORARILY:
@@ -5951,8 +6808,13 @@ error_response:
         res = GST_RTSP_OK;
         break;
       default:
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+        gst_rtspsrc_post_error_message (src, GST_RTSPSRC_ERROR_UNEXPECTED_MSG,
+            "Got error response from Server");
+#else
         RTSP_SRC_RESPONSE_ERROR (src, response, RESOURCE, READ,
             "Unhandled error");
+#endif
         break;
     }
     /* if we return ERROR we should unset the response ourselves */
@@ -6035,14 +6897,24 @@ gst_rtspsrc_parse_methods (GstRTSPSrc * src, GstRTSPMessage * response)
   /* ERRORS */
 no_describe:
   {
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+    gst_rtspsrc_post_error_message (src, GST_RTSPSRC_ERROR_METHOD_NOT_ALLOWED,
+        "Server does not support DESCRIBE.");
+#else
     GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL),
         ("Server does not support DESCRIBE."));
+#endif
     return FALSE;
   }
 no_setup:
   {
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+    gst_rtspsrc_post_error_message (src, GST_RTSPSRC_ERROR_METHOD_NOT_ALLOWED,
+        "Server does not support SETUP.");
+#else
     GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ, (NULL),
         ("Server does not support SETUP."));
+#endif
     return FALSE;
   }
 }
@@ -6529,7 +7401,7 @@ gst_rtspsrc_setup_streams_start (GstRTSPSrc * src, gboolean async)
 
     caps = stream_get_caps_for_pt (stream, stream->default_pt);
     if (caps == NULL) {
-      GST_DEBUG_OBJECT (src, "skipping stream %p, no caps", stream);
+      GST_WARNING_OBJECT (src, "skipping stream %p, no caps", stream);
       continue;
     }
 
@@ -6574,13 +7446,14 @@ gst_rtspsrc_setup_streams_start (GstRTSPSrc * src, gboolean async)
 
     /* skip setup if we have no URL for it */
     if (stream->conninfo.location == NULL) {
-      GST_DEBUG_OBJECT (src, "skipping stream %p, no setup", stream);
+      GST_WARNING_OBJECT (src, "skipping stream %p, no setup", stream);
       continue;
     }
 
     if (src->conninfo.connection == NULL) {
       if (!gst_rtsp_conninfo_connect (src, &stream->conninfo, async)) {
-        GST_DEBUG_OBJECT (src, "skipping stream %p, failed to connect", stream);
+        GST_WARNING_OBJECT (src, "skipping stream %p, failed to connect",
+            stream);
         continue;
       }
       conninfo = &stream->conninfo;
@@ -6653,6 +7526,10 @@ gst_rtspsrc_setup_streams_start (GstRTSPSrc * src, gboolean async)
     /* select transport */
     gst_rtsp_message_take_header (&request, GST_RTSP_HDR_TRANSPORT, transports);
 
+    if (stream->is_backchannel && src->backchannel == BACKCHANNEL_ONVIF)
+      gst_rtsp_message_add_header (&request, GST_RTSP_HDR_REQUIRE,
+          BACKCHANNEL_ONVIF_HDR_REQUIRE_VAL);
+
     /* set up keys */
     if (stream->profile == GST_RTSP_PROFILE_SAVP ||
         stream->profile == GST_RTSP_PROFILE_SAVPF) {
@@ -6777,39 +7654,66 @@ gst_rtspsrc_setup_streams_start (GstRTSPSrc * src, gboolean async)
   /* ERRORS */
 no_protocols:
   {
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+    gst_rtspsrc_post_error_message (src, GST_RTSPSRC_ERROR_INVALID_PROTOCOL,
+        "Could not connect to server, no protocols left");
+#else
     /* no transport possible, post an error and stop */
     GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
         ("Could not connect to server, no protocols left"));
+#endif
     return GST_RTSP_ERROR;
   }
 no_streams:
   {
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+    gst_rtspsrc_post_error_message (src, GST_RTSPSRC_ERROR_CONTENT_NOT_FOUND,
+        "SDP contains no streams");
+#else
     GST_ELEMENT_ERROR (src, RESOURCE, SETTINGS, (NULL),
         ("SDP contains no streams"));
+#endif
     return GST_RTSP_ERROR;
   }
 create_request_failed:
   {
     gchar *str = gst_rtsp_strresult (res);
 
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+    gst_rtspsrc_post_error_message (src, GST_RTSPSRC_ERROR_BAD_REQUEST,
+        "Could not create request.");
+#else
     GST_ELEMENT_ERROR (src, LIBRARY, INIT, (NULL),
         ("Could not create request. (%s)", str));
+#endif
     g_free (str);
     goto cleanup_error;
   }
 setup_transport_failed:
   {
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+    gst_rtspsrc_post_error_message (src, GST_RTSPSRC_ERROR_BAD_REQUEST,
+        "Could not setup transport.");
+#else
     GST_ELEMENT_ERROR (src, RESOURCE, SETTINGS, (NULL),
         ("Could not setup transport."));
+#endif
     res = GST_RTSP_ERROR;
     goto cleanup_error;
   }
 response_error:
   {
+#ifndef TIZEN_FEATURE_RTSP_MODIFICATION
     const gchar *str = gst_rtsp_status_as_text (code);
+#endif
 
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+    gst_rtspsrc_post_error_message (src, GST_RTSPSRC_ERROR_UNEXPECTED_MSG,
+        "Error from Server .");
+#else
     GST_ELEMENT_ERROR (src, RESOURCE, WRITE, (NULL),
         ("Error (%d): %s", code, GST_STR_NULL (str)));
+#endif
     res = GST_RTSP_ERROR;
     goto cleanup_error;
   }
@@ -6818,8 +7722,13 @@ send_error:
     gchar *str = gst_rtsp_strresult (res);
 
     if (res != GST_RTSP_EINTR) {
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+      gst_rtspsrc_post_error_message (src, GST_RTSPSRC_ERROR_CONNECTION_FAIL,
+          "Could not send message.");
+#else
       GST_ELEMENT_ERROR (src, RESOURCE, WRITE, (NULL),
           ("Could not send message. (%s)", str));
+#endif
     } else {
       GST_WARNING_OBJECT (src, "send interrupted");
     }
@@ -6830,15 +7739,27 @@ nothing_to_activate:
   {
     /* none of the available error codes is really right .. */
     if (unsupported_real) {
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+      gst_rtspsrc_post_error_message (src,
+          GST_RTSPSRC_ERROR_UNSUPPORTED_MEDIA_TYPE,
+          "No supported stream was found. You might need to install a GStreamer RTSP extension plugin for Real media streams.");
+#else
       GST_ELEMENT_ERROR (src, STREAM, CODEC_NOT_FOUND,
           (_("No supported stream was found. You might need to install a "
                   "GStreamer RTSP extension plugin for Real media streams.")),
           (NULL));
+#endif
     } else {
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+      gst_rtspsrc_post_error_message (src,
+          GST_RTSPSRC_ERROR_UNSUPPORTED_MEDIA_TYPE,
+          "No supported stream was found. You might need to allow more transport protocols or may otherwise be missing the right GStreamer RTSP extension plugin.");
+#else
       GST_ELEMENT_ERROR (src, STREAM, CODEC_NOT_FOUND,
           (_("No supported stream was found. You might need to allow "
                   "more transport protocols or may otherwise be missing "
                   "the right GStreamer RTSP extension plugin.")), (NULL));
+#endif
     }
     return GST_RTSP_ERROR;
   }
@@ -6889,10 +7810,21 @@ gst_rtspsrc_parse_range (GstRTSPSrc * src, const gchar * range,
   /* we need to start playback without clipping from the position reported by
    * the server */
   segment->start = seconds;
+#ifndef TIZEN_FEATURE_RTSP_MODIFICATION
+/*
+The range-min points to the start of the segment , not the current position.
+After getting the current position from MSL during normal pause/resume or during seek , we should not
+update the segment->position again with the rtp header npt timestamp.
+*/
   segment->position = seconds;
+#endif
 
   if (therange->max.type == GST_RTSP_TIME_NOW)
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+    seconds = 0;
+#else
     seconds = -1;
+#endif
   else if (therange->max.type == GST_RTSP_TIME_END)
     seconds = -1;
   else
@@ -7067,6 +7999,11 @@ gst_rtspsrc_open_from_sdp (GstRTSPSrc * src, GstSDPMessage * sdp,
     src->control = g_strdup (control);
   }
 
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+  src->is_audio_codec_supported = FALSE;
+  src->is_video_codec_supported = FALSE;
+#endif
+
   /* create streams */
   n_streams = gst_sdp_message_medias_len (sdp);
   for (i = 0; i < n_streams; i++) {
@@ -7074,7 +8011,15 @@ gst_rtspsrc_open_from_sdp (GstRTSPSrc * src, GstSDPMessage * sdp,
   }
 
   src->state = GST_RTSP_STATE_INIT;
-
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+  /* Check for the support for the Media codecs */
+  if ((!src->is_audio_codec_supported) && (!src->is_video_codec_supported)) {
+    GST_ERROR_OBJECT (src, "UnSupported Media Type !!!! \n");
+    goto unsupported_file_type;
+  } else {
+    GST_DEBUG_OBJECT (src, "Supported Media Type. \n");
+  }
+#endif
   /* setup streams */
   if ((res = gst_rtspsrc_setup_streams_start (src, async)) < 0)
     goto setup_failed;
@@ -7094,6 +8039,17 @@ setup_failed:
     gst_rtspsrc_cleanup (src);
     return res;
   }
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+unsupported_file_type:
+  {
+    gst_rtspsrc_post_error_message (src,
+        GST_RTSPSRC_ERROR_UNSUPPORTED_MEDIA_TYPE,
+        "No supported stream was found");
+    res = GST_RTSP_ERROR;
+    gst_rtspsrc_cleanup (src);
+    return res;
+  }
+#endif
 }
 
 static GstRTSPResult
@@ -7168,6 +8124,11 @@ restart:
   gst_rtsp_message_add_header (&request, GST_RTSP_HDR_ACCEPT,
       "application/sdp");
 
+  if (src->backchannel == BACKCHANNEL_ONVIF)
+    gst_rtsp_message_add_header (&request, GST_RTSP_HDR_REQUIRE,
+        BACKCHANNEL_ONVIF_HDR_REQUIRE_VAL);
+  /* TODO: Handle the case when backchannel is unsupported and goto restart */
+
   /* send DESCRIBE */
   GST_DEBUG_OBJECT (src, "send describe...");
 
@@ -7240,8 +8201,13 @@ restart:
   /* ERRORS */
 no_url:
   {
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+    gst_rtspsrc_post_error_message (src, GST_RTSPSRC_ERROR_INVALID_URL,
+        "No valid RTSP URL was provided");
+#else
     GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND, (NULL),
         ("No valid RTSP URL was provided"));
+#endif
     goto cleanup_error;
   }
 connect_failed:
@@ -7249,8 +8215,13 @@ connect_failed:
     gchar *str = gst_rtsp_strresult (res);
 
     if (res != GST_RTSP_EINTR) {
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+      gst_rtspsrc_post_error_message (src, GST_RTSPSRC_ERROR_CONNECTION_FAIL,
+          "Failed to connect.");
+#else
       GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ_WRITE, (NULL),
           ("Failed to connect. (%s)", str));
+#endif
     } else {
       GST_WARNING_OBJECT (src, "connect interrupted");
     }
@@ -7261,8 +8232,13 @@ create_request_failed:
   {
     gchar *str = gst_rtsp_strresult (res);
 
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+    gst_rtspsrc_post_error_message (src, GST_RTSPSRC_ERROR_BAD_REQUEST,
+        "Could not create request.");
+#else
     GST_ELEMENT_ERROR (src, LIBRARY, INIT, (NULL),
         ("Could not create request. (%s)", str));
+#endif
     g_free (str);
     goto cleanup_error;
   }
@@ -7280,15 +8256,25 @@ methods_error:
   }
 wrong_content_type:
   {
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+    gst_rtspsrc_post_error_message (src, GST_RTSPSRC_ERROR_OPTION_NOT_SUPPORTED,
+        "Server does not support SDP. ");
+#else
     GST_ELEMENT_ERROR (src, RESOURCE, SETTINGS, (NULL),
         ("Server does not support SDP, got %s.", respcont));
+#endif
     res = GST_RTSP_ERROR;
     goto cleanup_error;
   }
 no_describe:
   {
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+    gst_rtspsrc_post_error_message (src, GST_RTSPSRC_ERROR_METHOD_NOT_ALLOWED,
+        "Server can not provide an SDP.");
+#else
     GST_ELEMENT_ERROR (src, RESOURCE, SETTINGS, (NULL),
         ("Server can not provide an SDP."));
+#endif
     res = GST_RTSP_ERROR;
     goto cleanup_error;
   }
@@ -7392,9 +8378,14 @@ gst_rtspsrc_close (GstRTSPSrc * src, gboolean async, gboolean only_close)
     /* do TEARDOWN */
     res =
         gst_rtspsrc_init_request (src, &request, GST_RTSP_TEARDOWN, setup_url);
+    GST_LOG_OBJECT (src, "Teardown on %s", setup_url);
     if (res < 0)
       goto create_request_failed;
 
+    if (stream->is_backchannel && src->backchannel == BACKCHANNEL_ONVIF)
+      gst_rtsp_message_add_header (&request, GST_RTSP_HDR_REQUIRE,
+          BACKCHANNEL_ONVIF_HDR_REQUIRE_VAL);
+
     if (async)
       GST_ELEMENT_PROGRESS (src, CONTINUE, "close", ("Closing stream"));
 
@@ -7436,8 +8427,13 @@ create_request_failed:
   {
     gchar *str = gst_rtsp_strresult (res);
 
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+    gst_rtspsrc_post_error_message (src, GST_RTSPSRC_ERROR_BAD_REQUEST,
+        "Could not create request.");
+#else
     GST_ELEMENT_ERROR (src, LIBRARY, INIT, (NULL),
         ("Could not create request. (%s)", str));
+#endif
     g_free (str);
     goto close;
   }
@@ -7447,8 +8443,13 @@ send_error:
 
     gst_rtsp_message_unset (&request);
     if (res != GST_RTSP_EINTR) {
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+      gst_rtspsrc_post_error_message (src, GST_RTSPSRC_ERROR_CONNECTION_FAIL,
+          "Could not send message.");
+#else
       GST_ELEMENT_ERROR (src, RESOURCE, WRITE, (NULL),
           ("Could not send message. (%s)", str));
+#endif
     } else {
       GST_WARNING_OBJECT (src, "TEARDOWN interrupted");
     }
@@ -7588,7 +8589,12 @@ static gchar *
 gen_range_header (GstRTSPSrc * src, GstSegment * segment)
 {
   gchar val_str[G_ASCII_DTOSTR_BUF_SIZE] = { 0, };
-
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+  if (src->start_position != 0 && segment->position == 0) {
+    segment->position = src->start_position;
+    src->start_position = 0;
+  }
+#endif
   if (src->range && src->range->min.type == GST_RTSP_TIME_NOW) {
     g_strlcpy (val_str, "now", sizeof (val_str));
   } else {
@@ -7599,6 +8605,9 @@ gen_range_header (GstRTSPSrc * src, GstSegment * segment)
           ((gdouble) segment->position) / GST_SECOND);
     }
   }
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+  GST_DEBUG_OBJECT (src, "Range Header Added : npt=%s-", val_str);
+#endif
   return g_strdup_printf ("npt=%s-", val_str);
 }
 
@@ -7714,13 +8723,34 @@ restart:
       goto create_request_failed;
 
     if (src->need_range && src->seekable >= 0.0) {
+#ifndef TIZEN_FEATURE_RTSP_MODIFICATION
       hval = gen_range_header (src, segment);
 
       gst_rtsp_message_take_header (&request, GST_RTSP_HDR_RANGE, hval);
 
+#endif
       /* store the newsegment event so it can be sent from the streaming thread. */
       src->need_segment = TRUE;
     }
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+    else {
+/*
+ Updating position with the MSL current position as gst_rtspsrc_get_position() does not return correct position.
+*/
+      GST_DEBUG_OBJECT (src,
+          " During normal pause-resume , segment->position=%" GST_TIME_FORMAT
+          ",src->start_position=%" GST_TIME_FORMAT,
+          GST_TIME_ARGS (segment->position),
+          GST_TIME_ARGS (src->start_position));
+      segment->position = src->last_pos;
+    }
+
+/*
+ Sending the npt range request for each play request for updating the segment position properly.
+*/
+    hval = gen_range_header (src, segment);
+    gst_rtsp_message_take_header (&request, GST_RTSP_HDR_RANGE, hval);
+#endif
 
     if (segment->rate != 1.0) {
       gchar hval[G_ASCII_DTOSTR_BUF_SIZE];
@@ -7736,6 +8766,13 @@ restart:
       gst_rtsp_message_add_header (&request, GST_RTSP_HDR_SEEK_STYLE,
           seek_style);
 
+    /* when we have an ONVIF audio backchannel, the PLAY request must have the
+     * Require: header when doing either aggregate or non-aggregate control */
+    if (src->backchannel == BACKCHANNEL_ONVIF &&
+        (control || stream->is_backchannel))
+      gst_rtsp_message_add_header (&request, GST_RTSP_HDR_REQUIRE,
+          BACKCHANNEL_ONVIF_HDR_REQUIRE_VAL);
+
     if (async)
       GST_ELEMENT_PROGRESS (src, CONTINUE, "request", ("Sending PLAY request"));
 
@@ -7856,25 +8893,30 @@ done:
   /* ERRORS */
 open_failed:
   {
-    GST_DEBUG_OBJECT (src, "failed to open stream");
+    GST_WARNING_OBJECT (src, "failed to open stream");
     goto done;
   }
 not_supported:
   {
-    GST_DEBUG_OBJECT (src, "PLAY is not supported");
+    GST_WARNING_OBJECT (src, "PLAY is not supported");
     goto done;
   }
 was_playing:
   {
-    GST_DEBUG_OBJECT (src, "we were already PLAYING");
+    GST_WARNING_OBJECT (src, "we were already PLAYING");
     goto done;
   }
 create_request_failed:
   {
     gchar *str = gst_rtsp_strresult (res);
 
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+    gst_rtspsrc_post_error_message (src, GST_RTSPSRC_ERROR_BAD_REQUEST,
+        "Could not create request. ");
+#else
     GST_ELEMENT_ERROR (src, LIBRARY, INIT, (NULL),
         ("Could not create request. (%s)", str));
+#endif
     g_free (str);
     goto done;
   }
@@ -7884,8 +8926,13 @@ send_error:
 
     gst_rtsp_message_unset (&request);
     if (res != GST_RTSP_EINTR) {
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+      gst_rtspsrc_post_error_message (src, GST_RTSPSRC_ERROR_CONNECTION_FAIL,
+          "Could not send message.");
+#else
       GST_ELEMENT_ERROR (src, RESOURCE, WRITE, (NULL),
           ("Could not send message. (%s)", str));
+#endif
     } else {
       GST_WARNING_OBJECT (src, "PLAY interrupted");
     }
@@ -7950,6 +8997,13 @@ gst_rtspsrc_pause (GstRTSPSrc * src, gboolean async)
                 setup_url)) < 0)
       goto create_request_failed;
 
+    /* when we have an ONVIF audio backchannel, the PAUSE request must have the
+     * Require: header when doing either aggregate or non-aggregate control */
+    if (src->backchannel == BACKCHANNEL_ONVIF &&
+        (control || stream->is_backchannel))
+      gst_rtsp_message_add_header (&request, GST_RTSP_HDR_REQUIRE,
+          BACKCHANNEL_ONVIF_HDR_REQUIRE_VAL);
+
     if ((res =
             gst_rtspsrc_send (src, conninfo, &request, &response, NULL,
                 NULL)) < 0)
@@ -7995,8 +9049,13 @@ create_request_failed:
   {
     gchar *str = gst_rtsp_strresult (res);
 
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+    gst_rtspsrc_post_error_message (src, GST_RTSPSRC_ERROR_BAD_REQUEST,
+        "Could not create request.");
+#else
     GST_ELEMENT_ERROR (src, LIBRARY, INIT, (NULL),
         ("Could not create request. (%s)", str));
+#endif
     g_free (str);
     goto done;
   }
@@ -8006,8 +9065,13 @@ send_error:
 
     gst_rtsp_message_unset (&request);
     if (res != GST_RTSP_EINTR) {
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+      gst_rtspsrc_post_error_message (src, GST_RTSPSRC_ERROR_CONNECTION_FAIL,
+          "Could not send message.");
+#else
       GST_ELEMENT_ERROR (src, RESOURCE, WRITE, (NULL),
           ("Could not send message. (%s)", str));
+#endif
     } else {
       GST_WARNING_OBJECT (src, "PAUSE interrupted");
     }
@@ -8101,13 +9165,22 @@ static void
 gst_rtspsrc_thread (GstRTSPSrc * src)
 {
   gint cmd;
+  ParameterRequest *req = NULL;
 
   GST_OBJECT_LOCK (src);
   cmd = src->pending_cmd;
   if (cmd == CMD_RECONNECT || cmd == CMD_PLAY || cmd == CMD_PAUSE
-      || cmd == CMD_LOOP || cmd == CMD_OPEN)
-    src->pending_cmd = CMD_LOOP;
-  else
+      || cmd == CMD_LOOP || cmd == CMD_OPEN || cmd == CMD_GET_PARAMETER
+      || cmd == CMD_SET_PARAMETER) {
+    if (g_queue_is_empty (&src->set_get_param_q)) {
+      src->pending_cmd = CMD_LOOP;
+    } else {
+      ParameterRequest *next_req;
+      req = g_queue_pop_head (&src->set_get_param_q);
+      next_req = g_queue_peek_head (&src->set_get_param_q);
+      src->pending_cmd = next_req ? next_req->cmd : CMD_LOOP;
+    }
+  } else
     src->pending_cmd = CMD_WAIT;
   GST_DEBUG_OBJECT (src, "got command %s", cmd_to_string (cmd));
 
@@ -8130,6 +9203,12 @@ gst_rtspsrc_thread (GstRTSPSrc * src)
     case CMD_CLOSE:
       gst_rtspsrc_close (src, TRUE, FALSE);
       break;
+    case CMD_GET_PARAMETER:
+      gst_rtspsrc_get_parameter (src, req);
+      break;
+    case CMD_SET_PARAMETER:
+      gst_rtspsrc_set_parameter (src, req);
+      break;
     case CMD_LOOP:
       gst_rtspsrc_loop (src);
       break;
@@ -8141,6 +9220,8 @@ gst_rtspsrc_thread (GstRTSPSrc * src)
   }
 
   GST_OBJECT_LOCK (src);
+  /* No more cmds, wake any waiters */
+  g_cond_broadcast (&src->cmd_cond);
   /* and go back to sleep */
   if (src->pending_cmd == CMD_WAIT) {
     if (src->task)
@@ -8222,8 +9303,14 @@ gst_rtspsrc_change_state (GstElement * element, GstStateChange transition)
 {
   GstRTSPSrc *rtspsrc;
   GstStateChangeReturn ret;
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+  guint64 end_time;
+#endif
 
   rtspsrc = GST_RTSPSRC (element);
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+  GST_WARNING_OBJECT (rtspsrc, "State change transition: %d \n", transition);
+#endif
 
   switch (transition) {
     case GST_STATE_CHANGE_NULL_TO_READY:
@@ -8264,6 +9351,18 @@ gst_rtspsrc_change_state (GstElement * element, GstStateChange transition)
       ret = GST_STATE_CHANGE_SUCCESS;
       break;
     case GST_STATE_CHANGE_READY_TO_PAUSED:
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+      /* don't change to PAUSE state before complete stream opend.
+         see gst_rtspsrc_loop_complete_cmd() */
+      g_mutex_lock (&(rtspsrc)->pause_lock);
+      end_time = g_get_monotonic_time () + 10 * G_TIME_SPAN_SECOND;
+      if (!g_cond_wait_until (&(rtspsrc)->open_end, &(rtspsrc)->pause_lock,
+              end_time)) {
+        GST_WARNING_OBJECT (rtspsrc,
+            "time out: stream opend is not completed yet..");
+      }
+      g_mutex_unlock (&(rtspsrc)->pause_lock);
+#endif
       ret = GST_STATE_CHANGE_NO_PREROLL;
       break;
     case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
@@ -8276,7 +9375,8 @@ gst_rtspsrc_change_state (GstElement * element, GstStateChange transition)
       ret = GST_STATE_CHANGE_NO_PREROLL;
       break;
     case GST_STATE_CHANGE_PAUSED_TO_READY:
-      gst_rtspsrc_loop_send_cmd (rtspsrc, CMD_CLOSE, CMD_ALL);
+      gst_rtspsrc_loop_send_cmd_and_wait (rtspsrc, CMD_CLOSE, CMD_ALL,
+          rtspsrc->teardown_timeout);
       ret = GST_STATE_CHANGE_SUCCESS;
       break;
     case GST_STATE_CHANGE_READY_TO_NULL:
@@ -8452,6 +9552,227 @@ gst_rtspsrc_uri_handler_init (gpointer g_iface, gpointer iface_data)
   iface->set_uri = gst_rtspsrc_uri_set_uri;
 }
 
+
+/* send GET_PARAMETER */
+static GstRTSPResult
+gst_rtspsrc_get_parameter (GstRTSPSrc * src, ParameterRequest * req)
+{
+  GstRTSPMessage request = { 0 };
+  GstRTSPMessage response = { 0 };
+  GstRTSPResult res;
+  GstRTSPStatusCode code = GST_RTSP_STS_OK;
+  const gchar *control;
+  gchar *recv_body = NULL;
+  guint recv_body_len;
+
+  GST_DEBUG_OBJECT (src, "creating server get_parameter");
+
+  if ((res = gst_rtspsrc_ensure_open (src, FALSE)) < 0)
+    goto open_failed;
+
+  control = get_aggregate_control (src);
+  if (control == NULL)
+    goto no_control;
+
+  if (!(src->methods & GST_RTSP_GET_PARAMETER))
+    goto not_supported;
+
+  gst_rtspsrc_connection_flush (src, FALSE);
+
+  res = gst_rtsp_message_init_request (&request, GST_RTSP_GET_PARAMETER,
+      control);
+  if (res < 0)
+    goto create_request_failed;
+
+  res = gst_rtsp_message_add_header (&request, GST_RTSP_HDR_CONTENT_TYPE,
+      req->content_type == NULL ? "text/parameters" : req->content_type);
+  if (res < 0)
+    goto add_content_hdr_failed;
+
+  if (req->body && req->body->len) {
+    res =
+        gst_rtsp_message_set_body (&request, (guint8 *) req->body->str,
+        req->body->len);
+    if (res < 0)
+      goto set_body_failed;
+  }
+
+  if ((res = gst_rtspsrc_send (src, &src->conninfo,
+              &request, &response, &code, NULL)) < 0)
+    goto send_error;
+
+  res = gst_rtsp_message_get_body (&response, (guint8 **) & recv_body,
+      &recv_body_len);
+  if (res < 0)
+    goto get_body_failed;
+
+done:
+  {
+    gst_promise_reply (req->promise,
+        gst_structure_new ("get-parameter-reply",
+            "rtsp-result", G_TYPE_INT, res,
+            "rtsp-code", G_TYPE_INT, code,
+            "rtsp-reason", G_TYPE_STRING, gst_rtsp_status_as_text (code),
+            "body", G_TYPE_STRING, GST_STR_NULL (recv_body), NULL));
+    free_param_data (req);
+
+
+    gst_rtsp_message_unset (&request);
+    gst_rtsp_message_unset (&response);
+
+    return res;
+  }
+
+  /* ERRORS */
+open_failed:
+  {
+    GST_DEBUG_OBJECT (src, "failed to open stream");
+    goto done;
+  }
+no_control:
+  {
+    GST_DEBUG_OBJECT (src, "no control url to send GET_PARAMETER");
+    res = GST_RTSP_ERROR;
+    goto done;
+  }
+not_supported:
+  {
+    GST_DEBUG_OBJECT (src, "GET_PARAMETER is not supported");
+    res = GST_RTSP_ERROR;
+    goto done;
+  }
+create_request_failed:
+  {
+    GST_DEBUG_OBJECT (src, "could not create GET_PARAMETER request");
+    goto done;
+  }
+add_content_hdr_failed:
+  {
+    GST_DEBUG_OBJECT (src, "could not add content header");
+    goto done;
+  }
+set_body_failed:
+  {
+    GST_DEBUG_OBJECT (src, "could not set body");
+    goto done;
+  }
+send_error:
+  {
+    gchar *str = gst_rtsp_strresult (res);
+
+    GST_ELEMENT_WARNING (src, RESOURCE, WRITE, (NULL),
+        ("Could not send get-parameter. (%s)", str));
+    g_free (str);
+    goto done;
+  }
+get_body_failed:
+  {
+    GST_DEBUG_OBJECT (src, "could not get body");
+    goto done;
+  }
+}
+
+/* send SET_PARAMETER */
+static GstRTSPResult
+gst_rtspsrc_set_parameter (GstRTSPSrc * src, ParameterRequest * req)
+{
+  GstRTSPMessage request = { 0 };
+  GstRTSPMessage response = { 0 };
+  GstRTSPResult res = GST_RTSP_OK;
+  GstRTSPStatusCode code = GST_RTSP_STS_OK;
+  const gchar *control;
+
+  GST_DEBUG_OBJECT (src, "creating server set_parameter");
+
+  if ((res = gst_rtspsrc_ensure_open (src, FALSE)) < 0)
+    goto open_failed;
+
+  control = get_aggregate_control (src);
+  if (control == NULL)
+    goto no_control;
+
+  if (!(src->methods & GST_RTSP_SET_PARAMETER))
+    goto not_supported;
+
+  gst_rtspsrc_connection_flush (src, FALSE);
+
+  res =
+      gst_rtsp_message_init_request (&request, GST_RTSP_SET_PARAMETER, control);
+  if (res < 0)
+    goto send_error;
+
+  res = gst_rtsp_message_add_header (&request, GST_RTSP_HDR_CONTENT_TYPE,
+      req->content_type == NULL ? "text/parameters" : req->content_type);
+  if (res < 0)
+    goto add_content_hdr_failed;
+
+  if (req->body && req->body->len) {
+    res =
+        gst_rtsp_message_set_body (&request, (guint8 *) req->body->str,
+        req->body->len);
+
+    if (res < 0)
+      goto set_body_failed;
+  }
+
+  if ((res = gst_rtspsrc_send (src, &src->conninfo,
+              &request, &response, &code, NULL)) < 0)
+    goto send_error;
+
+done:
+  {
+    gst_promise_reply (req->promise, gst_structure_new ("set-parameter-reply",
+            "rtsp-result", G_TYPE_INT, res,
+            "rtsp-code", G_TYPE_INT, code,
+            "rtsp-reason", G_TYPE_STRING, gst_rtsp_status_as_text (code),
+            NULL));
+    free_param_data (req);
+
+    gst_rtsp_message_unset (&request);
+    gst_rtsp_message_unset (&response);
+
+    return res;
+  }
+
+  /* ERRORS */
+open_failed:
+  {
+    GST_DEBUG_OBJECT (src, "failed to open stream");
+    goto done;
+  }
+no_control:
+  {
+    GST_DEBUG_OBJECT (src, "no control url to send SET_PARAMETER");
+    res = GST_RTSP_ERROR;
+    goto done;
+  }
+not_supported:
+  {
+    GST_DEBUG_OBJECT (src, "SET_PARAMETER is not supported");
+    res = GST_RTSP_ERROR;
+    goto done;
+  }
+add_content_hdr_failed:
+  {
+    GST_DEBUG_OBJECT (src, "could not add content header");
+    goto done;
+  }
+set_body_failed:
+  {
+    GST_DEBUG_OBJECT (src, "could not set body");
+    goto done;
+  }
+send_error:
+  {
+    gchar *str = gst_rtsp_strresult (res);
+
+    GST_ELEMENT_WARNING (src, RESOURCE, WRITE, (NULL),
+        ("Could not send set-parameter. (%s)", str));
+    g_free (str);
+    goto done;
+  }
+}
+
 typedef struct _RTSPKeyValue
 {
   GstRTSPHeaderField field;