[GStreamer] compress property for the HTTP source element
authorphiln@webkit.org <philn@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Apr 2015 10:32:24 +0000 (10:32 +0000)
committerphiln@webkit.org <philn@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Apr 2015 10:32:24 +0000 (10:32 +0000)
https://bugs.webkit.org/show_bug.cgi?id=143518

Reviewed by Carlos Garcia Campos.

Added a compress property so the default behavior or not
requesting content encoded to the server can be overridden if
needed. This is useful for adaptive streaming playback.

* platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
(webKitWebSrcSetProperty):
(webKitWebSrcGetProperty):
(webKitWebSrcStart):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@182534 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp

index 24a124d..64a06cf 100644 (file)
@@ -1,3 +1,19 @@
+2015-04-08  Philippe Normand  <pnormand@igalia.com>
+
+        [GStreamer] compress property for the HTTP source element
+        https://bugs.webkit.org/show_bug.cgi?id=143518
+
+        Reviewed by Carlos Garcia Campos.
+
+        Added a compress property so the default behavior or not
+        requesting content encoded to the server can be overridden if
+        needed. This is useful for adaptive streaming playback.
+
+        * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
+        (webKitWebSrcSetProperty):
+        (webKitWebSrcGetProperty):
+        (webKitWebSrcStart):
+
 2015-04-08  Joonghun Park  <jh718.park@samsung.com>
 
         Remove CSS functions min() and max() which had been dropped from specification
index 4faa1ff..32e3c14 100644 (file)
@@ -112,6 +112,7 @@ struct _WebKitWebSrcPrivate {
     gchar* uri;
     bool keepAlive;
     GUniquePtr<GstStructure> extraHeaders;
+    bool compress;
 
     WebCore::MediaPlayer* player;
 
@@ -150,7 +151,8 @@ enum {
     PROP_IRADIO_TITLE,
     PROP_LOCATION,
     PROP_KEEP_ALIVE,
-    PROP_EXTRA_HEADERS
+    PROP_EXTRA_HEADERS,
+    PROP_COMPRESS
 };
 
 static GstStaticPadTemplate srcTemplate = GST_STATIC_PAD_TEMPLATE("src",
@@ -256,6 +258,10 @@ static void webkit_web_src_class_init(WebKitWebSrcClass* klass)
         g_param_spec_boxed("extra-headers", "Extra Headers", "Extra headers to append to the HTTP request",
             GST_TYPE_STRUCTURE, static_cast<GParamFlags>(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
 
+    g_object_class_install_property(oklass, PROP_COMPRESS,
+        g_param_spec_boolean("compress", "Compress", "Allow compressed content encodings",
+            FALSE, static_cast<GParamFlags>(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
+
     eklass->change_state = webKitWebSrcChangeState;
 
     g_type_class_add_private(klass, sizeof(WebKitWebSrcPrivate));
@@ -349,6 +355,9 @@ static void webKitWebSrcSetProperty(GObject* object, guint propID, const GValue*
         src->priv->extraHeaders.reset(s ? gst_structure_copy(s) : nullptr);
         break;
     }
+    case PROP_COMPRESS:
+        src->priv->compress = g_value_get_boolean(value);
+        break;
     default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propID, pspec);
         break;
@@ -383,6 +392,9 @@ static void webKitWebSrcGetProperty(GObject* object, guint propID, GValue* value
     case PROP_EXTRA_HEADERS:
         gst_value_set_structure(value, priv->extraHeaders.get());
         break;
+    case PROP_COMPRESS:
+        g_value_set_boolean(value, priv->compress);
+        break;
     default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propID, pspec);
         break;
@@ -542,13 +554,17 @@ static void webKitWebSrcStart(WebKitWebSrc* src)
         request.setHTTPReferrer(priv->player->referrer());
 
 #if USE(SOUP)
-    // Let's disable HTTP Accept-Encoding here as we don't want the received response to be
-    // encoded in any way as we need to rely on the proper size of the returned data on
+    // By default, HTTP Accept-Encoding is disabled here as we don't
+    // want the received response to be encoded in any way as we need
+    // to rely on the proper size of the returned data on
     // didReceiveResponse.
     // If Accept-Encoding is used, the server may send the data in encoded format and
     // request.expectedContentLength() will have the "wrong" size (the size of the
     // compressed data), even though the data received in didReceiveData is uncompressed.
-    request.setAcceptEncoding(false);
+    // This is however useful to enable for adaptive streaming
+    // scenarios, when the demuxer needs to download playlists.
+    if (!priv->compress)
+        request.setAcceptEncoding(false);
 #endif
 
     // Let Apple web servers know we want to access their nice movie trailers.