Bug 134969

Summary: [GStreamer] Cannot play Vimeo video
Product: WebKit Reporter: Sergio Villar Senin <svillar>
Component: MediaAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: buildbot, calvaris, eric.carlson, luis, pnormand, rniwa
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
URL: http://vimeo.com/98746172
Bug Depends on:    
Bug Blocks: 136887    
Attachments:
Description Flags
Patch
buildbot: commit-queue-
Archive of layout-test-results from webkit-ews-12 for mac-mountainlion-wk2
none
Archive of layout-test-results from webkit-ews-01 for mac-mountainlion
none
Patch
buildbot: commit-queue-
Archive of layout-test-results from webkit-ews-03 for mac-mountainlion
none
Archive of layout-test-results from webkit-ews-10 for mac-mountainlion-wk2
none
Patch svillar: review+

Description Sergio Villar Senin 2014-07-16 03:16:05 PDT
Whenever I try to play the video linked above I get an error. This is the debug output

0:00:12.304651881 30021 0x7f2b000d7190 FIXME                default gstutils.c:3648:gst_pad_create_stream_id_printf_valist:<appsrc2:src> Creating random stream-id, consider implementing a deterministic way of creating a stream-id
0:00:12.304730046 30021 0x7f2b000d7190 DEBUG           webkitwebsrc ../../Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:692:webKitWebSrcNeedDataCb:<webkitwebsrc0> Need more data: 4096
0:00:12.305375752 30021      0x210a610 DEBUG           webkitwebsrc ../../Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:516:webKitWebSrcStart:<webkitwebsrc0> Started request
0:00:12.641892931 30021      0x210a610 DEBUG           webkitwebsrc ../../Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:808:handleResponseReceived:<webkitwebsrc0> Received response: 403
0:00:12.641949835 30021      0x210a610 WARN            webkitwebsrc ../../Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:815:handleResponseReceived:<webkitwebsrc0> error: Received 403 HTTP error code
0:00:12.642019106 30021      0x210a610 WARN           uridownloader gsturidownloader.c:199:gst_uri_downloader_bus_handler:<uridownloader0> Received error: webkitwebsrc0 from Received 403 HTTP error code, the download will be cancelled
0:00:12.642083455 30021 0x7f2b000d7190 DEBUG           webkitwebsrc ../../Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:692:webKitWebSrcNeedDataCb:<webkitwebsrc0> Need more data: 4096
0:00:12.642345687 30021      0x210a610 DEBUG           webkitwebsrc ../../Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:441:webKitWebSrcStop:<webkitwebsrc0> Stopped request
0:00:12.642487238 30021 0x7f2b000d6cf0 DEBUG           webkitwebsrc ../../Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:553:webKitWebSrcChangeState:<webkitwebsrc0> PAUSED->READY
0:00:12.642559220 30021 0x7f2b000d6cf0 ERROR               hlsdemux gsthlsdemux.c:991:gst_hls_demux_cache_fragments:<hlsdemux0> Could not fetch the child playlist http://av72.hls.vimeocdn.com/i/,03451/754/267647832,65636/827/267647821,.mp4.csmil/index_0_av.m3u8
0:00:12.642581772 30021 0x7f2b000d6cf0 WARN                hlsdemux gsthlsdemux.c:782:gst_hls_demux_stream_loop:<hlsdemux0> error: Could not cache the first fragments
0:00:12.642613043 30021      0x210a610 DEBUG           webkitwebsrc ../../Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:441:webKitWebSrcStop:<webkitwebsrc0> Stopped request
0:00:12.642710541 30021      0x210a610 DEBUG      webkitmediaplayer ../../Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:918:handleMessage: Message error received from element hlsdemux0
0:00:12.642747511 30021      0x210a610 ERROR      webkitmediaplayer ../../Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:926:handleMessage: Error 3: Could not cache the first fragments (url=http://av72.hls.vimeocdn.com/i/,03451/754/267647832,65636/827/267647821,.mp4.csmil/master.m3u8?primaryToken=1405508444_b6f3be17a201c3295bba3b80ea8b9d1a)
Comment 1 Sergio Villar Senin 2014-07-16 03:18:16 PDT
Philn mentioned on IRC that as we claim to be safari, the server returns an HLS stream that was not very well supported on gst 1.2.X.

I'm going to try with 1.3.91 to check if the problem is fixed, as it seems HLS support got a lot of love during the 1.3 cycle.

In any case maybe we'd need an UA quirk for vimeo and gst < 1.4
Comment 2 Luis de Bethencourt 2014-07-16 12:37:03 PDT
Sergio,

If you want I can look into this. Unless you are already on it :)
Comment 3 Sergio Villar Senin 2014-07-17 08:14:19 PDT
(In reply to comment #2)
> Sergio,
> 
> If you want I can look into this. Unless you are already on it :)

Sure, go ahead I don't have much time right now.
Comment 4 Luis de Bethencourt 2014-07-17 09:08:18 PDT
Cool! Will let you know what I discover.
Comment 5 Luis de Bethencourt 2014-08-11 11:33:08 PDT
I can play the video in that webpage by doing:
gst-launch-1.0 playbin http://pdl.vimeocdn.com/65636/827/267647821.mp4?token2=1407785825_a385b7572bd2379bc2c8f1e458bd36bb&aksessionid=e8439d7ee4ae0e0a

With both git master branch of GStreamer (1.5.0) and an old stable release 1.2.4.

Something is going wrong, I will continue investigating where it could happen.
Comment 6 Luis de Bethencourt 2014-08-12 11:40:17 PDT
Philippe proposed I comment out the registration of http src element [1] to make it fallback to souphttpsrc and see if the problem is in that code. I did this but the video still doesn't work.

