Changeset 228945 in webkit


Ignore:
Timestamp:
Feb 23, 2018 2:06:46 AM (6 years ago)
Author:
Philippe Normand
Message:

[GStreamer] HTTP totalBytes query returns 0 after seeking (sometimes)
https://bugs.webkit.org/show_bug.cgi?id=183002

Reviewed by Xabier Rodriguez-Calvar.

  • platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:

(webkit_web_src_init): Initialize member variables. Also no need
to set the appsrc size at that point.
(webKitWebSrcStop): There is no need to reset the size when
seeking. Size should in most cases represent the Content-Length
response attribute, even when seeking.
(webKitWebSrcStart): No need to reset the size attribute.
(webKitWebSrcQueryWithParent): Let appsrc handle DURATION queries.
(CachedResourceStreamingClient::responseReceived): Emit duration notification one time only.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r228944 r228945  
     12018-02-23  Philippe Normand  <pnormand@igalia.com>
     2
     3        [GStreamer] HTTP totalBytes query returns 0 after seeking (sometimes)
     4        https://bugs.webkit.org/show_bug.cgi?id=183002
     5
     6        Reviewed by Xabier Rodriguez-Calvar.
     7
     8        * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
     9        (webkit_web_src_init): Initialize member variables. Also no need
     10        to set the appsrc size at that point.
     11        (webKitWebSrcStop): There is no need to reset the size when
     12        seeking. Size should in most cases represent the Content-Length
     13        response attribute, even when seeking.
     14        (webKitWebSrcStart): No need to reset the size attribute.
     15        (webKitWebSrcQueryWithParent): Let appsrc handle DURATION queries.
     16        (CachedResourceStreamingClient::responseReceived): Emit duration notification one time only.
     17
    1182018-02-23  Philippe Normand  <pnormand@igalia.com>
    219
  • trunk/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp

    r228944 r228945  
    8484
    8585    guint64 offset;
     86    bool haveSize;
    8687    guint64 size;
    8788    gboolean seekable;
     
    205206    priv->notifier = MainThreadNotifier<MainThreadSourceNotification>::create();
    206207
     208    priv->haveSize = FALSE;
     209    priv->size = 0;
     210
    207211    priv->appsrc = GST_APP_SRC(gst_element_factory_make("appsrc", nullptr));
    208212    if (!priv->appsrc) {
     
    247251
    248252    gst_app_src_set_caps(priv->appsrc, nullptr);
    249     gst_app_src_set_size(priv->appsrc, -1);
    250253}
    251254
     
    361364
    362365    if (!wasSeeking) {
    363         priv->size = 0;
    364366        priv->requestedOffset = 0;
    365367        priv->player = nullptr;
     
    446448    request.setAllowCookies(true);
    447449    request.setFirstPartyForCookies(url);
    448 
    449     priv->size = 0;
    450450
    451451    request.setHTTPReferrer(priv->player->referrer());
     
    564564
    565565    switch (GST_QUERY_TYPE(query)) {
    566     case GST_QUERY_DURATION: {
    567         GstFormat format;
    568 
    569         gst_query_parse_duration(query, &format, nullptr);
    570 
    571         GST_LOG_OBJECT(src, "duration query in format %s, current size: %lu", gst_format_get_name(format), priv->size);
    572         if (format == GST_FORMAT_BYTES && priv->size > 0) {
    573             gst_query_set_duration(query, format, priv->size);
    574             result = TRUE;
    575         }
    576         break;
    577     }
    578566    case GST_QUERY_URI: {
    579567        gst_query_set_uri(query, priv->originalURI.data());
     
    793781        length += priv->requestedOffset;
    794782
    795     priv->size = length >= 0 ? length : 0;
    796783    priv->seekable = length > 0 && g_ascii_strcasecmp("none", response.httpHeaderField(HTTPHeaderName::AcceptRanges).utf8().data());
    797784
    798     GST_DEBUG_OBJECT(src, "Size: %" G_GINT64_FORMAT ", seekable: %s", priv->size, priv->seekable ? "yes" : "no");
     785    GST_DEBUG_OBJECT(src, "Size: %lld, seekable: %s", length, priv->seekable ? "yes" : "no");
    799786    // notify size/duration
    800     if (length > 0)
    801         gst_app_src_set_size(priv->appsrc, length);
    802     else {
     787    if (length > 0) {
     788        if (!priv->haveSize || (static_cast<long long>(priv->size) != length)) {
     789            priv->haveSize = TRUE;
     790            priv->size = length;
     791            gst_app_src_set_size(priv->appsrc, length);
     792        }
     793    } else {
    803794        gst_app_src_set_size(priv->appsrc, -1);
    804795        if (!priv->seekable)
Note: See TracChangeset for help on using the changeset viewer.