Change wfd message for video only mirroring 36/115836/7 accepted/tizen/common/20170303.090935 accepted/tizen/ivi/20170303.070311 accepted/tizen/mobile/20170303.070228 accepted/tizen/tv/20170303.070243 accepted/tizen/unified/20170309.035830 submit/tizen/20170303.040910 submit/tizen_unified/20170308.100413
authorHyunsoo, Park <hance.park@samsung.com>
Tue, 21 Feb 2017 11:22:01 +0000 (20:22 +0900)
committerSeokHoon Lee <andy.shlee@samsung.com>
Thu, 2 Mar 2017 05:40:45 +0000 (14:40 +0900)
Using this patch, 'wfd-audio-formats' parameter have none parameter for video only sink.
Basically, screen mirroring provides video & audio simultaneously.
This patch will make screen mirroring to provide Video only.

-When Video only mirroring mode goes, it makes 'wfd_audio_codecs' messages to 'none'.

If 'sink session mode' in 'mmfw_wfd_sink.ini' is set '2',
screen mirroring runs without audio(that is, video only mirroring)

Change-Id: Ia88fb8a23c2f28cda222075835aa16c4a6bb3987
Signed-off-by: Hyunsoo, Park <hance.park@samsung.com>
gst/rtsp-server/gstwfdmessage.c
gst/rtsp-server/rtsp-client-wfd.c
gst/rtsp-server/rtsp-media-factory-wfd.c
gst/rtsp-server/rtsp-media-factory-wfd.h
packaging/gst-rtsp-server.spec

