rtsp: to support player api spec for rtsp kind of buffering 18/103818/1
authorEunhae Choi <eunhae1.choi@samsung.com>
Fri, 9 Dec 2016 13:09:05 +0000 (22:09 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Fri, 9 Dec 2016 13:09:07 +0000 (22:09 +0900)
Change-Id: I33b42bd9da47e1041c429e62e1ac4665181756ac
Signed-off-by: Eunhae Choi <eunhae1.choi@samsung.com>
gst/rtpmanager/gstrtpbin.c
gst/rtsp/gstrtspsrc.c
gst/rtsp/gstrtspsrc.h
packaging/gst-plugins-good.spec

index 21e1cd8..9098eed 100644 (file)
@@ -371,7 +371,9 @@ struct _GstRtpBinStream
   gulong buffer_ptreq_sig;
   gulong buffer_ntpstop_sig;
   gint percent;
-
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+  gint prev_percent;
+#endif
   /* the PT demuxer of the SSRC */
   GstElement *demux;
   gulong demux_newpad_sig;
@@ -1507,6 +1509,9 @@ static GstRtpBinStream *
 create_stream (GstRtpBinSession * session, guint32 ssrc)
 {
   GstElement *buffer, *demux = NULL;
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+  GstElement *queue2 = NULL;
+#endif
   GstRtpBinStream *stream;
   GstRtpBin *rtpbin;
   GstState target;
@@ -1519,7 +1524,11 @@ create_stream (GstRtpBinSession * session, guint32 ssrc)
   if (!rtpbin->ignore_pt)
     if (!(demux = gst_element_factory_make ("rtpptdemux", NULL)))
       goto no_demux;
-
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+  if (session->bin->buffer_mode == RTP_JITTER_BUFFER_MODE_SLAVE)
+    if (!(queue2 = gst_element_factory_make ("queue2", NULL)))
+      goto no_queue2;
+#endif
   stream = g_new0 (GstRtpBinStream, 1);
   stream->ssrc = ssrc;
   stream->bin = rtpbin;
@@ -1531,6 +1540,9 @@ create_stream (GstRtpBinSession * session, guint32 ssrc)
   stream->rt_delta = 0;
   stream->rtp_delta = 0;
   stream->percent = 100;
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+  stream->prev_percent = 0;
+#endif
   stream->clock_base = -100 * GST_SECOND;
   session->streams = g_slist_prepend (session->streams, stream);
 
@@ -1550,18 +1562,47 @@ create_stream (GstRtpBinSession * session, guint32 ssrc)
   g_object_set (buffer, "mode", rtpbin->buffer_mode, NULL);
   g_object_set (buffer, "do-retransmission", rtpbin->do_retransmission, NULL);
 
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+  /* configure queue2 to use live buffering */
+  if (queue2) {
+    g_object_set_data (G_OBJECT (queue2), "GstRTPBin.stream", stream);
+    g_object_set (queue2, "use-buffering", TRUE, NULL);
+    g_object_set (queue2, "buffer-mode", GST_BUFFERING_LIVE, NULL);
+  }
+#endif
+
   g_signal_emit (rtpbin, gst_rtp_bin_signals[SIGNAL_NEW_JITTERBUFFER], 0,
       buffer, session->id, ssrc);
 
   if (!rtpbin->ignore_pt)
     gst_bin_add (GST_BIN_CAST (rtpbin), demux);
+
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+  if (queue2)
+    gst_bin_add (GST_BIN_CAST (rtpbin), queue2);
+#endif
+
   gst_bin_add (GST_BIN_CAST (rtpbin), buffer);
 
   /* link stuff */
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+  if (queue2) {
+    gst_element_link_pads_full (buffer, "src", queue2, "sink",
+        GST_PAD_LINK_CHECK_NOTHING);
+    if (demux) {
+      gst_element_link_pads_full (queue2, "src", demux, "sink",
+          GST_PAD_LINK_CHECK_NOTHING);
+    }
+  } else if (demux)
+     gst_element_link_pads_full (buffer, "src", demux, "sink",
+         GST_PAD_LINK_CHECK_NOTHING);
+
+#else
   if (demux)
     gst_element_link_pads_full (buffer, "src", demux, "sink",
         GST_PAD_LINK_CHECK_NOTHING);
 
+#endif
   if (rtpbin->buffering) {
     guint64 last_out;
 
@@ -1581,6 +1622,11 @@ create_stream (GstRtpBinSession * session, guint32 ssrc)
 
   gst_element_set_state (buffer, target);
 
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+  if (queue2)
+    gst_element_set_state (queue2, target);
+#endif
+
   return stream;
 
   /* ERRORS */
@@ -1595,6 +1641,15 @@ no_demux:
     g_warning ("rtpbin: could not create rtpptdemux element");
     return NULL;
   }
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+no_queue2:
+  {
+    gst_object_unref (buffer);
+    gst_object_unref (demux);
+    g_warning ("rtpbin: could not create queue2 element");
+    return NULL;
+  }
+#endif
 }
 
 /* called with RTP_BIN_LOCK */
@@ -2522,6 +2577,9 @@ gst_rtp_bin_handle_message (GstBin * bin, GstMessage * message)
       gint min_percent = 100;
       GSList *sessions, *streams;
       GstRtpBinStream *stream;
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+      gboolean buffering_flag = FALSE, update_buffering_status = TRUE;
+#endif
       gboolean change = FALSE, active = FALSE;
       GstClockTime min_out_time;
       GstBufferingMode mode;
@@ -2554,13 +2612,56 @@ gst_rtp_bin_handle_message (GstBin * bin, GstMessage * message)
             for (streams = session->streams; streams;
                 streams = g_slist_next (streams)) {
               GstRtpBinStream *stream = (GstRtpBinStream *) streams->data;
-
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+               GstPad *temp_pad_src = NULL;
+               GstCaps *temp_caps_src = NULL;
+               GstStructure *caps_structure;
+               const gchar *caps_str_media = NULL;
+               temp_pad_src = gst_element_get_static_pad (stream->buffer, "src");
+               temp_caps_src = gst_pad_get_current_caps(temp_pad_src);
+                GST_DEBUG_OBJECT (bin, "stream %p percent %d : temp_caps_src=%"GST_PTR_FORMAT, stream,stream->percent,temp_caps_src);
+               if (temp_caps_src)
+               {
+                       caps_structure = gst_caps_get_structure (temp_caps_src, 0);
+                       caps_str_media = gst_structure_get_string (caps_structure, "media");
+                       if (caps_str_media != NULL)
+                       {
+                               if ((strcmp(caps_str_media,"video") != 0)&&(strcmp(caps_str_media,"audio") != 0))
+                               {
+                                       GST_DEBUG_OBJECT (bin, "Non Audio/Video Stream.. ignoring the same !!");
+                                       gst_caps_unref( temp_caps_src );
+                                       gst_object_unref( temp_pad_src );
+                                       continue;
+                               }
+                               else if(stream->percent >= 100)
+                               {
+                                       /*[shweta.agg] Most of the time buffering icon displays in rtsp playback.
+                                     Optimizing the buffering updation code. Whenever any stream percentage
+                                         reaches 100 do not post buffering messages.*/
+                                       if(stream->prev_percent < 100)
+                                       {
+                                               buffering_flag = TRUE;
+                                       }
+                                       else
+                                       {
+                                               update_buffering_status = FALSE;
+                                       }
+                               }
+                       }
+                       gst_caps_unref( temp_caps_src );
+               }
+               gst_object_unref( temp_pad_src );
+#else
               GST_DEBUG_OBJECT (bin, "stream %p percent %d", stream,
                   stream->percent);
-
+#endif
               /* find min percent */
               if (min_percent > stream->percent)
                 min_percent = stream->percent;
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+             /* Updating prev stream percentage */
+             stream->prev_percent = stream->percent;
+#endif
             }
           } else {
             GST_INFO_OBJECT (bin,
@@ -2570,7 +2671,24 @@ gst_rtp_bin_handle_message (GstBin * bin, GstMessage * message)
           GST_RTP_SESSION_UNLOCK (session);
         }
         GST_DEBUG_OBJECT (bin, "min percent %d", min_percent);
-
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+        if (rtpbin->buffer_mode != RTP_JITTER_BUFFER_MODE_SLAVE) {
+          if (rtpbin->buffering) {
+            if (min_percent == 100) {
+              rtpbin->buffering = FALSE;
+              active = TRUE;
+              change = TRUE;
+            }
+          } else {
+            if (min_percent < 100) {
+              /* pause the streams */
+              rtpbin->buffering = TRUE;
+              active = FALSE;
+              change = TRUE;
+            }
+          }
+        }
+#else
         if (rtpbin->buffering) {
           if (min_percent == 100) {
             rtpbin->buffering = FALSE;
@@ -2585,16 +2703,35 @@ gst_rtp_bin_handle_message (GstBin * bin, GstMessage * message)
             change = TRUE;
           }
         }
+#endif
         GST_RTP_BIN_UNLOCK (rtpbin);
 
         gst_message_unref (message);
 
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+      if (rtpbin->buffer_mode == RTP_JITTER_BUFFER_MODE_SLAVE)
+      {
+         if(update_buffering_status==FALSE)
+         {
+               break;
+         }
+         if(buffering_flag)
+         {
+               min_percent=100;
+               GST_DEBUG_OBJECT (bin, "forcefully change min_percent to 100!!!");
+         }
+      }
+#endif
         /* make a new buffering message with the min value */
         message =
             gst_message_new_buffering (GST_OBJECT_CAST (bin), min_percent);
         gst_message_set_buffering_stats (message, mode, avg_in, avg_out,
             buffering_left);
 
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+        if (rtpbin->buffer_mode == RTP_JITTER_BUFFER_MODE_SLAVE)
+          goto slave_buffering;
+#endif
         if (G_UNLIKELY (change)) {
           GstClock *clock;
           guint64 running_time = 0;
@@ -2672,6 +2809,9 @@ gst_rtp_bin_handle_message (GstBin * bin, GstMessage * message)
           GST_RTP_BIN_UNLOCK (rtpbin);
         }
       }
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+slave_buffering:
+#endif
       GST_BIN_CLASS (parent_class)->handle_message (bin, message);
       break;
     }
