Title: [122187] trunk/Source/WebCore
Revision
122187
Author
[email protected]
Date
2012-07-09 19:38:21 -0700 (Mon, 09 Jul 2012)

Log Message

[GStreamer] cache video dimensions
https://bugs.webkit.org/show_bug.cgi?id=90733

Reviewed by Martin Robinson.

Invalidate the cached video dimensions whenever the video-sink sink pad caps
change and let ::naturalSize() lazily recalculate them.

* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::naturalSize):
(WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVideo):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
(MediaPlayerPrivateGStreamer):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (122186 => 122187)


--- trunk/Source/WebCore/ChangeLog	2012-07-10 02:29:49 UTC (rev 122186)
+++ trunk/Source/WebCore/ChangeLog	2012-07-10 02:38:21 UTC (rev 122187)
@@ -1,3 +1,19 @@
+2012-07-07  Philippe Normand  <[email protected]>
+
+        [GStreamer] cache video dimensions
+        https://bugs.webkit.org/show_bug.cgi?id=90733
+
+        Reviewed by Martin Robinson.
+
+        Invalidate the cached video dimensions whenever the video-sink sink pad caps
+        change and let ::naturalSize() lazily recalculate them.
+
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+        (WebCore::MediaPlayerPrivateGStreamer::naturalSize):
+        (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVideo):
+        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
+        (MediaPlayerPrivateGStreamer):
+
 2012-07-09  Eric Penner  <[email protected]>
 
         [chromium] Merge updates and idle updates into one pass

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp (122186 => 122187)


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2012-07-10 02:29:49 UTC (rev 122186)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp	2012-07-10 02:38:21 UTC (rev 122187)
@@ -495,6 +495,9 @@
     if (!hasVideo())
         return IntSize();
 
+    if (!m_videoSize.isEmpty())
+        return m_videoSize;
+
     GstCaps* caps = webkitGstGetPadCaps(m_videoSinkPad.get());
     if (!caps)
         return IntSize();
@@ -542,7 +545,8 @@
     }
 
     LOG_VERBOSE(Media, "Natural size: %" G_GUINT64_FORMAT "x%" G_GUINT64_FORMAT, width, height);
-    return IntSize(static_cast<int>(width), static_cast<int>(height));
+    m_videoSize = IntSize(static_cast<int>(width), static_cast<int>(height));
+    return m_videoSize;
 }
 
 void MediaPlayerPrivateGStreamer::videoChanged()
@@ -561,6 +565,9 @@
         g_object_get(m_playBin, "n-video", &videoTracks, NULL);
 
     m_hasVideo = videoTracks > 0;
+
+    m_videoSize = IntSize();
+
     m_player->mediaPlayerClient()->mediaPlayerEngineUpdated(m_player);
 }
 

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h (122186 => 122187)


--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h	2012-07-10 02:29:49 UTC (rev 122186)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h	2012-07-10 02:38:21 UTC (rev 122187)
@@ -194,6 +194,7 @@
             guint m_videoTimerHandler;
             GRefPtr<GstElement> m_webkitAudioSink;
             GRefPtr<GstPad> m_videoSinkPad;
+            mutable IntSize m_videoSize;
     };
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to