Title: [175945] releases/WebKitGTK/webkit-2.6/Source/WebCore
Revision
175945
Author
[email protected]
Date
2014-11-11 09:32:40 -0800 (Tue, 11 Nov 2014)

Log 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:

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/ChangeLog (175944 => 175945)


--- releases/WebKitGTK/webkit-2.6/Source/WebCore/ChangeLog	2014-11-11 17:32:09 UTC (rev 175944)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/ChangeLog	2014-11-11 17:32:40 UTC (rev 175945)
@@ -1,3 +1,26 @@
+2014-11-03  Philippe Normand  <[email protected]>
+
+        [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:
+
 2014-11-04  Nikos Andronikos  <[email protected]>
 
         Fix animation of orient attribute on marker element

Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/graphics/MediaPlayer.cpp (175944 => 175945)


--- releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/graphics/MediaPlayer.cpp	2014-11-11 17:32:09 UTC (rev 175944)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/graphics/MediaPlayer.cpp	2014-11-11 17:32:40 UTC (rev 175945)
@@ -130,7 +130,7 @@
     virtual double minTimeSeekable() const { return 0; }
     virtual std::unique_ptr<PlatformTimeRanges> buffered() const { return PlatformTimeRanges::create(); }
 
-    virtual unsigned totalBytes() const { return 0; }
+    virtual unsigned long long totalBytes() const { return 0; }
     virtual bool didLoadingProgress() const { return false; }
 
     virtual void setSize(const IntSize&) { }

Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/graphics/MediaPlayerPrivate.h (175944 => 175945)


--- releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/graphics/MediaPlayerPrivate.h	2014-11-11 17:32:09 UTC (rev 175944)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/graphics/MediaPlayerPrivate.h	2014-11-11 17:32:40 UTC (rev 175945)
@@ -130,6 +130,7 @@
     virtual MediaTime minMediaTimeSeekable() const { return MediaTime::createWithDouble(minTimeSeekable()); }
     virtual std::unique_ptr<PlatformTimeRanges> buffered() const = 0;
 
+    virtual unsigned long long totalBytes() const { return 0; }
     virtual bool didLoadingProgress() const = 0;
 
     virtual void setSize(const IntSize&) = 0;
@@ -242,8 +243,16 @@
 
     virtual String languageOfPrimaryAudioTrack() const { return emptyString(); }
 
-    virtual size_t extraMemoryCost() const { return 0; }
-    
+    virtual size_t extraMemoryCost() const
+    {
+        MediaTime duration = this->durationMediaTime();
+        if (!duration)
+            return 0;
+
+        unsigned long long extra = totalBytes() * buffered()->totalDuration().toDouble() / duration.toDouble();
+        return static_cast<unsigned>(extra);
+    }
+
     virtual unsigned long long fileSize() const { return 0; }
 
 #if ENABLE(MEDIA_SOURCE)

Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp (175944 => 175945)


--- releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp	2014-11-11 17:32:09 UTC (rev 175944)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp	2014-11-11 17:32:40 UTC (rev 175945)
@@ -947,16 +947,6 @@
     scheduleMainThreadNotification(Notification::InbandTracksNeedConfiguration);
 }
 
