Changeset 148840 in webkit


Ignore:
Timestamp:
Apr 21, 2013 11:36:58 AM (11 years ago)
Author:
kbalazs@webkit.org
Message:

[GStreamer] Media attribute preload="none" is not honored
https://bugs.webkit.org/show_bug.cgi?id=114357

Reviewed by Philippe Normand.

Source/WebCore:

Fix the logic that prevents live streams from being buffered to not make preload="none" ignored.

Test: http/tests/media/video-preload.html
We need a http test because the bug does not triggered with local files.

  • platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:

(WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer):

  • platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:

(MediaPlayerPrivateGStreamer):
Remove m_originalPreloadWasAutoAndWasOverridden because it is not necessary and it is causing this bug.
Currently if the tag has preload="none" attribute we set m_preload to Auto in the constructor. After that
MedaPlayer calls setPreload(None), so we set m_originalPreloadWasAutoAndWasOverridden to true and later
reset m_preload to Auto. The error prone factor here is that the m_preload member is repeated in the
private class and setPreload is also used there. This seems to be necessary because we need to be able
to ignore preloading if this is a live stream. Fortunately the original parsed value is available in the
constructor, so we can use that. This will give the correct value that we should override only in the case
of a live stream and that's it, we don't need to reset it later to Auto.
Furthermore, we should ignore setting preload to auto from js if it is a live stream. This patch also handles
this with an early return in setPreload.

LayoutTests:

  • http/tests/media/video-preload-expected.txt: Added.
  • http/tests/media/video-preload.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r148839 r148840  
     12013-04-12  Balazs Kelemen  <kbalazs@webkit.org>
     2
     3        [GStreamer] Media attribute preload="none" is not honored
     4        https://bugs.webkit.org/show_bug.cgi?id=114357
     5
     6        Reviewed by Philippe Normand.
     7
     8        * http/tests/media/video-preload-expected.txt: Added.
     9        * http/tests/media/video-preload.html: Added.
     10
    1112013-04-21  Christophe Dumez  <ch.dumez@sisa.samsung.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r148823 r148840  
     12013-04-12  Balazs Kelemen  <kbalazs@webkit.org>
     2
     3        [GStreamer] Media attribute preload="none" is not honored
     4        https://bugs.webkit.org/show_bug.cgi?id=114357
     5
     6        Reviewed by Philippe Normand.
     7
     8        Fix the logic that prevents live streams from being buffered to not make preload="none" ignored.
     9
     10        Test: http/tests/media/video-preload.html
     11        We need a http test because the bug does not triggered with local files.
     12
     13        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
     14        (WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer):
     15        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
     16        (MediaPlayerPrivateGStreamer):
     17        Remove m_originalPreloadWasAutoAndWasOverridden because it is not necessary and it is causing this bug.
     18        Currently if the tag has preload="none" attribute we set m_preload to Auto in the constructor. After that
     19        MedaPlayer calls setPreload(None), so we set m_originalPreloadWasAutoAndWasOverridden to true and later
     20        reset m_preload to Auto. The error prone factor here is that the m_preload member is repeated in the
     21        private class and setPreload is also used there. This seems to be necessary because we need to be able
     22        to ignore preloading if this is a live stream. Fortunately the original parsed value is available in the
     23        constructor, so we can use that. This will give the correct value that we should override only in the case
     24        of a live stream and that's it, we don't need to reset it later to Auto.
     25        Furthermore, we should ignore setting preload to auto from js if it is a live stream. This patch also handles
     26        this with an early return in setPreload.
     27
    1282013-04-21  Carlos Garcia Campos  <cgarcia@igalia.com>
    229
  • trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp

    r148611 r148840  
    208208    , m_maxTimeLoaded(0)
    209209    , m_bufferingPercentage(0)
    210     , m_preload(MediaPlayer::Auto)
     210    , m_preload(player->preload())
    211211    , m_delayingLoad(false)
    212212    , m_mediaDurationKnown(true)
     
    219219    , m_webkitAudioSink(0)
    220220    , m_totalBytes(-1)
    221     , m_originalPreloadWasAutoAndWasOverridden(false)
    222221    , m_preservesPitch(false)
    223222    , m_requestedState(GST_STATE_VOID_PENDING)
     
    13911390    if (previousDuration && m_mediaDuration != previousDuration)
    13921391        m_player->durationChanged();
    1393 
    1394     if (m_preload == MediaPlayer::None && m_originalPreloadWasAutoAndWasOverridden) {
    1395         m_totalBytes = -1;
    1396         if (totalBytes() && !isLiveStream()) {
    1397             setPreload(MediaPlayer::Auto);
    1398             gst_element_set_state(m_playBin.get(), GST_STATE_NULL);
    1399             gst_element_set_state(m_playBin.get(), GST_STATE_PAUSED);
    1400         }
    1401     }
    14021392}
    14031393
     
    15541544void MediaPlayerPrivateGStreamer::setPreload(MediaPlayer::Preload preload)
    15551545{
    1556     m_originalPreloadWasAutoAndWasOverridden = m_preload != preload && m_preload == MediaPlayer::Auto;
     1546    if (preload == MediaPlayer::Auto && isLiveStream())
     1547        return;
    15571548
    15581549    m_preload = preload;
  • trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h

    r147279 r148840  
    161161    mutable long m_totalBytes;
    162162    KURL m_url;
    163     bool m_originalPreloadWasAutoAndWasOverridden;
    164163    bool m_preservesPitch;
    165164    GstState m_requestedState;
Note: See TracChangeset for help on using the changeset viewer.