adaptivedemux: add streaming variant control 23/137523/2 accepted/tizen/4.0/unified/20170816.011529 accepted/tizen/4.0/unified/20170816.014749 accepted/tizen/4.0/unified/20170828.222334 accepted/tizen/unified/20170710.154318 submit/tizen/20170707.065345 submit/tizen_4.0/20170811.094300 submit/tizen_4.0/20170814.115522 submit/tizen_4.0/20170828.100005 submit/tizen_4.0_unified/20170814.115522
authorEunhae Choi <eunhae1.choi@samsung.com>
Thu, 6 Jul 2017 08:04:57 +0000 (17:04 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Thu, 6 Jul 2017 08:07:11 +0000 (17:07 +0900)
- add property to set max bandwidth/width/height limit
- add msg posting to share the current streaming variant

Change-Id: I9d58c3331a5cab6b2fc09a7b0cfdf25fb84a39be

ext/dash/gstdashdemux.c
ext/dash/gstmpdparser.c
ext/dash/gstmpdparser.h
ext/hls/gsthlsdemux.c
ext/hls/m3u8.c
ext/hls/m3u8.h
gst-libs/gst/adaptivedemux/gstadaptivedemux.c
gst-libs/gst/adaptivedemux/gstadaptivedemux.h
packaging/gst-plugins-bad.spec

index 641aa64..a2e7064 100644 (file)
@@ -579,6 +579,18 @@ gst_dash_demux_setup_all_streams (GstDashDemux * demux)
         GstContentComponentNode *cc_node = adp_set->ContentComponents->data;
         lang = cc_node->lang;
       }