Now reading the logs in detail and following the code flow.


[1] MediaPlayerPrivateGStreamer.cpp: initializeGStreamerAndRegisterWebKitElements()
Comment 7 Philippe Normand 2014-09-10 10:35:25 PDT
I've been debugging this a bit today...

So the HLS main playlist is correctly requested and received by our httpsrc element but then hlsdemux, creating a new webkithttpsrc element and trying to fetch the first sub-playlist fails and the http server at Vimeo returns a 403 error.

Now comparing with a wireshark dump of Safari loading the same video, it looks like the cookies set by the server when it returned the main playlist are passed along subsequent playlist/fragment loading...

The issue seems to be that our httpsrc element doesn't set cookies correctly in the resources to be loaded after the main HLS playlist,
Comment 8 Luis de Bethencourt 2014-09-12 02:50:59 PDT
Thanks Philippe!

That is a great find. I will be getting back to being in front of the keyboard next week and I can work on having the httpsrc set the cookies correctly.
Comment 9 Philippe Normand 2014-09-12 02:56:02 PDT
The patch is quite simple, I have it working here locally :)
But I'm blocked on the layout test now, it fails because the cached resource loader seems to remove the Cookie header from the HTTP request, I think I'm close to have it working though.
Comment 10 Luis de Bethencourt 2014-09-12 03:08:29 PDT
Cool! Let me know how it goes. Will ping you next week.
Comment 11 Philippe Normand 2014-09-17 09:26:40 PDT
Created attachment 238255 [details]
Patch
Comment 12 Philippe Normand 2014-09-17 09:29:15 PDT
Eric, would you like to review this patch?
Comment 13 Build Bot 2014-09-17 10:28:38 PDT
Comment on attachment 238255 [details]
Patch

Attachment 238255 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.appspot.com/results/6737284317577216

New failing tests:
http/tests/media/hls/video-cookie.html
Comment 14 Build Bot 2014-09-17 10:28:41 PDT
Created attachment 238256 [details]
Archive of layout-test-results from webkit-ews-12 for mac-mountainlion-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: webkit-ews-12  Port: mac-mountainlion-wk2  Platform: Mac OS X 10.8.5
Comment 15 Build Bot 2014-09-17 10:59:12 PDT
Comment on attachment 238255 [details]
Patch

Attachment 238255 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.appspot.com/results/5730290043453440

New failing tests:
http/tests/media/hls/video-cookie.html
Comment 16 Build Bot 2014-09-17 10:59:17 PDT
Created attachment 238257 [details]
Archive of layout-test-results from webkit-ews-01 for mac-mountainlion

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: webkit-ews-01  Port: mac-mountainlion  Platform: Mac OS X 10.8.5
Comment 17 Philippe Normand 2014-09-17 23:58:31 PDT
Created attachment 238290 [details]
Patch

Hoping the Mac EWS will like this one better.
Comment 18 Build Bot 2014-09-18 01:39:50 PDT
Comment on attachment 238290 [details]
Patch

Attachment 238290 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.appspot.com/results/6263283136856064

New failing tests:
http/tests/media/hls/video-cookie.html
Comment 19 Build Bot 2014-09-18 01:39:53 PDT
Created attachment 238297 [details]
Archive of layout-test-results from webkit-ews-03 for mac-mountainlion

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: webkit-ews-03  Port: mac-mountainlion  Platform: Mac OS X 10.8.5
Comment 20 Philippe Normand 2014-09-18 01:50:46 PDT
Comment on attachment 238290 [details]
Patch

Ok I'll debug this on Mac and update the patch.
Comment 21 Build Bot 2014-09-18 03:08:28 PDT
Comment on attachment 238290 [details]
Patch

Attachment 238290 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.appspot.com/results/6718309152063488

New failing tests:
http/tests/media/hls/video-cookie.html
Comment 22 Build Bot 2014-09-18 03:08:37 PDT
Created attachment 238302 [details]
Archive of layout-test-results from webkit-ews-10 for mac-mountainlion-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: webkit-ews-10  Port: mac-mountainlion-wk2  Platform: Mac OS X 10.8.5
Comment 23 Philippe Normand 2014-09-18 08:42:04 PDT
(In reply to comment #22)
> Created an attachment (id=238302) [details]
> Archive of layout-test-results from webkit-ews-10 for mac-mountainlion-wk2
> 
> The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
> Bot: webkit-ews-10  Port: mac-mountainlion-wk2  Platform: Mac OS X 10.8.5

I don't understand what's going on, the player fetches the main playlist but the sub-playlist-with-cookie.php is not fetched at all.

Would you have an idea on what's going on Eric?
Comment 24 Philippe Normand 2014-09-18 23:21:42 PDT
Created attachment 238350 [details]
Patch

Flagged the test in mac TestExpectations.
Comment 25 Sergio Villar Senin 2014-09-22 01:00:54 PDT
Comment on attachment 238350 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=238350&action=review

The patch looks good.

> LayoutTests/platform/mac/TestExpectations:1391
> +webkit.org/b/134969 http/tests/media/hls/video-cookie.html [ Failure ]

I think it'd be better to open a new bug to track this failure explaining the problems to fetch subplaylists.
Comment 26 Philippe Normand 2014-09-22 01:16:00 PDT
Committed r173809: <http://trac.webkit.org/changeset/173809>
Comment 27 Luis de Bethencourt 2014-09-22 06:28:55 PDT
Very cool Philippe  :)