[GStreamer] playbin uri getter is invalid
authorphiln@webkit.org <philn@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Apr 2013 06:59:28 +0000 (06:59 +0000)
committerphiln@webkit.org <philn@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Apr 2013 06:59:28 +0000 (06:59 +0000)
https://bugs.webkit.org/show_bug.cgi?id=113884

Reviewed by Martin Robinson.

Source/WebCore:

When loading a new media location use the url stored as a member
variable instead of the one stored as a playbin property. The uri
property semantic changed in playbin since 0.10.36+. One should
now use current-uri but to avoid ifdefs depending on GStreamer
version we simply use the url already known as member variable.

Test: http/tests/media/video-redirect.html

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:

LayoutTests:

New test for Quicktime reference movie redirect
support.

* http/tests/media/resources/redirect-to-counting-captioned.mov: Added.
* http/tests/media/video-redirect-expected.txt: Added.
* http/tests/media/video-redirect.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/http/tests/media/resources/redirect-to-counting-captioned.mov [new file with mode: 0644]
LayoutTests/http/tests/media/video-redirect-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/media/video-redirect.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp

index 87ed828..0145788 100644 (file)
@@ -1,3 +1,17 @@
+2013-04-09  Philippe Normand  <pnormand@igalia.com>
+
+        [GStreamer] playbin uri getter is invalid
+        https://bugs.webkit.org/show_bug.cgi?id=113884
+
+        Reviewed by Martin Robinson.
+
+        New test for Quicktime reference movie redirect
+        support.
+
+        * http/tests/media/resources/redirect-to-counting-captioned.mov: Added.
+        * http/tests/media/video-redirect-expected.txt: Added.
+        * http/tests/media/video-redirect.html: Added.
+
 2013-04-09  Geoffrey Garen  <ggaren@apple.com>
 
         [JSC] Script run from an isolated world should bypass a page's CSP
diff --git a/LayoutTests/http/tests/media/resources/redirect-to-counting-captioned.mov b/LayoutTests/http/tests/media/resources/redirect-to-counting-captioned.mov
new file mode 100644 (file)
index 0000000..5fe21ae
Binary files /dev/null and b/LayoutTests/http/tests/media/resources/redirect-to-counting-captioned.mov differ
diff --git a/LayoutTests/http/tests/media/video-redirect-expected.txt b/LayoutTests/http/tests/media/video-redirect-expected.txt
new file mode 100644 (file)
index 0000000..545500c
--- /dev/null
@@ -0,0 +1,3 @@
+EVENT(canplay)
+END OF TEST
+
diff --git a/LayoutTests/http/tests/media/video-redirect.html b/LayoutTests/http/tests/media/video-redirect.html
new file mode 100644 (file)
index 0000000..8ab1431
--- /dev/null
@@ -0,0 +1,17 @@
+<html>
+<head>
+</head>
+<body onload="startTest()">
+<video id="video" src="http://127.0.0.1:8000/media/resources/redirect-to-counting-captioned.mov"
+/>
+<script src=../../media-resources/video-test.js></script>
+<script>
+    function startTest() {
+        waitForEventAndFail('error');
+        waitForEventAndEnd('canplay');
+        video.load();
+    }
+</script>
+Tests that the media player will load the url redirected from reftest.mov.<br/>
+</body>
+</html>
index 7cb94e4..8ba2e46 100644 (file)
@@ -1,3 +1,20 @@
+2013-04-09  Philippe Normand  <pnormand@igalia.com>
+
+        [GStreamer] playbin uri getter is invalid
+        https://bugs.webkit.org/show_bug.cgi?id=113884
+
+        Reviewed by Martin Robinson.
+
+        When loading a new media location use the url stored as a member
+        variable instead of the one stored as a playbin property. The uri
+        property semantic changed in playbin since 0.10.36+. One should
+        now use current-uri but to avoid ifdefs depending on GStreamer
+        version we simply use the url already known as member variable.
+
+        Test: http/tests/media/video-redirect.html
+
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+
 2013-04-09  Geoffrey Garen  <ggaren@apple.com>
 
         [JSC] Script run from an isolated world should bypass a page's CSP
index 9d39ad4..f7ca1a3 100644 (file)
@@ -1287,21 +1287,10 @@ bool MediaPlayerPrivateGStreamer::loadNextLocation()
         // Found a candidate. new-location is not always an absolute url
         // though. We need to take the base of the current url and
         // append the value of new-location to it.
+        KURL baseUrl = gst_uri_is_valid(newLocation) ? KURL() : m_url;
+        KURL newUrl = KURL(baseUrl, newLocation);
 
-        gchar* currentLocation = 0;
-        g_object_get(m_playBin.get(), "uri", &currentLocation, NULL);
-
-        KURL currentUrl(KURL(), currentLocation);
-        g_free(currentLocation);
-
-        KURL newUrl;
-
-        if (gst_uri_is_valid(newLocation))
-            newUrl = KURL(KURL(), newLocation);
-        else
-            newUrl = KURL(KURL(), currentUrl.baseAsString() + newLocation);
-
-        RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::create(currentUrl);
+        RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::create(m_url);
         if (securityOrigin->canRequest(newUrl)) {
             LOG_MEDIA_MESSAGE("New media url: %s", newUrl.string().utf8().data());
 
@@ -1320,10 +1309,12 @@ bool MediaPlayerPrivateGStreamer::loadNextLocation()
             if (state <= GST_STATE_READY) {
                 // Set the new uri and start playing.
                 g_object_set(m_playBin.get(), "uri", newUrl.string().utf8().data(), NULL);
+                m_url = newUrl;
                 gst_element_set_state(m_playBin.get(), GST_STATE_PLAYING);
                 return true;
             }
-        }
+        } else
+            LOG_MEDIA_MESSAGE("Not allowed to load new media location: %s", newUrl.string().utf8().data());
     }
     m_mediaLocationCurrentIndex--;
     return false;