+
+#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
+      if (active_stream->mimeType == GST_STREAM_VIDEO && adp_set->VariantInfo != NULL) {
+        GST_LOG_OBJECT(demux, "post msg about video active stream variant info");
+
+        gst_element_post_message (GST_ELEMENT_CAST (demux),
+            gst_message_new_element (GST_OBJECT_CAST (demux),
+                gst_structure_new (GST_ADAPTIVE_DEMUX_VARIANT_MESSAGE_NAME,
+                    "video-variant-info", G_TYPE_POINTER, adp_set->VariantInfo, NULL)));
+      }
+#endif
+
     }
 
     if (lang) {
@@ -1179,6 +1191,9 @@ gst_dash_demux_stream_select_bitrate (GstAdaptiveDemuxStream * stream,
   GstActiveStream *active_stream = NULL;
   GList *rep_list = NULL;
   gint new_index;
+#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
+  GstAdaptiveDemux *adaptive_demux = GST_ADAPTIVE_DEMUX_CAST (stream->demux);
+#endif
   GstDashDemux *demux = GST_DASH_DEMUX_CAST (stream->demux);
   GstDashDemuxStream *dashstream = (GstDashDemuxStream *) stream;
   gboolean ret = FALSE;
@@ -1198,8 +1213,15 @@ gst_dash_demux_stream_select_bitrate (GstAdaptiveDemuxStream * stream,
   GST_DEBUG_OBJECT (stream->pad,
       "Trying to change to bitrate: %" G_GUINT64_FORMAT, bitrate);
 
+#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
+  /* get representation index with current max_bandwidth */
+  new_index = gst_mpdparser_get_rep_idx_with_max_bandwidth (rep_list,
+                (adaptive_demux->max_bandwidth > DEFAULT_ADAPTIVE_VARIANT)?(adaptive_demux->max_bandwidth):(bitrate),
+                adaptive_demux->max_width, adaptive_demux->max_height);
+#else
   /* get representation index with current max_bandwidth */
   new_index = gst_mpdparser_get_rep_idx_with_max_bandwidth (rep_list, bitrate);
+#endif
 
   /* if no representation has the required bandwidth, take the lowest one */
   if (new_index == -1)
index 72084e2..ac22d93 100644 (file)
@@ -31,6 +31,9 @@
 #include "gstdash_debug.h"
 
 #define GST_CAT_DEFAULT gst_dash_demux_debug
+#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
+#define DEFAULT_ADAPTIVE_VARIANT -1
+#endif
 
 /* Property parsing */
 static gboolean gst_mpdparser_get_xml_prop_string (xmlNode * a_node,
@@ -102,8 +105,13 @@ static void gst_mpdparser_parse_segment_list_node (GstSegmentListNode **
 static void
 gst_mpdparser_parse_representation_base_type (GstRepresentationBaseType **
     pointer, xmlNode * a_node);
+#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
+static void gst_mpdparser_parse_representation_node (GList ** list,
+    GList ** info, xmlNode * a_node, GstAdaptationSetNode * parent);
+#else
 static void gst_mpdparser_parse_representation_node (GList ** list,
     xmlNode * a_node, GstAdaptationSetNode * parent);
+#endif
 static void gst_mpdparser_parse_adaptation_set_node (GList ** list,
     xmlNode * a_node, GstPeriodNode * parent);
 static void gst_mpdparser_parse_subset_node (GList ** list, xmlNode * a_node);
@@ -227,6 +235,15 @@ struct GstMpdParserUtcTimingMethod
   GstMPDUTCTimingType method;
 };
 
+#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
+struct GstVideoVariantInfo
+{
+  gint bandwidth;
+  gint width;
+  gint height;
+};
+#endif
+
 static const struct GstMpdParserUtcTimingMethod
     gst_mpdparser_utc_timing_methods[] = {
   {"urn:mpeg:dash:utc:ntp:2014", GST_MPD_UTCTIMING_TYPE_NTP},
@@ -1560,12 +1577,22 @@ gst_mpdparser_parse_representation_base_type (GstRepresentationBaseType **
   }
 }
 
+#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
+static void
+gst_mpdparser_parse_representation_node (GList ** list, GList ** info, xmlNode * a_node,
+    GstAdaptationSetNode * parent)
+#else
 static void
 gst_mpdparser_parse_representation_node (GList ** list, xmlNode * a_node,
     GstAdaptationSetNode * parent)
+#endif
 {
   xmlNode *cur_node;
   GstRepresentationNode *new_representation;
+#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
+  struct GstVideoVariantInfo *variant_info;
+  gchar *mime = NULL;
+#endif
 
   new_representation = g_slice_new0 (GstRepresentationNode);
   *list = g_list_append (*list, new_representation);
@@ -1585,6 +1612,23 @@ gst_mpdparser_parse_representation_node (GList ** list, xmlNode * a_node,
   gst_mpdparser_parse_representation_base_type
       (&new_representation->RepresentationBase, a_node);
 
+#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
+  mime = new_representation->RepresentationBase->mimeType;
+  if (strncmp_ext(mime, "video") == 0) {
+    variant_info = g_new0(struct GstVideoVariantInfo, 1);
+
+    GST_LOG ("video variant info %d, %d x %d", new_representation->bandwidth,
+                          new_representation->RepresentationBase->width,
+                          new_representation->RepresentationBase->height);
+
+    variant_info->bandwidth = new_representation->bandwidth;
+    variant_info->width = new_representation->RepresentationBase->width;
+    variant_info->height = new_representation->RepresentationBase->height;
+
+    *info = g_list_append(*info, variant_info);
+  }
+#endif
+
   /* explore children nodes */
   for (cur_node = a_node->children; cur_node; cur_node = cur_node->next) {
     if (cur_node->type == XML_ELEMENT_NODE) {
@@ -1711,8 +1755,13 @@ gst_mpdparser_parse_adaptation_set_node (GList ** list, xmlNode * a_node,
   for (cur_node = a_node->children; cur_node; cur_node = cur_node->next) {
     if (cur_node->type == XML_ELEMENT_NODE) {
       if (xmlStrcmp (cur_node->name, (xmlChar *) "Representation") == 0) {
+#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
+        gst_mpdparser_parse_representation_node (&new_adap_set->Representations,
+            &new_adap_set->VariantInfo, cur_node, new_adap_set);
+#else
         gst_mpdparser_parse_representation_node (&new_adap_set->Representations,
             cur_node, new_adap_set);
+#endif
       }
     }
   }
@@ -2161,6 +2210,53 @@ gst_mpdparser_get_rep_idx_with_min_bandwidth (GList * Representations)
   return lowest ? g_list_position (Representations, lowest) : -1;
 }
 
+#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
+gint
+gst_mpdparser_get_rep_idx_with_max_bandwidth (GList * Representations,
+    gint max_bandwidth, gint max_video_width, gint max_video_height)
+{
+  GList *list = NULL, *best = NULL, *min_rep = NULL;
+  GstRepresentationNode *representation;
+  gint best_bandwidth = 0, min_bandwidth = 0;
+
+  GST_DEBUG ("[b]%d [w]%d [h]%d", max_bandwidth, max_video_width, max_video_height);
+
+  if (Representations == NULL)
+    return -1;
+
+  for (list = g_list_first (Representations); list; list = g_list_next (list)) {
+    representation = (GstRepresentationNode *) list->data;
+    if (!representation)
+      continue;
+
+    if (max_video_width > DEFAULT_ADAPTIVE_VARIANT
+        && representation->RepresentationBase->width > max_video_width)
+      continue;
+
+    if (max_video_height > DEFAULT_ADAPTIVE_VARIANT
+        && representation->RepresentationBase->height > max_video_height)
+      continue;
+
+    if (representation->bandwidth <= max_bandwidth &&
+        representation->bandwidth > best_bandwidth) {
+      best = list;
+      best_bandwidth = representation->bandwidth;
+    } else {
+      if ((!min_rep) || (min_bandwidth == 0) ||
+          (min_bandwidth >= representation->bandwidth)) {
+        min_rep = list;
+        min_bandwidth = representation->bandwidth;
+      }
+    }
+  }
+
+  if (!best)
+    best = min_rep;
+
+  return best ? g_list_position (Representations, best) : -1;
+}
+
+#else
 gint
 gst_mpdparser_get_rep_idx_with_max_bandwidth (GList * Representations,
     gint max_bandwidth)
@@ -2188,6 +2284,7 @@ gst_mpdparser_get_rep_idx_with_max_bandwidth (GList * Representations,
 
   return best ? g_list_position (Representations, best) : -1;
 }
+#endif
 
 static GstSegmentListNode *
 gst_mpd_client_fetch_external_segment_list (GstMpdClient * client,
@@ -2533,6 +2630,10 @@ gst_mpdparser_free_adaptation_set_node (GstAdaptationSetNode *
         (GDestroyNotify) gst_mpdparser_free_representation_node);
     g_list_free_full (adaptation_set_node->ContentComponents,
         (GDestroyNotify) gst_mpdparser_free_content_component_node);
+#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
+    g_list_free_full (adaptation_set_node->VariantInfo,
+        (GDestroyNotify) g_free);
+#endif
     if (adaptation_set_node->xlink_href)
       xmlFree (adaptation_set_node->xlink_href);
     g_slice_free (GstAdaptationSetNode, adaptation_set_node);
index d82a983..722621f 100644 (file)
@@ -337,7 +337,10 @@ struct _GstAdaptationSetNode
   GList *Representations;
   /* list of ContentComponent nodes */
   GList *ContentComponents;
-
+#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
+  /* stream variant information */
+  GList *VariantInfo;
+#endif
   gchar *xlink_href;
   GstXLinkActuate actuate;
 };
@@ -564,7 +567,12 @@ gboolean gst_mpd_client_has_next_period (GstMpdClient *client);
 gboolean gst_mpd_client_has_previous_period (GstMpdClient * client);
 
 /* Representation selection */
+#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
+gint gst_mpdparser_get_rep_idx_with_max_bandwidth (GList *Representations, gint max_bandwidth,
+                                                    gint max_video_width, gint max_video_height);
+#else
 gint gst_mpdparser_get_rep_idx_with_max_bandwidth (GList *Representations, gint max_bandwidth);
+#endif
 gint gst_mpdparser_get_rep_idx_with_min_bandwidth (GList * Representations);
 
 /* URL management */
index a36bf73..d088873 100644 (file)
@@ -470,6 +470,13 @@ gst_hls_demux_process_manifest (GstAdaptiveDemux * demux, GstBuffer * buf)
     return FALSE;
   }
 
+#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
+  gst_element_post_message (GST_ELEMENT_CAST (hlsdemux),
+      gst_message_new_element (GST_OBJECT_CAST (hlsdemux),
+          gst_structure_new (GST_ADAPTIVE_DEMUX_VARIANT_MESSAGE_NAME,
+              "video-variant-info", G_TYPE_POINTER, hlsdemux->client->main->variant_info, NULL)));
+#endif
+
   /* If this playlist is a variant playlist, select the first one
    * and update it */
   if (gst_m3u8_client_has_variant_playlist (hlsdemux->client)) {
@@ -481,9 +488,13 @@ gst_hls_demux_process_manifest (GstAdaptiveDemux * demux, GstBuffer * buf)
       child = hlsdemux->client->main->current_variant->data;
       GST_M3U8_CLIENT_UNLOCK (hlsdemux->client);
     } else {
+#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
+      GList *tmp = gst_m3u8_client_get_playlist_for_max_limit (hlsdemux->client,
+          demux->connection_speed, demux->max_bandwidth, demux->max_width, demux->max_height);
+#else
       GList *tmp = gst_m3u8_client_get_playlist_for_bitrate (hlsdemux->client,
           demux->connection_speed);
-
+#endif
       child = GST_M3U8 (tmp->data);
     }
 
@@ -1128,6 +1139,13 @@ retry:
     return FALSE;
   }
 
+#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
+  gst_element_post_message (GST_ELEMENT_CAST (demux),
+      gst_message_new_element (GST_OBJECT_CAST (demux),
+          gst_structure_new (GST_ADAPTIVE_DEMUX_VARIANT_MESSAGE_NAME,
+              "video-variant-info", G_TYPE_POINTER, demux->client->main->variant_info, NULL)));
+#endif
+
   /* If it's a live source, do not let the sequence number go beyond
    * three fragments before the end of the list */
   if (update == FALSE && demux->client->current &&
@@ -1243,9 +1261,14 @@ gst_hls_demux_change_playlist (GstHLSDemux * demux, guint max_bitrate,
   stream = adaptive_demux->streams->data;
 
   previous_variant = demux->client->main->current_variant;
+
+#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
+  current_variant = gst_m3u8_client_get_playlist_for_max_limit (demux->client,
+      max_bitrate, adaptive_demux->max_bandwidth, adaptive_demux->max_width, adaptive_demux->max_height);
+#else
   current_variant = gst_m3u8_client_get_playlist_for_bitrate (demux->client,
       max_bitrate);
-
+#endif
   GST_M3U8_CLIENT_LOCK (demux->client);
 
 retry_failover_protection:
index 7037b78..1f2c724 100644 (file)
@@ -29,6 +29,9 @@
 #include "m3u8.h"
 
 #define GST_CAT_DEFAULT fragmented_debug
+#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
+#define DEFAULT_ADAPTIVE_VARIANT -1
+#endif
 
 #if !GLIB_CHECK_VERSION (2, 33, 4)
 #define g_list_copy_deep gst_g_list_copy_deep
@@ -93,6 +96,9 @@ gst_m3u8_free (GstM3U8 * self)
   g_free (self->name);
   g_free (self->codecs);
 
+#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
+  g_list_free_full (self->variant_info, g_free);
+#endif
   g_list_foreach (self->files, (GFunc) gst_m3u8_media_file_free, NULL);
   g_list_free (self->files);
 
@@ -140,6 +146,23 @@ gst_m3u8_media_file_copy (const GstM3U8MediaFile * self, gpointer user_data)
       self->duration, self->sequence);
 }
 
+#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
+static GstM3U8VideoVariantInfo *
+gst_variant_info_copy(const GstM3U8VideoVariantInfo *self, gpointer user_data)
+{
+       GstM3U8VideoVariantInfo *var_info = NULL;
+       g_return_val_if_fail (self != NULL, NULL);
+
+       var_info = g_new0(GstM3U8VideoVariantInfo, 1);
+       if (!var_info) return NULL;
+       var_info->bandwidth = self->bandwidth;
+       var_info->width = self->width;
+       var_info->height = self->height;
+
+       return var_info;
+}
+#endif
+
 static GstM3U8 *
 _m3u8_copy (const GstM3U8 * self, GstM3U8 * parent)
 {
@@ -164,7 +187,11 @@ _m3u8_copy (const GstM3U8 * self, GstM3U8 * parent)
   dup->files =
       g_list_copy_deep (self->files, (GCopyFunc) gst_m3u8_media_file_copy,
       NULL);
-
+#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
+  dup->variant_info =
+      g_list_copy_deep(self->variant_info, (GCopyFunc) gst_variant_info_copy,
+      NULL);
+#endif
   /* private */
   dup->last_data = g_strdup (self->last_data);
   dup->lists = g_list_copy_deep (self->lists, (GCopyFunc) _m3u8_copy, dup);
@@ -735,7 +762,9 @@ gst_m3u8_update (GstM3U8Client * client, GstM3U8 * self, gchar * data,
   if (self->lists) {
     gchar *top_variant_uri = NULL;
     gboolean iframe = FALSE;
-
+#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
+    GList *l;
+#endif
     if (!self->current_variant) {
       top_variant_uri = GST_M3U8 (self->lists->data)->uri;
     } else {
@@ -758,6 +787,21 @@ gst_m3u8_update (GstM3U8Client * client, GstM3U8 * self, gchar * data,
     else
       self->current_variant = g_list_find_custom (self->lists, top_variant_uri,
           (GCompareFunc) _m3u8_compare_uri);
+
+#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
+    /* update variant stream info */
+    for (l = self->current_variant; l != NULL; l = l->next) {
+      GstM3U8 *data = l->data;
+      GstM3U8VideoVariantInfo *var_info = g_new0(GstM3U8VideoVariantInfo, 1);
+
+      GST_LOG ("stream info %d, %d x %d", data->bandwidth, data->width, data->height);
+      var_info->bandwidth = data->bandwidth;
+      var_info->width = data->width;
+      var_info->height = data->height;
+
+      self->variant_info = g_list_append(self->variant_info, var_info);
+    }
+#endif
   }
   /* calculate the start and end times of this media playlist. */
   if (self->files) {
@@ -1338,6 +1382,46 @@ gst_m3u8_client_is_live (GstM3U8Client * client)
   return ret;
 }
 
+#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
+
+GList *
+gst_m3u8_client_get_playlist_for_max_limit (GstM3U8Client * client, guint bitrate, gint bandwidth, gint width, gint height)
+{
+  GList *list, *current_variant;
+//  guint max_bandwidth = (bandwidth < 0)?(bitrate):((guint)bandwidth);
+  guint max_bandwidth = (bandwidth > DEFAULT_ADAPTIVE_VARIANT)?(bandwidth):(bitrate);
+
+  GST_M3U8_CLIENT_LOCK (client);
+
+  GST_WARNING("max list : %u, %d, [w]%d [h]%d", bitrate, bandwidth, width, height);
+
+  current_variant = list = g_list_first(client->main->current_variant);
+
+  for (; list; list = g_list_next (list)) {
+
+    if (height > DEFAULT_ADAPTIVE_VARIANT
+        && GST_M3U8 (list->data)->height > height)
+      continue;
+
+    if (width > DEFAULT_ADAPTIVE_VARIANT
+        && GST_M3U8 (list->data)->width > width)
+      continue;
+
+    if (GST_M3U8 (list->data)->bandwidth <= max_bandwidth)
+      current_variant = list;
+  }
+
+  GST_WARNING("selected variant %d %d %d", GST_M3U8 (current_variant->data)->bandwidth,
+                                    GST_M3U8 (current_variant->data)->width,
+                                    GST_M3U8 (current_variant->data)->height);
+
+  GST_M3U8_CLIENT_UNLOCK (client);
+
+  return current_variant;
+}
+
+#else
+
 GList *
 gst_m3u8_client_get_playlist_for_bitrate (GstM3U8Client * client, guint bitrate)
 {
@@ -1364,6 +1448,7 @@ gst_m3u8_client_get_playlist_for_bitrate (GstM3U8Client * client, guint bitrate)
 
   return current_variant;
 }
+#endif
 
 gchar *
 uri_join (const gchar * uri1, const gchar * uri2)
index 9f1e4aa..8e6474c 100644 (file)
@@ -48,6 +48,15 @@ typedef struct _GstM3U8Client GstM3U8Client;
    value is three fragments */
 #define GST_M3U8_LIVE_MIN_FRAGMENT_DISTANCE 3
 
+#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
+typedef struct
+{
+  gint bandwidth;
+  gint width;
+  gint height;
+} GstM3U8VideoVariantInfo;
+#endif
+
 struct _GstM3U8
 {
   gchar *uri;                   /* actually downloaded URI */
@@ -66,6 +75,7 @@ struct _GstM3U8
   gchar *codecs;
 #ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
   gint codec_count;
+  GList *variant_info;           /* stream variant info */
 #endif
   gint width;
   gint height;
@@ -128,8 +138,13 @@ gchar *gst_m3u8_client_get_current_uri(GstM3U8Client * client);
 gboolean gst_m3u8_client_has_main(GstM3U8Client * client);
 gboolean gst_m3u8_client_has_variant_playlist(GstM3U8Client * client);
 gboolean gst_m3u8_client_is_live(GstM3U8Client * client);
+#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
+GList * gst_m3u8_client_get_playlist_for_max_limit (GstM3U8Client * client,
+    guint bitrate, gint bandwidth, gint width, gint height);
+#else
 GList * gst_m3u8_client_get_playlist_for_bitrate (GstM3U8Client * client,
     guint bitrate);
+#endif
 
 guint64 gst_m3u8_client_get_current_fragment_duration (GstM3U8Client * client);
 
index 2adff9c..2dc3d7a 100644 (file)
@@ -97,6 +97,11 @@ enum
   PROP_LOOKBACK_FRAGMENTS,
   PROP_CONNECTION_SPEED,
   PROP_BITRATE_LIMIT,
+#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
+  PROP_MAX_BANDWIDTH,
+  PROP_MAX_WIDTH,
+  PROP_MAX_HEIGHT,
+#endif
   PROP_LAST
 };
 
@@ -249,6 +254,17 @@ gst_adaptive_demux_set_property (GObject * object, guint prop_id,
     case PROP_BITRATE_LIMIT:
       demux->bitrate_limit = g_value_get_float (value);
       break;
+#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
+    case PROP_MAX_BANDWIDTH:
+      demux->max_bandwidth = g_value_get_int (value);
+      break;
+    case PROP_MAX_WIDTH:
+      demux->max_width = g_value_get_int (value);
+      break;
+    case PROP_MAX_HEIGHT:
+      demux->max_height = g_value_get_int (value);
+      break;
+#endif
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -271,6 +287,17 @@ gst_adaptive_demux_get_property (GObject * object, guint prop_id,
     case PROP_BITRATE_LIMIT:
       g_value_set_float (value, demux->bitrate_limit);
       break;
+#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
+    case PROP_MAX_BANDWIDTH:
+      g_value_set_int (value, demux->max_bandwidth);
+      break;
+    case PROP_MAX_WIDTH:
+      g_value_set_int (value, demux->max_width);
+      break;
+    case PROP_MAX_HEIGHT:
+      g_value_set_int (value, demux->max_height);
+      break;
+#endif
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -319,6 +346,29 @@ gst_adaptive_demux_class_init (GstAdaptiveDemuxClass * klass)
           0, 1, DEFAULT_BITRATE_LIMIT,
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
+#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
+  g_object_class_install_property (gobject_class, PROP_MAX_BANDWIDTH,
+      g_param_spec_int ("max-bandwidth",
+          "Max Bandwidth limit",
+          "Limit of the available bandwidth to use when switching to alternates. (-1 = no limit)",
+          -1, G_MAXINT, DEFAULT_ADAPTIVE_VARIANT,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  g_object_class_install_property (gobject_class, PROP_MAX_WIDTH,
+    g_param_spec_int ("max-video-width",
+        "Max video width limit",
+        "Limit of the available video width to use when switching to alternates. (-1 = no limit)",
+        -1, G_MAXINT, DEFAULT_ADAPTIVE_VARIANT,
+        G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+  g_object_class_install_property (gobject_class, PROP_MAX_HEIGHT,
+    g_param_spec_int ("max-video-height",
+        "Max video height limit",
+        "Limit of the available video height to use when switching to alternates. (-1 = no limit)",
+        -1, G_MAXINT, DEFAULT_ADAPTIVE_VARIANT,
+        G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+#endif
+
   gstelement_class->change_state = gst_adaptive_demux_change_state;
 
   gstbin_class->handle_message = gst_adaptive_demux_handle_message;
@@ -377,6 +427,9 @@ gst_adaptive_demux_init (GstAdaptiveDemux * demux,
   demux->is_dashstreaming = FALSE;
   demux->dash_error_count = 0;
   demux->dash_newest_segment = NULL;
+  demux->max_bandwidth = DEFAULT_ADAPTIVE_VARIANT;
+  demux->max_width = DEFAULT_ADAPTIVE_VARIANT;
+  demux->max_height = DEFAULT_ADAPTIVE_VARIANT;
 #endif
 
   gst_element_add_pad (GST_ELEMENT (demux), demux->sinkpad);
index 0ebb759..ea17ff8 100644 (file)
@@ -71,6 +71,9 @@ G_BEGIN_DECLS
  * Since: 1.6
  */
 #define GST_ADAPTIVE_DEMUX_STATISTICS_MESSAGE_NAME "adaptive-streaming-statistics"
+#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
+#define GST_ADAPTIVE_DEMUX_VARIANT_MESSAGE_NAME "adaptive-streaming-variant"
+#endif
 
 #define GST_MANIFEST_GET_LOCK(d) (&(GST_ADAPTIVE_DEMUX_CAST(d)->manifest_lock))
 #define GST_MANIFEST_LOCK(d) (g_mutex_lock (GST_MANIFEST_GET_LOCK (d)))
@@ -90,6 +93,7 @@ G_BEGIN_DECLS
 #define DEFAULT_ADAPTIVE_TIMEOUT -1
 #define PLAYLIST_ADAPTIVE_RETRY 3
 #define PLAYLIST_ADAPTIVE_TIMEOUT 2
+#define DEFAULT_ADAPTIVE_VARIANT -1
 #endif
 
 typedef struct _GstAdaptiveDemuxStreamFragment GstAdaptiveDemuxStreamFragment;
@@ -235,6 +239,9 @@ struct _GstAdaptiveDemux
 #ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
   guint dash_error_count;
   gchar *dash_newest_segment;
+  gint max_bandwidth;
+  gint max_width;
+  gint max_height;
 #endif
 };
 
index 799ba63..d3ff5c6 100644 (file)
@@ -4,7 +4,7 @@
 
 Name:           gst-plugins-bad
 Version:        1.6.1
-Release:        14
+Release:        15
 Summary:        GStreamer Streaming-Media Framework Plug-Ins
 License:        LGPL-2.0+
 Group:          Multimedia/Framework