index 1f22e98..c8c909c 100644 (file)
@@ -233,6 +233,10 @@ gst_rtsp_src_ntp_time_source_get_type (void)
 #define DEFAULT_NTP_TIME_SOURCE  NTP_TIME_SOURCE_NTP
 #define DEFAULT_USER_AGENT       "GStreamer/" PACKAGE_VERSION
 
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+#define DEFAULT_START_POSITION   0
+#endif
+
 enum
 {
   PROP_0,
@@ -241,6 +245,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,
@@ -399,6 +407,30 @@ cmd_to_string (guint cmd)
 }
 #endif
 
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+static void
+gst_rtspsrc_post_error_message ( GstRTSPSrc * src, GstRTSPSrcError error_id, 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)
 {
@@ -464,7 +496,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)",
@@ -851,6 +894,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;
@@ -880,6 +931,10 @@ gst_rtspsrc_init (GstRTSPSrc * src)
   src->ntp_time_source = DEFAULT_NTP_TIME_SOURCE;
   src->user_agent = g_strdup (DEFAULT_USER_AGENT);
 
+#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 ();
 
@@ -906,6 +961,25 @@ gst_rtspsrc_finalize (GObject * object)
 
   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);
@@ -915,6 +989,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;
@@ -1047,6 +1126,15 @@ 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;
@@ -1191,6 +1279,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;
@@ -1515,7 +1611,9 @@ gst_rtspsrc_collect_payloads (GstRTSPSrc * src, const GstSDPMessage * sdp,
     GstStructure *s;
     const gchar *enc;
     PtMapItem item;
-
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+    gchar *encoder , *mediatype;
+#endif
     pt = atoi (gst_sdp_media_get_format (media, i));
 
     GST_DEBUG_OBJECT (src, " looking at %d pt: %d", i, pt);
@@ -1535,6 +1633,59 @@ gst_rtspsrc_collect_payloads (GstRTSPSrc * src, const GstSDPMessage * sdp,
         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 */
     outcaps = gst_caps_intersect (caps, global_caps);
@@ -2454,6 +2605,7 @@ gst_rtspsrc_set_state (GstRTSPSrc * src, GstState state)
 {
   GList *walk;
 
+  GST_WARNING_OBJECT(src, "Setting [%s] element state to: %s \n", GST_ELEMENT_NAME(GST_ELEMENT_CAST (src)),gst_element_state_get_name(state));
   if (src->manager)
     gst_element_set_state (GST_ELEMENT_CAST (src->manager), state);
 
@@ -5043,8 +5195,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);
@@ -5054,8 +5211,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;
@@ -5178,8 +5340,13 @@ connect_error:
 
     src->conninfo.connected = FALSE;
     if (res != GST_RTSP_EINTR) {
-      GST_ELEMENT_ERROR (src, RESOURCE, OPEN_READ_WRITE, (NULL),
+#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 {
@@ -5191,8 +5358,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;
   }
@@ -5203,8 +5375,13 @@ handle_request_failed:
 
     gst_rtsp_message_unset (&message);
     if (res != GST_RTSP_EINTR) {
-      GST_ELEMENT_ERROR (src, RESOURCE, WRITE, (NULL),
+#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 {
@@ -5276,10 +5453,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:
@@ -5318,9 +5500,34 @@ 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
+  GstStructure *s;
+#endif
+  GST_WARNING_OBJECT (src, "Got cmd %s", cmd_to_string (cmd));
+
   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"));
@@ -5363,6 +5570,13 @@ 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
+/*[shweta.agg] 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"));
@@ -5761,8 +5975,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:
@@ -5858,8 +6077,13 @@ send_error:
     gchar *str = gst_rtsp_strresult (res);
 
     if (res != GST_RTSP_EINTR) {
-      GST_ELEMENT_ERROR (src, RESOURCE, WRITE, (NULL),
+#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");
     }
@@ -5885,8 +6109,13 @@ 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");
         }
@@ -5996,12 +6225,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
         GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND, (NULL), ("%s",
                 response->type_data.response.reason));
+#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
         GST_ELEMENT_ERROR (src, RESOURCE, NOT_AUTHORIZED, (NULL), ("%s",
                 response->type_data.response.reason));
+#endif
         break;
       case GST_RTSP_STS_MOVED_PERMANENTLY:
       case GST_RTSP_STS_MOVE_TEMPORARILY:
@@ -6046,9 +6285,14 @@ 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
         GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
             ("Got error response: %d (%s).", response->type_data.response.code,
                 response->type_data.response.reason));
+#endif
         break;
     }
     /* if we return ERROR we should unset the response ourselves */
@@ -6124,14 +6368,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;
   }
 }
@@ -6830,30 +7084,50 @@ gst_rtspsrc_setup_streams (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;
   }
@@ -6861,8 +7135,13 @@ response_error:
   {
     const gchar *str = gst_rtsp_status_as_text (code);
 
+#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;
   }
@@ -6871,8 +7150,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");
     }
@@ -6881,8 +7165,13 @@ send_error:
   }
 no_transport:
   {
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+    gst_rtspsrc_post_error_message ( src,
+                                       GST_RTSPSRC_ERROR_BAD_TRANSPORT,"Server did not select transport.");
+#else
     GST_ELEMENT_ERROR (src, RESOURCE, SETTINGS, (NULL),
         ("Server did not select transport."));
+#endif
     res = GST_RTSP_ERROR;
     goto cleanup_error;
   }
@@ -6890,15 +7179,25 @@ 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;
   }
