Add video codec negotiation 04/123504/1 accepted/tizen/unified/20170411.164413 submit/tizen/20170411.063046
authorSeokHoon Lee <andy.shlee@samsung.com>
Thu, 6 Apr 2017 02:20:25 +0000 (11:20 +0900)
committerSeokHoon Lee <andy.shlee@samsung.com>
Thu, 6 Apr 2017 02:20:48 +0000 (11:20 +0900)
- Add video codec negotiation for audio only session

Signed-off-by: SeokHoon Lee <andy.shlee@samsung.com>
Change-Id: I31f106ff96c20234374bb1763c76f518a7abc4e0

gst/rtsp-server/rtsp-client-wfd.c
packaging/gst-rtsp-server.spec

index 7d3a475..776bef8 100644 (file)
@@ -609,6 +609,21 @@ wfd_get_preferred_audio_codec (guint8 srcAudioCodec, guint sinkAudioCodec)
   return codec;
 }
 
+static guint
+wfd_get_preferred_video_codec (guint8 srcVideoCodec, guint sinkVideoCodec)
+{
+  int i = 0;
+  guint codec = 0;
+  for (i = 0; i < 8; i++) {
+    if (((sinkVideoCodec << i) & 0x80)
+        && ((srcVideoCodec << i) & 0x80)) {
+      codec = (0x01 << (7 - i));
+      break;
+    }
+  }
+  return codec;
+}
+
 static guint64
 wfd_get_preferred_resolution (guint64 srcResolution,
     guint64 sinkResolution,
@@ -2167,6 +2182,7 @@ _set_wfd_message_body (GstRTSPWFDClient * client, GstWFDMessageType msg_type,
     GstWFDAudioChannels taudiochannels = GST_WFD_CHANNEL_UNKNOWN;
 
     /* Parameters for the preffered video formats */
+    GstWFDVideoCodecs tvideocodec = GST_WFD_VIDEO_UNKNOWN;
     GstWFDVideoCEAResolution tcCEAResolution = GST_WFD_CEA_UNKNOWN;
     GstWFDVideoVESAResolution tcVESAResolution = GST_WFD_VESA_UNKNOWN;
     GstWFDVideoHHResolution tcHHResolution = GST_WFD_HH_UNKNOWN;
@@ -2254,8 +2270,11 @@ _set_wfd_message_body (GstRTSPWFDClient * client, GstWFDMessageType msg_type,
     }
 
     /* Set the preffered video formats */
-    GST_INFO_OBJECT (priv, "Set the video formats. source codec %d, sink codec %d", priv->video_codec, priv->cvCodec);
-    /* TODO : need to negotiate video codec between source and sink */
+    tvideocodec = wfd_get_preferred_video_codec (priv->video_codec, priv->cvCodec);
+    GST_INFO_OBJECT (priv, "Set the video formats. source codec %d, sink codec %d, Negotiated code %d",
+                        priv->video_codec, priv->cvCodec, tvideocodec);
+    priv->cvCodec = tvideocodec;
+
     if (priv->cvCodec != GST_WFD_VIDEO_UNKNOWN) {
       priv->cvCodec = GST_WFD_VIDEO_H264;
       priv->cProfile = tcProfile = GST_WFD_H264_BASE_PROFILE;
index f21da9b..858f5bf 100644 (file)
@@ -1,7 +1,7 @@
 Name:       gst-rtsp-server
 Summary:    Multimedia Framework Library
 Version:    1.6.1
-Release:    12
+Release:    13
 Url:        http://gstreamer.freedesktop.org/
 Group:      System/Libraries
 License:    LGPL-2.0+