index 6540b9d..3e6d099 100644 (file)
@@ -467,18 +467,24 @@ gst_wfd_parse_attribute (gchar * buffer, GstWFDMessage * msg)
   if (!g_strcmp0 (attr, GST_STRING_WFD_AUDIO_CODECS)) {
     msg->audio_codecs = g_new0 (GstWFDAudioCodeclist, 1);
     if (strlen (v)) {
-      guint i = 0;
-      msg->audio_codecs->count = strlen (v) / 16;
-      msg->audio_codecs->list =
+      WFD_SKIP_SPACE (v);
+      if (strncmp (v, "none", 4)) {
+        guint i = 0;
+        msg->audio_codecs->count = strlen (v) / 16;
+        msg->audio_codecs->list =
           g_new0 (GstWFDAudioCodec, msg->audio_codecs->count);
-      for (; i < msg->audio_codecs->count; i++) {
-        WFD_SKIP_SPACE (v);
-        WFD_READ_STRING (msg->audio_codecs->list[i].audio_format);
-        WFD_SKIP_SPACE (v);
-        WFD_READ_UINT32 (msg->audio_codecs->list[i].modes);
-        WFD_SKIP_SPACE (v);
-        WFD_READ_UINT32 (msg->audio_codecs->list[i].latency);
-        WFD_SKIP_COMMA (v);
+        for (; i < msg->audio_codecs->count; i++) {
+          WFD_SKIP_SPACE (v);
+          WFD_READ_STRING (msg->audio_codecs->list[i].audio_format);
+          WFD_SKIP_SPACE (v);
+          WFD_READ_UINT32 (msg->audio_codecs->list[i].modes);
+          WFD_SKIP_SPACE (v);
+          WFD_READ_UINT32 (msg->audio_codecs->list[i].latency);
+          WFD_SKIP_COMMA (v);
+        }
+      } else {
+        msg->audio_codecs->count = 0;
+        msg->audio_codecs->list = NULL;
       }
     }
   } else if (!g_strcmp0 (attr, GST_STRING_WFD_VIDEO_FORMATS)) {
@@ -891,8 +897,8 @@ gst_wfd_message_as_text (const GstWFDMessage * msg)
   /* list of audio codecs */
   if (msg->audio_codecs) {
     g_string_append_printf (lines, GST_STRING_WFD_AUDIO_CODECS);
+    g_string_append_printf (lines, ":");
     if (msg->audio_codecs->list) {
-      g_string_append_printf (lines, ":");
       for (i = 0; i < msg->audio_codecs->count; i++) {
         g_string_append_printf (lines, " %s",
             msg->audio_codecs->list[i].audio_format);
@@ -903,6 +909,8 @@ gst_wfd_message_as_text (const GstWFDMessage * msg)
         if ((i + 1) < msg->audio_codecs->count)
           g_string_append_printf (lines, ",");
       }
+    } else {
+      g_string_append_printf (lines, " none");
     }
     g_string_append_printf (lines, "\r\n");
   }
@@ -1565,6 +1573,11 @@ gst_wfd_message_set_preferred_audio_format (GstWFDMessage * msg,
   if (!msg->audio_codecs)
     msg->audio_codecs = g_new0 (GstWFDAudioCodeclist, 1);
 
+  if (a_codec == GST_WFD_AUDIO_UNKNOWN) {
+    msg->audio_codecs->list = NULL;
+    msg->audio_codecs->count = 0;
+    return GST_WFD_OK;
+  }
   msg->audio_codecs->list = g_new0 (GstWFDAudioCodec, 1);
   msg->audio_codecs->count = 1;
   if (a_codec == GST_WFD_AUDIO_LPCM) {
index 969e26a..42a2417 100644 (file)
@@ -1481,7 +1481,7 @@ handle_wfd_response (GstRTSPClient * client, GstRTSPContext * ctx)
           gst_wfd_message_as_text (msg));
 
       /* Get the audio formats supported by WFDSink */
-      if (msg->audio_codecs) {
+      if (msg->audio_codecs && msg->audio_codecs->count > 0) {
         wfd_res =
             gst_wfd_message_get_supported_audio_format (msg, &priv->caCodec,
             &priv->cFreq, &priv->cChanels, &priv->cBitwidth, &priv->caLatency);
@@ -2217,31 +2217,33 @@ _set_wfd_message_body (GstRTSPWFDClient * client, GstWFDMessageType msg_type,
       goto error;
     }
 
-    taudiocodec =
-        wfd_get_preferred_audio_codec (priv->audio_codec, priv->caCodec);
-    priv->caCodec = taudiocodec;
+    if (priv->caCodec != GST_WFD_AUDIO_UNKNOWN) {
+      taudiocodec = wfd_get_preferred_audio_codec (priv->audio_codec, priv->caCodec);
+      priv->caCodec = taudiocodec;
+    }
     if (!_set_negotiated_audio_codec (client, priv->caCodec)) {
       GST_ERROR_OBJECT (client, "Failed to set negotiated "
           "audio codec to media factory...");
     }
 
-    if (priv->cFreq & GST_WFD_FREQ_48000)
-      taudiofreq = GST_WFD_FREQ_48000;
-    else if (priv->cFreq & GST_WFD_FREQ_44100)
-      taudiofreq = GST_WFD_FREQ_44100;
-    priv->cFreq = taudiofreq;
-
-    /* TODO-WFD: Currently only 2 channels is present */
-    if (priv->cChanels & GST_WFD_CHANNEL_8)
-      taudiochannels = GST_WFD_CHANNEL_2;
-    else if (priv->cChanels & GST_WFD_CHANNEL_6)
-      taudiochannels = GST_WFD_CHANNEL_2;
-    else if (priv->cChanels & GST_WFD_CHANNEL_4)
-      taudiochannels = GST_WFD_CHANNEL_2;
-    else if (priv->cChanels & GST_WFD_CHANNEL_2)
-      taudiochannels = GST_WFD_CHANNEL_2;
-    priv->cChanels = taudiochannels;
-
+    if (priv->caCodec != GST_WFD_AUDIO_UNKNOWN) {
+      if (priv->cFreq & GST_WFD_FREQ_48000)
+        taudiofreq = GST_WFD_FREQ_48000;
+      else if (priv->cFreq & GST_WFD_FREQ_44100)
+        taudiofreq = GST_WFD_FREQ_44100;
+      priv->cFreq = taudiofreq;
+
+      /* TODO-WFD: Currently only 2 channels is present */
+      if (priv->cChanels & GST_WFD_CHANNEL_8)
+        taudiochannels = GST_WFD_CHANNEL_2;
+      else if (priv->cChanels & GST_WFD_CHANNEL_6)
+        taudiochannels = GST_WFD_CHANNEL_2;
+      else if (priv->cChanels & GST_WFD_CHANNEL_4)
+        taudiochannels = GST_WFD_CHANNEL_2;
+      else if (priv->cChanels & GST_WFD_CHANNEL_2)
+        taudiochannels = GST_WFD_CHANNEL_2;
+      priv->cChanels = taudiochannels;
+    }
     wfd_res =
         gst_wfd_message_set_preferred_audio_format (msg, taudiocodec, taudiofreq,
         taudiochannels, priv->cBitwidth, priv->caLatency);
index 6d19dfa..127af3c 100644 (file)
@@ -465,6 +465,11 @@ _rtsp_media_factory_wfd_create_audio_capture_bin (GstRTSPMediaFactoryWFD *
 
   priv = factory->priv;
 
+  if (priv->audio_codec == GST_WFD_AUDIO_UNKNOWN) {
+    GST_INFO_OBJECT (factory, "Skip create audio source");
+    return TRUE;
+  }
+
   /* create audio src element */
   audiosrc = gst_element_factory_make ("pulsesrc", "audiosrc");
   if (!audiosrc) {
@@ -1238,32 +1243,36 @@ _rtsp_media_factory_wfd_create_srcbin (GstRTSPMediaFactoryWFD * factory)
     srcpad = NULL;
   }
 
+  GST_INFO_OBJECT (factory, "Check audio codec... %d", priv->audio_codec);
+
   /* create audio source elements & add to pipeline */
   if (!_rtsp_media_factory_wfd_create_audio_capture_bin (factory, srcbin))
     goto create_error;
 
-  /* request audio sink pad from muxer, which has elementary pid 0x1100 */
-  mux_asinkpad = gst_element_get_request_pad (mux, "sink_4352");
-  if (!mux_asinkpad) {
-    GST_ERROR_OBJECT (factory, "Failed to get sinkpad from muxer...");
-    goto create_error;
-  }
+  if (priv->audio_codec > GST_WFD_AUDIO_UNKNOWN) {
+    /* request audio sink pad from muxer, which has elementary pid 0x1100 */
+    mux_asinkpad = gst_element_get_request_pad (mux, "sink_4352");
+    if (!mux_asinkpad) {
+      GST_ERROR_OBJECT (factory, "Failed to get sinkpad from muxer...");
+      goto create_error;
+    }
 
-  /* request srcpad from audio queue */
-  srcpad = gst_element_get_static_pad (priv->audio_queue, "src");
-  if (!srcpad) {
-    GST_ERROR_OBJECT (factory, "Failed to get srcpad from audio queue...");
-    goto create_error;
-  }
+    /* request srcpad from audio queue */
+    srcpad = gst_element_get_static_pad (priv->audio_queue, "src");
+    if (!srcpad) {
+      GST_ERROR_OBJECT (factory, "Failed to get srcpad from audio queue...");
+      goto create_error;
+    }
 
-  /* link audio queue's srcpad & muxer sink pad */
-  if (gst_pad_link (srcpad, mux_asinkpad) != GST_PAD_LINK_OK) {
-    GST_ERROR_OBJECT (factory,
-        "Failed to link audio queue src pad & muxer audio sink pad...");
-    goto create_error;
+    /* link audio queue's srcpad & muxer sink pad */
+    if (gst_pad_link (srcpad, mux_asinkpad) != GST_PAD_LINK_OK) {
+      GST_ERROR_OBJECT (factory,
+          "Failed to link audio queue src pad & muxer audio sink pad...");
+      goto create_error;
+    }
+    gst_object_unref (mux_asinkpad);
+    gst_object_unref (srcpad);
   }
-  gst_object_unref (mux_asinkpad);
-  gst_object_unref (srcpad);
 
   if (priv->dump_ts)
   {
index 582ded4..ba58776 100644 (file)
@@ -126,6 +126,8 @@ void gst_rtsp_media_factory_wfd_set_negotiated_resolution (GstRTSPMediaFactory *
    guint32 width, guint32 height);
 void gst_rtsp_media_factory_wfd_set_audio_codec (GstRTSPMediaFactory *factory,
     guint audio_codec);
+void gst_rtsp_media_factory_wfd_set_video_codec (GstRTSPMediaFactory * factory,
+    guint video_codec);
 
 void gst_rtsp_media_factory_wfd_set_venc_bitrate (GstRTSPMediaFactory *factory,
     gint bitrate);
index ac6ccb6..bf13245 100644 (file)
@@ -1,7 +1,7 @@
 Name:       gst-rtsp-server
 Summary:    Multimedia Framework Library
 Version:    1.6.1
-Release:    8
+Release:    9
 Url:        http://gstreamer.freedesktop.org/
 Group:      System/Libraries
 License:    LGPL-2.0+