dashdemux/hlsdemux/adaptivedemux: Fix build warning and apply coding rule
authorGilbok Lee <gilbok.lee@samsung.com>
Tue, 12 Sep 2017 04:19:25 +0000 (13:19 +0900)
committerGilbok Lee <gilbok.lee@samsung.com>
Tue, 12 Sep 2017 11:15:11 +0000 (20:15 +0900)
Change-Id: Ic5606190134d9b62e2b82121bf1e8ac3111b123f

ext/dash/gstdashdemux.c
ext/hls/gsthlsdemux.c
ext/hls/m3u8.c
gst-libs/gst/adaptivedemux/gstadaptivedemux.c

index a2e7064..b7738b0 100644 (file)
@@ -564,8 +564,10 @@ gst_dash_demux_setup_all_streams (GstDashDemux * demux)
 
 #ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
     caps = gst_caps_make_writable (caps);
-    gst_caps_set_simple (caps,"adaptive_stream", G_TYPE_BOOLEAN, TRUE, "dash_stream", G_TYPE_BOOLEAN, TRUE, NULL);
-    GST_LOG_OBJECT(demux, "*** modified caps for dash streaming = %" GST_PTR_FORMAT, caps);
+    gst_caps_set_simple (caps, "adaptive_stream", G_TYPE_BOOLEAN, TRUE,
+        "dash_stream", G_TYPE_BOOLEAN, TRUE, NULL);
+    GST_LOG_OBJECT (demux,
+        "*** modified caps for dash streaming = %" GST_PTR_FORMAT, caps);
 #endif
 
     GST_LOG_OBJECT (demux, "Creating stream %d %" GST_PTR_FORMAT, i, caps);
@@ -579,15 +581,17 @@ 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");
+      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)));
+                    "video-variant-info", G_TYPE_POINTER, adp_set->VariantInfo,
+                    NULL)));
       }
 #endif
 
