⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 175945 in webkit


Ignore:
Timestamp:
Nov 11, 2014, 9:32:40 AM (12 years ago)
Author:
Carlos Garcia Campos
Message:

Merge r175526 - [LEAK] [GStreamer] Removing video element will not free assigned memory
https://bugs.webkit.org/show_bug.cgi?id=46560

Reviewed by Eric Carlson.

Moved the ::extraMemoryCost() implementation to the
MediaPlayerPivateInterface base class. This default implementation
is now shared between the various MediaPlayerPrivate backends,
excepted the AVF MediaSource player which still reports no extra
memory cost.

  • platform/graphics/MediaPlayerPrivate.h:

(WebCore::MediaPlayerPrivateInterface::totalBytes): Make
totalBytes() part of the MediaPlayerPrivate interface.
(WebCore::MediaPlayerPrivateInterface::extraMemoryCost): Default
implementation.

  • platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:

(WebCore::MediaPlayerPrivateAVFoundation::extraMemoryCost): Deleted.

  • platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
  • platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
Location:
releases/WebKitGTK/webkit-2.6/Source/WebCore
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • releases/WebKitGTK/webkit-2.6/Source/WebCore/ChangeLog

    r175944 r175945  
     12014-11-03  Philippe Normand  <pnormand@igalia.com>
     2
     3        [LEAK] [GStreamer] Removing video element will not free assigned memory
     4        https://bugs.webkit.org/show_bug.cgi?id=46560
     5
     6        Reviewed by Eric Carlson.
     7
     8        Moved the ::extraMemoryCost() implementation to the
     9        MediaPlayerPivateInterface base class. This default implementation
     10        is now shared between the various MediaPlayerPrivate backends,
     11        excepted the AVF MediaSource player which still reports no extra
     12        memory cost.
     13
     14        * platform/graphics/MediaPlayerPrivate.h:
     15        (WebCore::MediaPlayerPrivateInterface::totalBytes): Make
     16        totalBytes() part of the MediaPlayerPrivate interface.
     17        (WebCore::MediaPlayerPrivateInterface::extraMemoryCost): Default
     18        implementation.
     19        * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
     20        (WebCore::MediaPlayerPrivateAVFoundation::extraMemoryCost): Deleted.
     21        * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
     22        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
     23
    1242014-11-04  Nikos Andronikos  <nikos.andronikos-webkit@cisra.canon.com.au>
    225
  • releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/graphics/MediaPlayer.cpp

    r173318 r175945  
    131131    virtual std::unique_ptr<PlatformTimeRanges> buffered() const { return PlatformTimeRanges::create(); }
    132132
    133     virtual unsigned totalBytes() const { return 0; }
     133    virtual unsigned long long totalBytes() const { return 0; }
    134134    virtual bool didLoadingProgress() const { return false; }
    135135
  • releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/graphics/MediaPlayerPrivate.h

    r173318 r175945  
    131131    virtual std::unique_ptr<PlatformTimeRanges> buffered() const = 0;
    132132
     133    virtual unsigned long long totalBytes() const { return 0; }
    133134    virtual bool didLoadingProgress() const = 0;
    134135
     
    243244    virtual String languageOfPrimaryAudioTrack() const { return emptyString(); }
    244245
    245     virtual size_t extraMemoryCost() const { return 0; }
    246    
     246    virtual size_t extraMemoryCost() const
     247    {
     248        MediaTime duration = this->durationMediaTime();
     249        if (!duration)
     250            return 0;
     251
     252        unsigned long long extra = totalBytes() * buffered()->totalDuration().toDouble() / duration.toDouble();
     253        return static_cast<unsigned>(extra);
     254    }
     255
    247256    virtual unsigned long long fileSize() const { return 0; }
    248257
  • releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp

    r173453 r175945  
    948948}
    949949
    950 size_t MediaPlayerPrivateAVFoundation::extraMemoryCost() const
    951 {
    952     MediaTime duration = this->durationMediaTime();
    953     if (!duration)
    954         return 0;
    955 
    956     unsigned long long extra = totalBytes() * buffered()->totalDuration().toDouble() / duration.toDouble();
    957     return static_cast<unsigned>(extra);
    958 }
    959 
    960950void MediaPlayerPrivateAVFoundation::clearTextTracks()
    961951{
  • releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h

    r173318 r175945  
    293293    virtual String engineDescription() const { return "AVFoundation"; }
    294294
    295     virtual size_t extraMemoryCost() const override;
    296 
    297295    virtual void trackModeChanged() override;
    298296#if ENABLE(AVF_CAPTIONS)
  • releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp

    r173318 r175945  
    212212    , m_hasVideo(false)
    213213    , m_hasAudio(false)
    214     , m_totalBytes(-1)
     214    , m_totalBytes(0)
    215215    , m_preservesPitch(false)
    216216    , m_requestedState(GST_STATE_VOID_PENDING)
     
    12291229}
    12301230
    1231 unsigned MediaPlayerPrivateGStreamer::totalBytes() const
     1231unsigned long long MediaPlayerPrivateGStreamer::totalBytes() const
    12321232{
    12331233    if (m_errorOccured)
    12341234        return 0;
    12351235
    1236     if (m_totalBytes != -1)
     1236    if (m_totalBytes)
    12371237        return m_totalBytes;
    12381238
     
    12441244    if (gst_element_query_duration(m_source.get(), fmt, &length)) {
    12451245        INFO_MEDIA_MESSAGE("totalBytes %" G_GINT64_FORMAT, length);
    1246         m_totalBytes = static_cast<unsigned>(length);
     1246        m_totalBytes = static_cast<unsigned long long>(length);
    12471247        m_isStreaming = !length;
    12481248        return m_totalBytes;
     
    12791279
    12801280    INFO_MEDIA_MESSAGE("totalBytes %" G_GINT64_FORMAT, length);
    1281     m_totalBytes = static_cast<unsigned>(length);
     1281    m_totalBytes = static_cast<unsigned long long>(length);
    12821282    m_isStreaming = !length;
    12831283    return m_totalBytes;
  • releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h

    r174638 r175945  
    9393    float maxTimeSeekable() const;
    9494    bool didLoadingProgress() const;
    95     unsigned totalBytes() const;
     95    unsigned long long totalBytes() const;
    9696    float maxTimeLoaded() const;
    9797
     
    208208    GThreadSafeMainLoopSource m_videoCapsTimerHandler;
    209209    GThreadSafeMainLoopSource m_readyTimerHandler;
    210     mutable long m_totalBytes;
     210    mutable unsigned long long m_totalBytes;
    211211    URL m_url;
    212212    bool m_preservesPitch;
  • releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h

    r173318 r175945  
    124124    MediaTime maxMediaTimeSeekable() const;
    125125    bool didLoadingProgress() const;
    126     unsigned totalBytes() const;
     126    unsigned long long totalBytes() const;
    127127   
    128128    void setVisible(bool);
  • releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm

    r173318 r175945  
    979979}
    980980
    981 unsigned MediaPlayerPrivateQTKit::totalBytes() const
     981unsigned long long MediaPlayerPrivateQTKit::totalBytes() const
    982982{
    983983    if (!metaDataAvailable())
    984984        return 0;
    985     return [[m_qtMovie.get() attributeForKey:QTMovieDataSizeAttribute] intValue];
     985    return [[m_qtMovie.get() attributeForKey:QTMovieDataSizeAttribute] longLongValue];
    986986}
    987987
Note: See TracChangeset for help on using the changeset viewer.