@@ -6947,10 +7246,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
+/*
+[prasenjit.c] 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
@@ -7126,6 +7436,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++) {
@@ -7133,7 +7448,18 @@ gst_rtspsrc_open_from_sdp (GstRTSPSrc * src, GstSDPMessage * sdp,
   }
 
   src->state = GST_RTSP_STATE_INIT;
-
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+  //[prasenjit.c] 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 (src, async)) < 0)
     goto setup_failed;
@@ -7153,6 +7479,16 @@ 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
@@ -7270,8 +7606,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:
@@ -7279,8 +7620,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");
     }
@@ -7291,8 +7637,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;
   }
@@ -7310,15 +7661,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;
   }
@@ -7467,8 +7828,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;
   }
@@ -7478,8 +7844,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");
     }
@@ -7619,7 +7990,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 {
@@ -7630,6 +8006,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);
 }
 
@@ -7740,13 +8119,32 @@ gst_rtspsrc_play (GstRTSPSrc * src, GstSegment * segment, gboolean async)
       goto create_request_failed;
 
     if (src->need_range) {
+#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
+    {
+/*
+[prasenjit.c] 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;
+    }
+
+/*
+[prasenjit.c] 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];
@@ -7876,8 +8274,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;
   }
@@ -7887,8 +8290,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");
     }
@@ -7996,8 +8404,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;
   }
@@ -8007,8 +8420,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");
     }
@@ -8223,8 +8641,12 @@ 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);
+  GST_WARNING_OBJECT(rtspsrc, "State change transition: %d \n", transition);
 
   switch (transition) {
     case GST_STATE_CHANGE_NULL_TO_READY:
@@ -8265,6 +8687,16 @@ 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:
index a3d0a9a..d52788c 100644 (file)
@@ -77,6 +77,58 @@ typedef struct _GstRTSPSrcClass GstRTSPSrcClass;
 #define GST_RTSP_STREAM_LOCK(rtsp)       (g_rec_mutex_lock (GST_RTSP_STREAM_GET_LOCK(rtsp)))
 #define GST_RTSP_STREAM_UNLOCK(rtsp)     (g_rec_mutex_unlock (GST_RTSP_STREAM_GET_LOCK(rtsp)))
 
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+typedef enum {
+       GST_RTSPSRC_ERROR_NONE = 0,
+       GST_RTSPSRC_ERROR_UNSUPPORTED_AUDIO,
+       GST_RTSPSRC_ERROR_UNSUPPORTED_VIDEO,
+       GST_RTSPSRC_ERROR_CONNECTION_FAIL,
+       GST_RTSPSRC_ERROR_DNS_FAIL,
+       GST_RTSPSRC_ERROR_SERVER_DISCONNECTED,
+       GST_RTSPSRC_ERROR_BAD_SERVER,
+       GST_RTSPSRC_ERROR_INVALID_PROTOCOL,
+       GST_RTSPSRC_ERROR_INVALID_URL,
+       GST_RTSPSRC_ERROR_UNEXPECTED_MSG,
+       GST_RTSPSRC_ERROR_OUT_OF_MEMORIES,
+       GST_RTSPSRC_ERROR_RTSP_TIMEOUT,
+       GST_RTSPSRC_ERROR_BAD_REQUEST,
+       GST_RTSPSRC_ERROR_NOT_AUTHORIZED,
+       GST_RTSPSRC_ERROR_PAYMENT_REQUIRED,
+       GST_RTSPSRC_ERROR_FORBIDDEN,
+       GST_RTSPSRC_ERROR_CONTENT_NOT_FOUND,
+       GST_RTSPSRC_ERROR_METHOD_NOT_ALLOWED,
+       GST_RTSPSRC_ERROR_NOT_ACCEPTABLE,
+       GST_RTSPSRC_ERROR_PROXY_AUTHENTICATION_REQUIRED,
+       GST_RTSPSRC_ERROR_SERVER_TIMEOUT,
+       GST_RTSPSRC_ERROR_GONE,
+       GST_RTSPSRC_ERROR_LENGTH_REQUIRED,
+       GST_RTSPSRC_ERROR_PRECONDITION_FAILED,
+       GST_RTSPSRC_ERROR_REQUEST_ENTITY_TOO_LARGE,
+       GST_RTSPSRC_ERROR_REQUEST_URI_TOO_LARGE,
+       GST_RTSPSRC_ERROR_UNSUPPORTED_MEDIA_TYPE,
+       GST_RTSPSRC_ERROR_PARAMETER_NOT_UNDERSTOOD,
+       GST_RTSPSRC_ERROR_CONFERENCE_NOT_FOUND,
+       GST_RTSPSRC_ERROR_NOT_ENOUGH_BANDWIDTH,
+       GST_RTSPSRC_ERROR_NO_SESSION_ID,
+       GST_RTSPSRC_ERROR_METHOD_NOT_VALID_IN_THIS_STATE,
+       GST_RTSPSRC_ERROR_HEADER_FIELD_NOT_VALID_FOR_SOURCE,
+       GST_RTSPSRC_ERROR_INVALID_RANGE,
+       GST_RTSPSRC_ERROR_PARAMETER_IS_READONLY,
+       GST_RTSPSRC_ERROR_AGGREGATE_OP_NOT_ALLOWED,
+       GST_RTSPSRC_ERROR_ONLY_AGGREGATE_OP_ALLOWED,
+       GST_RTSPSRC_ERROR_BAD_TRANSPORT,
+       GST_RTSPSRC_ERROR_DESTINATION_UNREACHABLE,
+       GST_RTSPSRC_ERROR_INTERNAL_SERVER_ERROR,
+       GST_RTSPSRC_ERROR_NOT_IMPLEMENTED,
+       GST_RTSPSRC_ERROR_BAD_GATEWAY,
+       GST_RTSPSRC_ERROR_SERVICE_UNAVAILABLE,
+       GST_RTSPSRC_ERROR_GATEWAY_TIME_OUT      ,
+       GST_RTSPSRC_ERROR_RTSP_VERSION_NOT_SUPPORTED,
+       GST_RTSPSRC_ERROR_OPTION_NOT_SUPPORTED,
+}_GstRTSPSrcError;
+typedef _GstRTSPSrcError       GstRTSPSrcError;
+#endif
+
 typedef struct _GstRTSPConnInfo GstRTSPConnInfo;
 
 struct _GstRTSPConnInfo {
@@ -263,10 +315,25 @@ struct _GstRTSPSrc {
   gulong           manager_ptmap_id;
   gboolean         use_buffering;
 
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+  /* media type */
+  gboolean  is_audio_codec_supported;
+  gboolean     is_video_codec_supported;
+  gchar        *audio_codec;
+  gchar                *video_codec;
+  gchar                *video_frame_size;
+#endif
+
   GstRTSPConnInfo  conninfo;
 
   /* a list of RTSP extensions as GstElement */
   GstRTSPExtensionList  *extensions;
+
+#ifdef TIZEN_FEATURE_RTSP_MODIFICATION
+  GCond open_end;
+  GMutex pause_lock;
+  guint64 start_position;
+#endif
 };
 
 struct _GstRTSPSrcClass {
index 3842851..f576af0 100644 (file)
@@ -3,7 +3,7 @@
 
 Name:           gst-plugins-good
 Version:        1.6.1
-Release:        15
+Release:        16
 License:        LGPL-2.1+
 Summary:        GStreamer Streaming-Media Framework Plug-Ins
 Url:            http://gstreamer.freedesktop.org/
@@ -74,6 +74,7 @@ export CFLAGS+=" -DTIZEN_FEATURE_V4L2SRC_MODIFICATION\
                -DTIZEN_FEATURE_QTDEMUX_MODIFICATION\
                -DTIZEN_FEATURE_FLVDEMUX_MODIFICATION\
                -DTIZEN_FEATURE_GST_UPSTREAM\
+                -DTIZEN_FEATURE_RTSP_MODIFICATION\
                -DTIZEN_FEATURE_GST_MUX_ENHANCEMENT"
 %configure\
 %if ! 0%{?ENABLE_AALIB}