@@ -1002,19 +1006,23 @@ gst_dash_demux_stream_update_fragment_info (GstAdaptiveDemuxStream * stream)
 
   if (gst_mpd_client_get_next_fragment_timestamp (dashdemux->client,
           dashstream->index, &ts)) {
+#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
+    int entry_count = 0;
+#endif
     if (GST_ADAPTIVE_DEMUX_STREAM_NEED_HEADER (stream)) {
       gst_adaptive_demux_stream_fragment_clear (&stream->fragment);
       gst_dash_demux_stream_update_headers_info (stream);
     }
-
     gst_mpd_client_get_next_fragment (dashdemux->client, dashstream->index,
         &fragment);
 
     stream->fragment.uri = fragment.uri;
 #ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
-    int entry_count = SIDX_ENTRY_COUNT(dashstream);
-    GST_DEBUG_OBJECT(stream, "dashstream sidx entries_count=%d \n", entry_count);
-    if (isombff && entry_count > 0 && dashstream->sidx_index > 0 && dashstream->sidx_index <= entry_count) {
+    entry_count = SIDX_ENTRY_COUNT (dashstream);
+    GST_DEBUG_OBJECT (stream, "dashstream sidx entries_count=%d \n",
+        entry_count);
+    if (isombff && entry_count > 0 && dashstream->sidx_index > 0
+        && dashstream->sidx_index <= entry_count) {
 #else
     if (isombff && dashstream->sidx_index != 0) {
 #endif
@@ -1031,7 +1039,8 @@ gst_dash_demux_stream_update_fragment_info (GstAdaptiveDemuxStream * stream)
       }
     } else {
 #ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
-      GST_DEBUG_OBJECT(stream, "sidx entries_count=%d  sidx_index=%d\n", dashstream->sidx_parser.sidx.entries_count, dashstream->sidx_index);
+      GST_DEBUG_OBJECT (stream, "sidx entries_count=%d  sidx_index=%d\n",
+          dashstream->sidx_parser.sidx.entries_count, dashstream->sidx_index);
 #endif
       stream->fragment.timestamp = fragment.timestamp;
       stream->fragment.duration = fragment.duration;
@@ -1216,8 +1225,9 @@ gst_dash_demux_stream_select_bitrate (GstAdaptiveDemuxStream * stream,
 #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);
+      (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);
@@ -1244,7 +1254,6 @@ gst_dash_demux_stream_select_bitrate (GstAdaptiveDemuxStream * stream,
       GST_WARNING_OBJECT (demux, "Can not switch representation, aborting...");
     }
   }
-
 #ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
   if (ret) {
     gst_dash_demux_clear_pending_stream_data (demux, dashstream);
@@ -1254,7 +1263,7 @@ gst_dash_demux_stream_select_bitrate (GstAdaptiveDemuxStream * stream,
       dashstream->sidx_index = SIDX (dashstream)->entry_index;
     }
   }
- #else
+#else
   if (gst_mpd_client_has_isoff_ondemand_profile (demux->client)) {
 
     /* store our current position to change to the same one in a different
@@ -1357,7 +1366,7 @@ gst_dash_demux_seek (GstAdaptiveDemux * demux, GstEvent * seek)
 
     if (flags & GST_SEEK_FLAG_FLUSH) {
 #ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
-       gst_dash_demux_clear_pending_stream_data (dashdemux, dashstream);
+      gst_dash_demux_clear_pending_stream_data (dashdemux, dashstream);
 #else
       gst_isoff_sidx_parser_clear (&dashstream->sidx_parser);
       gst_isoff_sidx_parser_init (&dashstream->sidx_parser);
@@ -1623,9 +1632,9 @@ gst_dash_demux_data_received (GstAdaptiveDemux * demux,
 
   if (!gst_mpd_client_has_isoff_ondemand_profile (dashdemux->client))
 #ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
-       return gst_adaptive_demux_stream_push_buffer (stream, buffer);
+    return gst_adaptive_demux_stream_push_buffer (stream, buffer);
 #else
-       return GST_ADAPTIVE_DEMUX_CLASS (parent_class)->data_received (demux,
+    return GST_ADAPTIVE_DEMUX_CLASS (parent_class)->data_received (demux,
         stream);
 #endif
 
@@ -1669,10 +1678,9 @@ gst_dash_demux_data_received (GstAdaptiveDemux * demux,
 #endif
 
 #ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
-    if (buffer == NULL)
-    {
-       GST_ERROR_OBJECT (demux, "buffer data is NULL");
-       return GST_FLOW_OK;
+    if (buffer == NULL) {
+      GST_ERROR_OBJECT (demux, "buffer data is NULL");
+      return GST_FLOW_OK;
     }
 #endif
     if (dash_stream->sidx_parser.status != GST_ISOFF_SIDX_PARSER_FINISHED) {
@@ -1721,7 +1729,8 @@ gst_dash_demux_data_received (GstAdaptiveDemux * demux,
 #ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
     gsize available;
     while (ret == GST_FLOW_OK
-        && ((available = gst_adapter_available (dash_stream->sidx_adapter)) > 0)) {
+        && ((available =
+                gst_adapter_available (dash_stream->sidx_adapter)) > 0)) {
 #else
     while (ret == GST_FLOW_OK
         && ((available = gst_adapter_available (stream->adapter)) > 0)) {
@@ -1732,9 +1741,9 @@ gst_dash_demux_data_received (GstAdaptiveDemux * demux,
           dash_stream->sidx_base_offset +
           SIDX_CURRENT_ENTRY (dash_stream)->offset +
           SIDX_CURRENT_ENTRY (dash_stream)->size;
-       if (dash_stream->sidx_current_offset + available < sidx_end_offset){
+      if (dash_stream->sidx_current_offset + available < sidx_end_offset) {
         buffer = gst_adapter_take_buffer (dash_stream->sidx_adapter, available);
-       } else {
+      } else {
         buffer =
             gst_adapter_take_buffer (dash_stream->sidx_adapter,
             sidx_end_offset - dash_stream->sidx_current_offset);
@@ -2138,16 +2147,20 @@ gst_dash_demux_poll_clock_drift (GstDashDemux * demux)
   start = g_date_time_new_now_utc ();
   if (!value) {
     GstFragment *download;
+#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
+    GST_DEBUG_OBJECT (demux, "Fetching current time from %s",
+        urls[clock_drift->selected_url]);
+    download = gst_uri_downloader_fetch_uri (GST_ADAPTIVE_DEMUX_CAST
+        (demux)->downloader, urls[clock_drift->selected_url], NULL, NULL, NULL,
+        DEFAULT_ADAPTIVE_RETRY, DEFAULT_ADAPTIVE_TIMEOUT, TRUE, FALSE, TRUE,
+        NULL);
+#else
     gint64 range_start = 0, range_end = -1;
     GST_DEBUG_OBJECT (demux, "Fetching current time from %s",
         urls[clock_drift->selected_url]);
     if (method == GST_MPD_UTCTIMING_TYPE_HTTP_HEAD) {
       range_start = -1;
     }
-#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
-  download = gst_uri_downloader_fetch_uri (GST_ADAPTIVE_DEMUX_CAST
-        (demux)->downloader, urls[clock_drift->selected_url], NULL, NULL, NULL, DEFAULT_ADAPTIVE_RETRY,DEFAULT_ADAPTIVE_TIMEOUT,TRUE, FALSE, TRUE, NULL);
-#else
     download =
         gst_uri_downloader_fetch_uri_with_range (GST_ADAPTIVE_DEMUX_CAST
         (demux)->downloader, urls[clock_drift->selected_url], NULL, TRUE, TRUE,
index c1be60d..47bd47d 100644 (file)
@@ -469,12 +469,12 @@ gst_hls_demux_process_manifest (GstAdaptiveDemux * demux, GstBuffer * buf)
     GST_ELEMENT_ERROR (demux, STREAM, DECODE, ("Invalid playlist."), (NULL));
     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)));
+              "video-variant-info", G_TYPE_POINTER,
+              hlsdemux->client->main->variant_info, NULL)));
 #endif
 
   /* If this playlist is a variant playlist, select the first one
@@ -490,7 +490,8 @@ gst_hls_demux_process_manifest (GstAdaptiveDemux * demux, GstBuffer * buf)
     } 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);
+          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);
@@ -554,7 +555,8 @@ gst_hls_demux_start_fragment (GstAdaptiveDemux * demux,
       key_fragment =
           gst_uri_downloader_fetch_uri (demux->downloader,
           hlsdemux->current_key, hlsdemux->client->main ?
-          hlsdemux->client->main->uri : NULL, demux->user_agent, demux->cookies, DEFAULT_ADAPTIVE_RETRY,DEFAULT_ADAPTIVE_TIMEOUT,FALSE, FALSE,
+          hlsdemux->client->main->uri : NULL, demux->user_agent, demux->cookies,
+          DEFAULT_ADAPTIVE_RETRY, DEFAULT_ADAPTIVE_TIMEOUT, FALSE, FALSE,
           hlsdemux->client->current ? hlsdemux->client->current->
           allowcache : TRUE, &err);
 #else
@@ -632,7 +634,7 @@ gst_hls_demux_handle_buffer (GstAdaptiveDemux * demux,
         return GST_FLOW_NOT_NEGOTIATED;
       } else {
 #ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
-       hlsdemux->pending_typefind_buffer = buffer;
+        hlsdemux->pending_typefind_buffer = buffer;
 #else
         if (hlsdemux->pending_buffer)
           hlsdemux->pending_buffer =
@@ -704,10 +706,12 @@ gst_hls_demux_finish_fragment (GstAdaptiveDemux * demux,
         gssize unpadded_size;
 #ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
         /* Handle pkcs7 unpadding here */
-        gst_buffer_map (hlsdemux->pending_decrypted_buffer, &info, GST_MAP_READ);
+        gst_buffer_map (hlsdemux->pending_decrypted_buffer, &info,
+            GST_MAP_READ);
         unpadded_size = info.size - info.data[info.size - 1];
         gst_buffer_unmap (hlsdemux->pending_decrypted_buffer, &info);
-        gst_buffer_resize (hlsdemux->pending_decrypted_buffer, 0, unpadded_size);
+        gst_buffer_resize (hlsdemux->pending_decrypted_buffer, 0,
+            unpadded_size);
 #else
         /* Handle pkcs7 unpadding here */
         gst_buffer_map (hlsdemux->pending_buffer, &info, GST_MAP_READ);
@@ -719,8 +723,8 @@ gst_hls_demux_finish_fragment (GstAdaptiveDemux * demux,
       }
 #ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
       ret =
-          gst_hls_demux_handle_buffer (demux, stream, hlsdemux->pending_decrypted_buffer,
-          TRUE);
+          gst_hls_demux_handle_buffer (demux, stream,
+          hlsdemux->pending_decrypted_buffer, TRUE);
       hlsdemux->pending_decrypted_buffer = NULL;
 #else
       ret =
@@ -739,7 +743,7 @@ gst_hls_demux_finish_fragment (GstAdaptiveDemux * demux,
     hlsdemux->pending_buffer = NULL;
   }
 #endif
-  GST_WARNING_OBJECT (hlsdemux, "gst_hls_demux_handle_buffer return : %d",ret);
+  GST_WARNING_OBJECT (hlsdemux, "gst_hls_demux_handle_buffer return : %d", ret);
   if (ret == GST_FLOW_OK || ret == GST_FLOW_NOT_LINKED)
     return gst_adaptive_demux_stream_advance_fragment (demux, stream,
         stream->fragment.duration);
@@ -810,7 +814,6 @@ gst_hls_demux_data_received (GstAdaptiveDemux * demux,
       g_error_free (err);
       return GST_FLOW_ERROR;
     }
-
 #ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
     tmp_buffer = hlsdemux->pending_decrypted_buffer;
     hlsdemux->pending_decrypted_buffer = buffer;
@@ -820,8 +823,7 @@ gst_hls_demux_data_received (GstAdaptiveDemux * demux,
     hlsdemux->pending_buffer = buffer;
     buffer = tmp_buffer;
 #endif
-  }
-  else {
+  } else {
 #ifndef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
     buffer = gst_adapter_take_buffer (stream->adapter, available);
     if (hlsdemux->pending_buffer) {
@@ -1019,8 +1021,9 @@ gst_hls_demux_update_playlist (GstHLSDemux * demux, gboolean update,
 #ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
 /* Sometimes for Errornous Clips , when Server changes the playlist abruptly , the URI does not remain valid anymore.
    Adding one error check condition to handle the cases. */
-  if ((!demux->client->current)||(!demux->client->main)) {
-    GST_WARNING_OBJECT (demux, "Invalid m3u8 instance in playlist .. no update possible !!!");
+  if ((!demux->client->current) || (!demux->client->main)) {
+    GST_WARNING_OBJECT (demux,
+        "Invalid m3u8 instance in playlist .. no update possible !!!");
     return FALSE;
   }
 #endif
@@ -1030,8 +1033,10 @@ retry:
   main_uri = gst_m3u8_client_get_uri (demux->client);
 #ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
   download =
-      gst_uri_downloader_fetch_uri (adaptive_demux->downloader, uri, main_uri, adaptive_demux->user_agent, adaptive_demux->cookies,PLAYLIST_ADAPTIVE_RETRY,PLAYLIST_ADAPTIVE_TIMEOUT,
-      TRUE, TRUE, TRUE, err);
+      gst_uri_downloader_fetch_uri (adaptive_demux->downloader, uri, main_uri,
+      adaptive_demux->user_agent, adaptive_demux->cookies,
+      PLAYLIST_ADAPTIVE_RETRY, PLAYLIST_ADAPTIVE_TIMEOUT, TRUE, TRUE, TRUE,
+      err);
 #else
   download =
       gst_uri_downloader_fetch_uri (adaptive_demux->downloader, uri, main_uri,
@@ -1050,7 +1055,9 @@ retry:
 #ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
       download =
           gst_uri_downloader_fetch_uri (adaptive_demux->downloader,
-          main_uri, NULL, adaptive_demux->user_agent, adaptive_demux->cookies, PLAYLIST_ADAPTIVE_RETRY,PLAYLIST_ADAPTIVE_TIMEOUT,TRUE, TRUE, TRUE, &err2);
+          main_uri, NULL, adaptive_demux->user_agent, adaptive_demux->cookies,
+          PLAYLIST_ADAPTIVE_RETRY, PLAYLIST_ADAPTIVE_TIMEOUT, TRUE, TRUE, TRUE,
+          &err2);
 #else
       download =
           gst_uri_downloader_fetch_uri (adaptive_demux->downloader,
@@ -1137,12 +1144,12 @@ retry:
         "Couldn't update playlist");
     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)));
+              "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
@@ -1154,10 +1161,10 @@ retry:
 
     GST_M3U8_CLIENT_LOCK (demux->client);
     last_sequence =
-          GST_M3U8_MEDIA_FILE (g_list_last (demux->client->current->
-                    files)->data)->sequence;
+        GST_M3U8_MEDIA_FILE (g_list_last (demux->client->current->
+            files)->data)->sequence;
     first_sequence =
-          GST_M3U8_MEDIA_FILE (demux->client->current->files->data)->sequence;
+        GST_M3U8_MEDIA_FILE (demux->client->current->files->data)->sequence;
 
     previous_sequence = demux->client->sequence;
 
@@ -1166,16 +1173,18 @@ retry:
         " , last_sequence:%" G_GINT64_FORMAT, demux->client->sequence,
         first_sequence, last_sequence);
     if (demux->client->sequence >= last_sequence - 3) {
-      demux->client->sequence = MIN(MAX(MAX(first_sequence, last_sequence - 3),previous_sequence),last_sequence);
+      demux->client->sequence =
+          MIN (MAX (MAX (first_sequence, last_sequence - 3), previous_sequence),
+          last_sequence);
       /*
-      Refer 6.3.5 for draft-pantos-http-live-streaming-19.
-      As per specification , "In order to play the presentation normally, the next Media Segment to
-      load is the one with the lowest Media Sequence Number that is greater
-      than the Media Sequence Number of the last Media Segment loaded."
-      */
+         Refer 6.3.5 for draft-pantos-http-live-streaming-19.
+         As per specification , "In order to play the presentation normally, the next Media Segment to
+         load is the one with the lowest Media Sequence Number that is greater
+         than the Media Sequence Number of the last Media Segment loaded."
+       */
       GST_DEBUG_OBJECT (demux,
-          "Sequence is beyond playlist , but to maintain the playback flow , Not Moving Back if not passed Last Sequence. Loaded Sequence %" G_GINT64_FORMAT,
-          demux->client->sequence);
+          "Sequence is beyond playlist , but to maintain the playback flow , Not Moving Back if not passed Last Sequence. Loaded Sequence %"
+          G_GINT64_FORMAT, demux->client->sequence);
     }
 #else
     gint64 last_sequence, first_sequence;
@@ -1254,6 +1263,9 @@ gst_hls_demux_change_playlist (GstHLSDemux * demux, guint max_bitrate,
   gint old_bandwidth, new_bandwidth;
   GstAdaptiveDemux *adaptive_demux = GST_ADAPTIVE_DEMUX_CAST (demux);
   GstAdaptiveDemuxStream *stream;
+#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
+  GList *failover = NULL;
+#endif
 
   g_return_val_if_fail (adaptive_demux->streams != NULL, FALSE);
 
@@ -1263,7 +1275,8 @@ gst_hls_demux_change_playlist (GstHLSDemux * demux, guint max_bitrate,
 
 #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);
+      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);
@@ -1275,8 +1288,12 @@ retry_failover_protection:
   new_bandwidth = GST_M3U8 (current_variant->data)->bandwidth;
 
 #ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
-  GST_INFO_OBJECT (demux, "Previous Stream Codec = %s , Codec_Count = %d", GST_M3U8 (previous_variant->data)->codecs,GST_M3U8 (previous_variant->data)->codec_count);
-  GST_INFO_OBJECT (demux, "Current Stream Codec = %s , Codec_Count = %d", GST_M3U8 (current_variant->data)->codecs,GST_M3U8 (current_variant->data)->codec_count);
+  GST_INFO_OBJECT (demux, "Previous Stream Codec = %s , Codec_Count = %d",
+      GST_M3U8 (previous_variant->data)->codecs,
+      GST_M3U8 (previous_variant->data)->codec_count);
+  GST_INFO_OBJECT (demux, "Current Stream Codec = %s , Codec_Count = %d",
+      GST_M3U8 (current_variant->data)->codecs,
+      GST_M3U8 (current_variant->data)->codec_count);
 #endif
   /* Don't do anything else if the playlist is the same */
   if (new_bandwidth == old_bandwidth) {
@@ -1293,10 +1310,11 @@ retry_failover_protection:
       " to bitrate %dbps", old_bandwidth, max_bitrate, new_bandwidth);
   stream->discont = TRUE;
 #ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
-  if (GST_M3U8 (previous_variant->data)->codec_count > GST_M3U8 (current_variant->data)->codec_count)
-  {
-       GST_WARNING_OBJECT (demux, "Temporary patch for disabling stream switch in case New Variant has lesser streams than current variant !!");
-       goto playlist_switch_back;
+  if (GST_M3U8 (previous_variant->data)->codec_count >
+      GST_M3U8 (current_variant->data)->codec_count) {
+    GST_WARNING_OBJECT (demux,
+        "Temporary patch for disabling stream switch in case New Variant has lesser streams than current variant !!");
+    goto playlist_switch_back;
   }
 #endif
   if (gst_hls_demux_update_playlist (demux, FALSE, NULL)) {
@@ -1317,14 +1335,12 @@ retry_failover_protection:
   } else {
 #ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
 playlist_switch_back:
-    GST_INFO_OBJECT (demux, "Unable to update playlist. Switching back");
-
-    GList *failover = NULL;
+    failover = NULL;
 #else
     GList *failover = NULL;
-
-    GST_INFO_OBJECT (demux, "Unable to update playlist. Switching back");
 #endif
+    GST_INFO_OBJECT (demux, "Unable to update playlist. Switching back");
+
     GST_M3U8_CLIENT_LOCK (demux->client);
 
     failover = g_list_previous (current_variant);
index 1cfb23f..2be29dd 100644 (file)
@@ -148,18 +148,19 @@ gst_m3u8_media_file_copy (const GstM3U8MediaFile * self, gpointer user_data)
 
 #ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
 static GstM3U8VideoVariantInfo *
-gst_variant_info_copy(const GstM3U8VideoVariantInfo *self, gpointer user_data)
+gst_variant_info_copy (const GstM3U8VideoVariantInfo * self, gpointer user_data)
 {
-       GstM3U8VideoVariantInfo *var_info = NULL;
-       g_return_val_if_fail (self != NULL, NULL);
+  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;
+  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;
+  return var_info;
 }
 #endif
 
@@ -189,7 +190,7 @@ _m3u8_copy (const GstM3U8 * self, GstM3U8 * parent)
       NULL);
 #ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
   dup->variant_info =
-      g_list_copy_deep(self->variant_info, (GCopyFunc) gst_variant_info_copy,
+      g_list_copy_deep (self->variant_info, (GCopyFunc) gst_variant_info_copy,
       NULL);
 #endif
   /* private */
@@ -588,27 +589,26 @@ gst_m3u8_update (GstM3U8Client * client, GstM3U8 * self, gchar * data,
             if (!int_from_string (v, NULL, &new_list->program_id))
               GST_WARNING ("Error while reading PROGRAM-ID");
           } else if (g_str_equal (a, "CODECS")) {
-            g_free (new_list->codecs);
-            new_list->codecs = g_strdup (v);
 #ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
             gchar *temp_codec_str = NULL;
             gchar *temp_codec_ptr = NULL;
-
+#endif
+            g_free (new_list->codecs);
+            new_list->codecs = g_strdup (v);
+#ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
             temp_codec_str = g_strdup (new_list->codecs);
-            GST_DEBUG ("CODECS : %s",new_list->codecs);
+            GST_DEBUG ("CODECS : %s", new_list->codecs);
             new_list->codec_count = 1;
             temp_codec_ptr = temp_codec_str;
-            while(temp_codec_str != NULL)
-            {
+            while (temp_codec_str != NULL) {
               temp_codec_str = strchr (temp_codec_str, ',');
-              if (temp_codec_str)
-              {
+              if (temp_codec_str) {
                 new_list->codec_count++;
                 temp_codec_str = temp_codec_str + 1;
               }
             }
-            g_free(temp_codec_ptr);
-            GST_DEBUG ("CODEC COUNT : %d",new_list->codec_count);
+            g_free (temp_codec_ptr);
+            GST_DEBUG ("CODEC COUNT : %d", new_list->codec_count);
 #endif
           } else if (g_str_equal (a, "RESOLUTION")) {
             if (!int_from_string (v, &v, &new_list->width))
@@ -792,14 +792,15 @@ gst_m3u8_update (GstM3U8Client * client, GstM3U8 * self, gchar * data,
     /* update variant stream info */
     for (l = self->lists; l != NULL; l = l->next) {
       GstM3U8 *data = l->data;
-      GstM3U8VideoVariantInfo *var_info = g_new0(GstM3U8VideoVariantInfo, 1);
+      GstM3U8VideoVariantInfo *var_info = g_new0 (GstM3U8VideoVariantInfo, 1);
 
-      GST_LOG ("stream info %d, %d x %d", data->bandwidth, data->width, data->height);
+      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);
+      self->variant_info = g_list_append (self->variant_info, var_info);
     }
 #endif
   }
@@ -1385,17 +1386,20 @@ 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)
+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);
+  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);
+  GST_WARNING ("max list : %u, %d, [w]%d [h]%d", bitrate, bandwidth, width,
+      height);
 
-  current_variant = list = g_list_first(client->main->current_variant);
+  current_variant = list = g_list_first (client->main->current_variant);
 
   for (; list; list = g_list_next (list)) {
 
@@ -1411,9 +1415,10 @@ gst_m3u8_client_get_playlist_for_max_limit (GstM3U8Client * client, guint bitrat
       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_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);
 
index 2dc3d7a..0054291 100644 (file)
@@ -72,6 +72,7 @@
 #include "config.h"
 #endif
 
+#include <string.h>
 #include "gstadaptivedemux.h"
 #include "gst/gst-i18n-plugin.h"
 #include <gst/base/gstadapter.h>
@@ -355,18 +356,18 @@ gst_adaptive_demux_class_init (GstAdaptiveDemuxClass * klass)
           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_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));
+      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;
@@ -483,19 +484,25 @@ gst_adaptive_demux_check_http_header (GQuark field_id, const GValue * value,
 {
   GstAdaptiveDemux *demux = GST_ADAPTIVE_DEMUX_CAST (data);
 
-  if (value && g_ascii_strcasecmp (g_quark_to_string (field_id), "User-Agent") == 0) {
+  if (value
+      && g_ascii_strcasecmp (g_quark_to_string (field_id), "User-Agent") == 0) {
     if (demux->user_agent)
       g_free (demux->user_agent);
     demux->user_agent = g_value_dup_string (value);
-    GST_INFO_OBJECT (demux, "User-Agent : %s", (demux->user_agent) ? (demux->user_agent) : NULL);
+    GST_INFO_OBJECT (demux, "User-Agent : %s",
+        (demux->user_agent) ? (demux->user_agent) : NULL);
   }
 
-  if (value && g_ascii_strcasecmp (g_quark_to_string (field_id), "Set-Cookie") == 0) {
+  if (value
+      && g_ascii_strcasecmp (g_quark_to_string (field_id), "Set-Cookie") == 0) {
     guint i = 0;
-    gchar **cookies = (gchar **) g_malloc0 ((gst_value_array_get_size (value) + 1) * sizeof (gchar *));
+    gchar **cookies =
+        (gchar **) g_malloc0 ((gst_value_array_get_size (value) +
+            1) * sizeof (gchar *));
 
     for (i = 0; i < gst_value_array_get_size (value); i++) {
-      GST_INFO_OBJECT (demux, "Cookie : %s", g_value_get_string (gst_value_array_get_value (value, i)));
+      GST_INFO_OBJECT (demux, "Cookie : %s",
+          g_value_get_string (gst_value_array_get_value (value, i)));
       cookies[i] = g_value_dup_string (gst_value_array_get_value (value, i));
     }
     cookies[i] = NULL;
@@ -648,14 +655,14 @@ gst_adaptive_demux_sink_event (GstPad * pad, GstObject * parent,
               &req_headers, NULL);
           gst_structure_foreach (req_headers,
               gst_adaptive_demux_check_http_header, demux);
-          gst_structure_free(req_headers);
+          gst_structure_free (req_headers);
         }
         if (gst_structure_has_field (structure, "response-headers")) {
           gst_structure_get (structure, "response-headers", GST_TYPE_STRUCTURE,
               &res_headers, NULL);
           gst_structure_foreach (res_headers,
               gst_adaptive_demux_check_http_header, demux);
-          gst_structure_free(res_headers);
+          gst_structure_free (res_headers);
         }
       }
       break;
@@ -707,7 +714,6 @@ gst_adaptive_demux_reset (GstAdaptiveDemux * demux)
         (GDestroyNotify) gst_adaptive_demux_stream_free);
     demux->priv->old_streams = NULL;
   }
-
 #ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
   if (demux->dash_newest_segment) {
     g_free (demux->dash_newest_segment);
@@ -757,7 +763,7 @@ gst_adaptive_demux_handle_message (GstBin * bin, GstMessage * msg)
 #ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
           gchar *caps_str = NULL;
           GstCaps *pad_caps = NULL;
-          pad_caps     = gst_pad_get_current_caps(stream->pad);
+          pad_caps = gst_pad_get_current_caps (stream->pad);
           if (pad_caps)
             caps_str = gst_caps_to_string (pad_caps);
 #endif
@@ -773,16 +779,16 @@ gst_adaptive_demux_handle_message (GstBin * bin, GstMessage * msg)
             g_free (err->message);
             err->message = new_error;
           }
-
 #ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
-          if ((caps_str) && (strstr(caps_str,"dash_stream")) && (gst_adaptive_demux_is_live (demux))) {
+          if ((caps_str) && (strstr (caps_str, "dash_stream"))
+              && (gst_adaptive_demux_is_live (demux))) {
             if (demux->dash_error_count < MAX_DASH_DOWNLOAD_ERROR_COUNT) {
-              if (strstr(err->message,"Not Found")) {
-                char tmp_current_fragment[100] = {0,};
-                char tmp_newest_fragment[100] = {0,};
-                char tmp_intermediate_url[1000]={0,};
-                char *s1 = NULL , *s2 = NULL;
-                int index1=0, index2=0;
+              if (strstr (err->message, "Not Found")) {
+                char tmp_current_fragment[100] = { 0, };
+                char tmp_newest_fragment[100] = { 0, };
+                char tmp_intermediate_url[1000] = { 0, };
+                char *s1 = NULL, *s2 = NULL;
+                int index1 = 0, index2 = 0;
                 gboolean bRet = TRUE;
 
                 if (demux->dash_newest_segment) {
@@ -791,73 +797,83 @@ gst_adaptive_demux_handle_message (GstBin * bin, GstMessage * msg)
                 }
 
                 if (stream->fragment.uri) {
-                  s1 = strrchr(stream->fragment.uri, '/');
-                  index1 = (int)(s1 - stream->fragment.uri);
-                  index2 = (int)strlen(stream->fragment.uri);
+                  s1 = strrchr (stream->fragment.uri, '/');
+                  index1 = (int) (s1 - stream->fragment.uri);
+                  index2 = (int) strlen (stream->fragment.uri);
                   s1++;
-                  strncpy(tmp_current_fragment, s1, index2-index1-1);
-                  tmp_current_fragment[index2-index1-1]='\0';
+                  strncpy (tmp_current_fragment, s1, index2 - index1 - 1);
+                  tmp_current_fragment[index2 - index1 - 1] = '\0';
                 }
 
                 s1 = s2 = NULL;
-                s1 = strstr(err->message,"Dash-Newest-Segment");
+                s1 = strstr (err->message, "Dash-Newest-Segment");
                 if (s1) {
                   s1 = s1 + 20;
-                  s2 = strrchr(s1,',');
-                  index1 = (int)strlen(s1);
-                  index2 = (int)strlen(s2);
-                  strncpy(tmp_intermediate_url, s1, index1-index2);
-                  tmp_intermediate_url[index1-index2] = '\0';
+                  s2 = strrchr (s1, ',');
+                  index1 = (int) strlen (s1);
+                  index2 = (int) strlen (s2);
+                  strncpy (tmp_intermediate_url, s1, index1 - index2);
+                  tmp_intermediate_url[index1 - index2] = '\0';
 
-                  if (strcmp(tmp_intermediate_url,"(NULL)") != 0) {
+                  if (strcmp (tmp_intermediate_url, "(NULL)") != 0) {
                     s1 = s2 = NULL;
-                    s1 = strrchr(tmp_intermediate_url, '/');
-                    index1 = (int)(s1 - tmp_intermediate_url);
-                    index2 = (int)strlen(tmp_intermediate_url);
+                    s1 = strrchr (tmp_intermediate_url, '/');
+                    index1 = (int) (s1 - tmp_intermediate_url);
+                    index2 = (int) strlen (tmp_intermediate_url);
                     s1++;
-                    strncpy(tmp_newest_fragment, s1, index2-index1-1);
-                    tmp_newest_fragment[index2-index1-1]='\0';
+                    strncpy (tmp_newest_fragment, s1, index2 - index1 - 1);
+                    tmp_newest_fragment[index2 - index1 - 1] = '\0';
                   } else {
-                    GST_WARNING_OBJECT (demux, "Dash-Newest-Segment Not Available !!\n");
+                    GST_WARNING_OBJECT (demux,
+                        "Dash-Newest-Segment Not Available !!\n");
                   }
                 }
 
-                if (g_ascii_strcasecmp(tmp_newest_fragment, tmp_current_fragment) <= 0) {
-                  GST_DEBUG_OBJECT (demux, "newest fragment less than current fragment");
+                if (g_ascii_strcasecmp (tmp_newest_fragment,
+                        tmp_current_fragment) <= 0) {
+                  GST_DEBUG_OBJECT (demux,
+                      "newest fragment less than current fragment");
                   bRet = FALSE;
                 } else {
-                  GST_DEBUG_OBJECT (demux, "newest fragment more than current fragment");
+                  GST_DEBUG_OBJECT (demux,
+                      "newest fragment more than current fragment");
                   bRet = TRUE;
                 }
 
-                demux->dash_newest_segment = g_strdup(tmp_newest_fragment);
+                demux->dash_newest_segment = g_strdup (tmp_newest_fragment);
                 demux->dash_error_count++;
 
-                if (bRet)
-                {
-                  GST_DEBUG_OBJECT (demux, "Advancing the Fragment \n");
+                if (bRet) {
                   GstAdaptiveDemuxClass *klass;
                   GstFlowReturn ret;
+                  GST_DEBUG_OBJECT (demux, "Advancing the Fragment \n");
                   klass = GST_ADAPTIVE_DEMUX_GET_CLASS (stream->demux);
                   ret = klass->finish_fragment (stream->demux, stream);
-                  gst_adaptive_demux_stream_fragment_download_finish (stream, ret, NULL);
+                  gst_adaptive_demux_stream_fragment_download_finish (stream,
+                      ret, NULL);
                 } else {
-                  GST_DEBUG_OBJECT (demux, "retry: Not advancing the fragment \n");
-                  gst_adaptive_demux_stream_fragment_download_finish (stream, GST_FLOW_OK, NULL);
+                  GST_DEBUG_OBJECT (demux,
+                      "retry: Not advancing the fragment \n");
+                  gst_adaptive_demux_stream_fragment_download_finish (stream,
+                      GST_FLOW_OK, NULL);
                 }
               } else {
                 GST_DEBUG_OBJECT (demux, "retry");
-                gst_adaptive_demux_stream_fragment_download_finish (stream, GST_FLOW_OK, NULL);
+                gst_adaptive_demux_stream_fragment_download_finish (stream,
+                    GST_FLOW_OK, NULL);
               }
             } else {
-              GST_DEBUG_OBJECT (demux, "error count reached MAX .. posting Error and stopping the task");
-              gst_adaptive_demux_stream_fragment_download_finish (stream, GST_FLOW_EOS, err);
+              GST_DEBUG_OBJECT (demux,
+                  "error count reached MAX .. posting Error and stopping the task");
+              gst_adaptive_demux_stream_fragment_download_finish (stream,
+                  GST_FLOW_EOS, err);
             }
           } else
 #endif
           {
             /* error, but ask to retry */
-            gst_adaptive_demux_stream_fragment_download_finish (stream,GST_FLOW_CUSTOM_ERROR, err);
+            gst_adaptive_demux_stream_fragment_download_finish (stream,
+                GST_FLOW_CUSTOM_ERROR, err);
           }
 #ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
           gst_caps_unref (pad_caps);
@@ -1198,14 +1214,14 @@ gst_adaptive_demux_stream_new (GstAdaptiveDemux * demux, GstPad * pad)
   g_mutex_init (&stream->fragment_download_lock);
 
 #ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
-  factory = gst_element_get_factory(demux);
-  factory_name = GST_OBJECT_NAME(factory);
-  GST_DEBUG_OBJECT (demux,"Plugin Factory Name: %s", factory_name);
+  factory = gst_element_get_factory (GST_ELEMENT_CAST (demux));
+  factory_name = GST_OBJECT_NAME (factory);
+  GST_DEBUG_OBJECT (demux, "Plugin Factory Name: %s", factory_name);
 
-  if (!demux->is_dashstreaming && g_strrstr(factory_name, "dashdemux")){
-       demux->is_dashstreaming = TRUE;
-       g_mutex_init (&demux->UC_download_lock);
-       GST_DEBUG_OBJECT (demux,"Enabling Flag is_dashstreaming !!!");
+  if (!demux->is_dashstreaming && g_strrstr (factory_name, "dashdemux")) {
+    demux->is_dashstreaming = TRUE;
+    g_mutex_init (&demux->UC_download_lock);
+    GST_DEBUG_OBJECT (demux, "Enabling Flag is_dashstreaming !!!");
   }
 #endif
 #ifndef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
@@ -1270,7 +1286,7 @@ gst_adaptive_demux_stream_free (GstAdaptiveDemuxStream * stream)
   g_mutex_clear (&stream->fragment_download_lock);
 
 #ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
-  if (demux->is_dashstreaming){
+  if (demux->is_dashstreaming) {
     demux->is_dashstreaming = FALSE;
     g_mutex_clear (&demux->UC_download_lock);
   }
@@ -1588,30 +1604,31 @@ gst_adaptive_demux_src_query (GstPad * pad, GstObject * parent,
       GST_MANIFEST_UNLOCK (demux);
       break;
 #ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
-      case GST_QUERY_CUSTOM:{
-        /* Let decoder(which can not support DRC automatically) know the current streaming mode */
+    case GST_QUERY_CUSTOM:{
+      /* Let decoder(which can not support DRC automatically) know the current streaming mode */
 
-        const GstStructure *s;
-        s = gst_query_get_structure (query);
+      const GstStructure *s;
+      s = gst_query_get_structure (query);
 
-        if (gst_structure_has_name (s, "GstAdaptiveStreaming")) {
-          GValue value = { 0, };
-          GST_DEBUG_OBJECT (demux, "custom query to check adaptive streaming");
+      if (gst_structure_has_name (s, "GstAdaptiveStreaming")) {
+        GValue value = { 0, };
+        GST_DEBUG_OBJECT (demux, "custom query to check adaptive streaming");
 
-          g_value_init (&value, G_TYPE_BOOLEAN);
-          g_value_set_boolean (&value, TRUE);
-          gst_structure_set_value ((GstStructure *)s, "adaptive-streaming", &value);
+        g_value_init (&value, G_TYPE_BOOLEAN);
+        g_value_set_boolean (&value, TRUE);
+        gst_structure_set_value ((GstStructure *) s, "adaptive-streaming",
+            &value);
 
-          g_value_set_boolean (&value, gst_adaptive_demux_is_live (demux));
-          gst_structure_set_value ((GstStructure *)s, "is-live", &value);
+        g_value_set_boolean (&value, gst_adaptive_demux_is_live (demux));
+        gst_structure_set_value ((GstStructure *) s, "is-live", &value);
 
-          ret = TRUE;
-        } else {
-          GST_DEBUG_OBJECT (demux, "Unsupported query");
-          ret = FALSE;
-        }
-        break;
+        ret = TRUE;
+      } else {
+        GST_DEBUG_OBJECT (demux, "Unsupported query");
+        ret = FALSE;
       }
+      break;
+    }
 #endif
 
     default:
@@ -1704,6 +1721,7 @@ gst_adaptive_demux_stream_set_caps (GstAdaptiveDemuxStream * stream,
   gst_caps_replace (&stream->pending_caps, caps);
   gst_caps_unref (caps);
 }
+
 #ifdef TIZEN_FEATURE_AVOID_PAD_SWITCHING
 
 /**
@@ -1934,9 +1952,11 @@ gst_adaptive_demux_stream_push_buffer (GstAdaptiveDemuxStream * stream,
 #ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
     gst_caps_make_writable (stream->pending_caps);
     if (gst_adaptive_demux_is_live (demux)) {
-      gst_caps_set_simple (stream->pending_caps,"is_live", G_TYPE_BOOLEAN, TRUE, NULL);
+      gst_caps_set_simple (stream->pending_caps, "is_live", G_TYPE_BOOLEAN,
+          TRUE, NULL);
     } else {
-      gst_caps_set_simple (stream->pending_caps,"is_live", G_TYPE_BOOLEAN, FALSE, NULL);
+      gst_caps_set_simple (stream->pending_caps, "is_live", G_TYPE_BOOLEAN,
+          FALSE, NULL);
     }
 #endif
     GST_DEBUG_OBJECT (stream->pad, "Setting pending caps: %" GST_PTR_FORMAT,
@@ -2074,7 +2094,7 @@ _src_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
   stream->download_chunk_start_time = g_get_monotonic_time ();
 
   if (ret != GST_FLOW_OK) {
-    GST_WARNING_OBJECT (stream->pad, "data_received return = %d",ret);
+    GST_WARNING_OBJECT (stream->pad, "data_received return = %d", ret);
     if (ret < GST_FLOW_EOS) {
       GST_ELEMENT_ERROR (demux, STREAM, FAILED, (NULL),
           ("stream stopped, reason %s", gst_flow_get_name (ret)));
@@ -2129,47 +2149,54 @@ _src_event (GstPad * pad, GstObject * parent, GstEvent * event)
       GstFlowReturn ret;
 
 #ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
-      char tmp_current_fragment[100] = {0,};
-      char *s1 = NULL ;
-      int index1=0, index2=0;
+      char tmp_current_fragment[100] = { 0, };
+      char *s1 = NULL;
+      int index1 = 0, index2 = 0;
       gboolean bRet = TRUE;
       gchar *caps_str = NULL;
       GstCaps *pad_caps = NULL;
-      pad_caps = gst_pad_get_current_caps(stream->pad);
+      pad_caps = gst_pad_get_current_caps (stream->pad);
       if (pad_caps)
         caps_str = gst_caps_to_string (pad_caps);
 
-      if ((caps_str)&&(strstr(caps_str,"dash_stream")) &&
-          (gst_adaptive_demux_is_live (stream->demux))&&(stream->demux->dash_error_count > 0)) {
+      if ((caps_str) && (strstr (caps_str, "dash_stream")) &&
+          (gst_adaptive_demux_is_live (stream->demux))
+          && (stream->demux->dash_error_count > 0)) {
 
-        GST_DEBUG_OBJECT (stream->demux, "_src_event fragment comparison for Dash stream !!!\n");
+        GST_DEBUG_OBJECT (stream->demux,
+            "_src_event fragment comparison for Dash stream !!!\n");
         if (stream->fragment.uri) {
-          s1 = strrchr(stream->fragment.uri, '/');
-          index1 = (int)(s1 - stream->fragment.uri);
-          index2 = (int)strlen(stream->fragment.uri);
+          s1 = strrchr (stream->fragment.uri, '/');
+          index1 = (int) (s1 - stream->fragment.uri);
+          index2 = (int) strlen (stream->fragment.uri);
           s1++;
-          strncpy(tmp_current_fragment, s1, index2-index1-1);
-          tmp_current_fragment[index2-index1-1]='\0';
+          strncpy (tmp_current_fragment, s1, index2 - index1 - 1);
+          tmp_current_fragment[index2 - index1 - 1] = '\0';
         }
 
         if (stream->demux->dash_newest_segment) {
-          if (g_ascii_strcasecmp(stream->demux->dash_newest_segment, tmp_current_fragment) <= 0) {
-            GST_DEBUG_OBJECT (stream->demux, "newest fragment less than current fragment");
+          if (g_ascii_strcasecmp (stream->demux->dash_newest_segment,
+                  tmp_current_fragment) <= 0) {
+            GST_DEBUG_OBJECT (stream->demux,
+                "newest fragment less than current fragment");
             bRet = FALSE;
           } else {
-            GST_DEBUG_OBJECT (stream->demux, "newest fragment more than current fragment");
+            GST_DEBUG_OBJECT (stream->demux,
+                "newest fragment more than current fragment");
             bRet = TRUE;
           }
         }
       }
 
       if (bRet) {
-         klass = GST_ADAPTIVE_DEMUX_GET_CLASS (stream->demux);
-         ret = klass->finish_fragment (stream->demux, stream);
-         gst_adaptive_demux_stream_fragment_download_finish (stream, ret, NULL);
+        klass = GST_ADAPTIVE_DEMUX_GET_CLASS (stream->demux);
+        ret = klass->finish_fragment (stream->demux, stream);
+        gst_adaptive_demux_stream_fragment_download_finish (stream, ret, NULL);
       } else {
-         GST_DEBUG_OBJECT (stream->demux, "retry: Not advancing the fragment from src_event !!");
-         gst_adaptive_demux_stream_fragment_download_finish (stream, GST_FLOW_OK, NULL);
+        GST_DEBUG_OBJECT (stream->demux,
+            "retry: Not advancing the fragment from src_event !!");
+        gst_adaptive_demux_stream_fragment_download_finish (stream, GST_FLOW_OK,
+            NULL);
       }
 
       gst_caps_unref (pad_caps);
@@ -2337,7 +2364,7 @@ gst_adaptive_demux_stream_update_source (GstAdaptiveDemuxStream * stream,
       g_object_set (stream->src, "keep-alive", TRUE, NULL);
 
 #ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
-    if (demux->is_dashstreaming){
+    if (demux->is_dashstreaming) {
       g_mutex_lock (&demux->UC_download_lock);
       GST_DEBUG_OBJECT (demux, "DashDemux Case: Locking UC_download_lock !!!");
     }
@@ -2347,9 +2374,10 @@ gst_adaptive_demux_stream_update_source (GstAdaptiveDemuxStream * stream,
     if (g_object_class_find_property (gobject_class, "cookies")
         && (demux->cookies))
       g_object_set (stream->src, "cookies", demux->cookies, NULL);
-    if (demux->is_dashstreaming){
+    if (demux->is_dashstreaming) {
       g_mutex_unlock (&demux->UC_download_lock);
-      GST_DEBUG_OBJECT (demux, "DashDemux Case: Unlocking UC_download_lock !!!");
+      GST_DEBUG_OBJECT (demux,
+          "DashDemux Case: Unlocking UC_download_lock !!!");
     }
 #endif
     if (g_object_class_find_property (gobject_class, "extra-headers")) {
@@ -2713,12 +2741,12 @@ gst_adaptive_demux_stream_download_loop (GstAdaptiveDemuxStream * stream)
       gint64 wait_time =
           gst_adaptive_demux_stream_get_fragment_waiting_time (demux, stream);
       GST_MANIFEST_UNLOCK (demux);
-      if (wait_time > 0)
-      {
+      if (wait_time > 0) {
 #ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
         gint64 end_time = g_get_monotonic_time () + wait_time / GST_USECOND;
-        GST_DEBUG_OBJECT (stream->pad, "Download waiting for %" GST_TIME_FORMAT,
-            GST_TIME_ARGS (wait_time));
+        GST_DEBUG_OBJECT (stream->pad, "Download waiting for %" GST_TIME_FORMAT
+            "Download end time %" GST_TIME_FORMAT,
+            GST_TIME_ARGS (wait_time), GST_TIME_ARGS (end_time));
 #endif
         gst_adaptive_demux_stream_download_wait (stream, wait_time);
       }
@@ -2912,7 +2940,9 @@ gst_adaptive_demux_updates_loop (GstAdaptiveDemux * demux)
     GstFlowReturn ret = GST_FLOW_OK;
 
     /* Wait here until we should do the next update or we're cancelled */
-    GST_DEBUG_OBJECT (demux, "Wait for next playlist update : next_update=%" GST_TIME_FORMAT,GST_TIME_ARGS(demux->priv->next_update));
+    GST_DEBUG_OBJECT (demux,
+        "Wait for next playlist update : next_update=%" GST_TIME_FORMAT,
+        GST_TIME_ARGS (demux->priv->next_update));
 
     g_mutex_lock (&demux->priv->updates_timed_lock);
     if (demux->priv->stop_updates_task) {
@@ -3170,7 +3200,9 @@ gst_adaptive_demux_update_manifest_default (GstAdaptiveDemux * demux)
   GstFlowReturn ret;
 #ifdef TIZEN_FEATURE_ADAPTIVE_MODIFICATION
   download = gst_uri_downloader_fetch_uri (demux->downloader,
-      demux->manifest_uri, NULL, demux->user_agent, demux->cookies, PLAYLIST_ADAPTIVE_RETRY,PLAYLIST_ADAPTIVE_TIMEOUT,TRUE, TRUE, TRUE, NULL);
+      demux->manifest_uri, NULL, demux->user_agent, demux->cookies,
+      PLAYLIST_ADAPTIVE_RETRY, PLAYLIST_ADAPTIVE_TIMEOUT, TRUE, TRUE, TRUE,
+      NULL);
 #else
   download = gst_uri_downloader_fetch_uri (demux->downloader,
       demux->manifest_uri, NULL, TRUE, TRUE, TRUE, NULL);