-size_t MediaPlayerPrivateAVFoundation::extraMemoryCost() const
-{
-    MediaTime duration = this->durationMediaTime();
-    if (!duration)
-        return 0;
-
-    unsigned long long extra = totalBytes() * buffered()->totalDuration().toDouble() / duration.toDouble();
-    return static_cast<unsigned>(extra);
-}
-
 void MediaPlayerPrivateAVFoundation::clearTextTracks()
 {
     for (unsigned i = 0; i < m_textTracks.size(); ++i) {

Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h (175944 => 175945)


--- releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h	2014-11-11 17:32:09 UTC (rev 175944)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h	2014-11-11 17:32:40 UTC (rev 175945)
@@ -292,8 +292,6 @@
 
     virtual String engineDescription() const { return "AVFoundation"; }
 
-    virtual size_t extraMemoryCost() const override;
-
     virtual void trackModeChanged() override;
 #if ENABLE(AVF_CAPTIONS)
     virtual void notifyTrackModeChanged() { }

Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp (175944 => 175945)


--- releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2014-11-11 17:32:09 UTC (rev 175944)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2014-11-11 17:32:40 UTC (rev 175945)
@@ -211,7 +211,7 @@
     , m_volumeAndMuteInitialized(false)
     , m_hasVideo(false)
     , m_hasAudio(false)
-    , m_totalBytes(-1)
+    , m_totalBytes(0)
     , m_preservesPitch(false)
     , m_requestedState(GST_STATE_VOID_PENDING)
     , m_missingPlugins(false)
@@ -1228,12 +1228,12 @@
     return didLoadingProgress;
 }
 
-unsigned MediaPlayerPrivateGStreamer::totalBytes() const
+unsigned long long MediaPlayerPrivateGStreamer::totalBytes() const
 {
     if (m_errorOccured)
         return 0;
 
-    if (m_totalBytes != -1)
+    if (m_totalBytes)
         return m_totalBytes;
 
     if (!m_source)
@@ -1243,7 +1243,7 @@
     gint64 length = 0;
     if (gst_element_query_duration(m_source.get(), fmt, &length)) {
         INFO_MEDIA_MESSAGE("totalBytes %" G_GINT64_FORMAT, length);
-        m_totalBytes = static_cast<unsigned>(length);
+        m_totalBytes = static_cast<unsigned long long>(length);
         m_isStreaming = !length;
         return m_totalBytes;
     }
@@ -1278,7 +1278,7 @@
     gst_iterator_free(iter);
 
     INFO_MEDIA_MESSAGE("totalBytes %" G_GINT64_FORMAT, length);
-    m_totalBytes = static_cast<unsigned>(length);
+    m_totalBytes = static_cast<unsigned long long>(length);
     m_isStreaming = !length;
     return m_totalBytes;
 }

Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h (175944 => 175945)


--- releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h	2014-11-11 17:32:09 UTC (rev 175944)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h	2014-11-11 17:32:40 UTC (rev 175945)
@@ -92,7 +92,7 @@
     std::unique_ptr<PlatformTimeRanges> buffered() const;
     float maxTimeSeekable() const;
     bool didLoadingProgress() const;
-    unsigned totalBytes() const;
+    unsigned long long totalBytes() const;
     float maxTimeLoaded() const;
 
     void loadStateChanged();
@@ -207,7 +207,7 @@
     GThreadSafeMainLoopSource m_videoTimerHandler;
     GThreadSafeMainLoopSource m_videoCapsTimerHandler;
     GThreadSafeMainLoopSource m_readyTimerHandler;
-    mutable long m_totalBytes;
+    mutable unsigned long long m_totalBytes;
     URL m_url;
     bool m_preservesPitch;
     GstState m_requestedState;

Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h (175944 => 175945)


--- releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h	2014-11-11 17:32:09 UTC (rev 175944)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h	2014-11-11 17:32:40 UTC (rev 175945)
@@ -123,7 +123,7 @@
     std::unique_ptr<PlatformTimeRanges> buffered() const;
     MediaTime maxMediaTimeSeekable() const;
     bool didLoadingProgress() const;
-    unsigned totalBytes() const;
+    unsigned long long totalBytes() const;
     
     void setVisible(bool);
     void setSize(const IntSize&);

Modified: releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm (175944 => 175945)


--- releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm	2014-11-11 17:32:09 UTC (rev 175944)
+++ releases/WebKitGTK/webkit-2.6/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm	2014-11-11 17:32:40 UTC (rev 175945)
@@ -978,11 +978,11 @@
     return didLoadingProgress;
 }
 
-unsigned MediaPlayerPrivateQTKit::totalBytes() const
+unsigned long long MediaPlayerPrivateQTKit::totalBytes() const
 {
     if (!metaDataAvailable())
         return 0;
-    return [[m_qtMovie.get() attributeForKey:QTMovieDataSizeAttribute] intValue];
+    return [[m_qtMovie.get() attributeForKey:QTMovieDataSizeAttribute] longLongValue];
 }
 
 void MediaPlayerPrivateQTKit::cancelLoad()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to