<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[175370] trunk/Source/WebCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/175370">175370</a></dd>
<dt>Author</dt> <dd>philn@webkit.org</dd>
<dt>Date</dt> <dd>2014-10-30 01:53:39 -0700 (Thu, 30 Oct 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>[GStreamer] Video resolution changes trigger a crash in the TextureMapper
https://bugs.webkit.org/show_bug.cgi?id=137065
Reviewed by Gustavo Noronha Silva.
Switch to GstSample for buffer+caps communication between the
video sink and the player. Using a single object type for this
avoid issues where the caps might not correctly describe the
buffer contents anymore, for example when the video resolution is
changed.
* platform/graphics/gstreamer/ImageGStreamer.h: Use GstSample
instead of GstBuffer+GstCaps.
(WebCore::ImageGStreamer::createImage):
* platform/graphics/gstreamer/ImageGStreamerCairo.cpp: Ditto.
(ImageGStreamer::ImageGStreamer):
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
(WebCore::mediaPlayerPrivateRepaintCallback): The repaint signal
now uses a GstSample instead of a GstBuffer.
(WebCore::MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase):
Store the current sample instead of a buffer. Also renamed the
mutex protecting access to the sample.
(WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase): Ditto.
(WebCore::MediaPlayerPrivateGStreamerBase::naturalSize): Return
early if no sample is available. The caps used to get the video
size are store in the sample.
(WebCore::MediaPlayerPrivateGStreamerBase::updateTexture): Use
GstSample instead of GstBuffer.
(WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint): Ditto.
(WebCore::MediaPlayerPrivateGStreamerBase::paint): Ditto.
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
* platform/graphics/gstreamer/VideoSinkGStreamer.cpp: Now store a
GstSample internally. Also removed the now useless current-caps property.
(_WebKitVideoSinkPrivate::_WebKitVideoSinkPrivate): Renamed the
mutex protecting access to the sample.
(_WebKitVideoSinkPrivate::~_WebKitVideoSinkPrivate): Ditto.
(webkit_video_sink_init): Disable last-sample in basesink since we
already store one in our sink anyway.
(webkitVideoSinkTimeoutCallback): Switch to GstSample.
(webkitVideoSinkRender): Ditto.
(unlockSampleMutex): Ditto.
(webkitVideoSinkUnlock): Ditto.
(webkitVideoSinkUnlockStop): Ditto.
(webkitVideoSinkStop): Ditto!
(webkitVideoSinkStart): Ditto.
(webkit_video_sink_class_init): Drop current-caps property.
(webkitVideoSinkGetProperty): Deleted.
(unlockBufferMutex): Deleted.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgstreamerImageGStreamerh">trunk/Source/WebCore/platform/graphics/gstreamer/ImageGStreamer.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgstreamerImageGStreamerCairocpp">trunk/Source/WebCore/platform/graphics/gstreamer/ImageGStreamerCairo.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgstreamerMediaPlayerPrivateGStreamerBasecpp">trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgstreamerMediaPlayerPrivateGStreamerBaseh">trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgstreamerVideoSinkGStreamercpp">trunk/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (175369 => 175370)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-10-30 08:02:20 UTC (rev 175369)
+++ trunk/Source/WebCore/ChangeLog        2014-10-30 08:53:39 UTC (rev 175370)
</span><span class="lines">@@ -1,3 +1,54 @@
</span><ins>+2014-10-24 Philippe Normand <pnormand@igalia.com>
+
+ [GStreamer] Video resolution changes trigger a crash in the TextureMapper
+ https://bugs.webkit.org/show_bug.cgi?id=137065
+
+ Reviewed by Gustavo Noronha Silva.
+
+ Switch to GstSample for buffer+caps communication between the
+ video sink and the player. Using a single object type for this
+ avoid issues where the caps might not correctly describe the
+ buffer contents anymore, for example when the video resolution is
+ changed.
+
+ * platform/graphics/gstreamer/ImageGStreamer.h: Use GstSample
+ instead of GstBuffer+GstCaps.
+ (WebCore::ImageGStreamer::createImage):
+ * platform/graphics/gstreamer/ImageGStreamerCairo.cpp: Ditto.
+ (ImageGStreamer::ImageGStreamer):
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
+ (WebCore::mediaPlayerPrivateRepaintCallback): The repaint signal
+ now uses a GstSample instead of a GstBuffer.
+ (WebCore::MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase):
+ Store the current sample instead of a buffer. Also renamed the
+ mutex protecting access to the sample.
+ (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase): Ditto.
+ (WebCore::MediaPlayerPrivateGStreamerBase::naturalSize): Return
+ early if no sample is available. The caps used to get the video
+ size are store in the sample.
+ (WebCore::MediaPlayerPrivateGStreamerBase::updateTexture): Use
+ GstSample instead of GstBuffer.
+ (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint): Ditto.
+ (WebCore::MediaPlayerPrivateGStreamerBase::paint): Ditto.
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
+ * platform/graphics/gstreamer/VideoSinkGStreamer.cpp: Now store a
+ GstSample internally. Also removed the now useless current-caps property.
+ (_WebKitVideoSinkPrivate::_WebKitVideoSinkPrivate): Renamed the
+ mutex protecting access to the sample.
+ (_WebKitVideoSinkPrivate::~_WebKitVideoSinkPrivate): Ditto.
+ (webkit_video_sink_init): Disable last-sample in basesink since we
+ already store one in our sink anyway.
+ (webkitVideoSinkTimeoutCallback): Switch to GstSample.
+ (webkitVideoSinkRender): Ditto.
+ (unlockSampleMutex): Ditto.
+ (webkitVideoSinkUnlock): Ditto.
+ (webkitVideoSinkUnlockStop): Ditto.
+ (webkitVideoSinkStop): Ditto!
+ (webkitVideoSinkStart): Ditto.
+ (webkit_video_sink_class_init): Drop current-caps property.
+ (webkitVideoSinkGetProperty): Deleted.
+ (unlockBufferMutex): Deleted.
+
</ins><span class="cx"> 2014-10-30 Carlos Garcia Campos <cgarcia@igalia.com>
</span><span class="cx">
</span><span class="cx"> FormDataBuilder should not use Document
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgstreamerImageGStreamerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gstreamer/ImageGStreamer.h (175369 => 175370)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gstreamer/ImageGStreamer.h        2014-10-30 08:02:20 UTC (rev 175369)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/ImageGStreamer.h        2014-10-30 08:53:39 UTC (rev 175370)
</span><span class="lines">@@ -38,9 +38,9 @@
</span><span class="cx">
</span><span class="cx"> class ImageGStreamer : public RefCounted<ImageGStreamer> {
</span><span class="cx"> public:
</span><del>- static PassRefPtr<ImageGStreamer> createImage(GstBuffer* buffer, GstCaps* caps)
</del><ins>+ static PassRefPtr<ImageGStreamer> createImage(GstSample* sample)
</ins><span class="cx"> {
</span><del>- return adoptRef(new ImageGStreamer(buffer, caps));
</del><ins>+ return adoptRef(new ImageGStreamer(sample));
</ins><span class="cx"> }
</span><span class="cx"> ~ImageGStreamer();
</span><span class="cx">
</span><span class="lines">@@ -60,7 +60,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> private:
</span><del>- ImageGStreamer(GstBuffer*, GstCaps*);
</del><ins>+ ImageGStreamer(GstSample*);
</ins><span class="cx"> RefPtr<BitmapImage> m_image;
</span><span class="cx"> FloatRect m_cropRect;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgstreamerImageGStreamerCairocpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gstreamer/ImageGStreamerCairo.cpp (175369 => 175370)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gstreamer/ImageGStreamerCairo.cpp        2014-10-30 08:02:20 UTC (rev 175369)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/ImageGStreamerCairo.cpp        2014-10-30 08:53:39 UTC (rev 175370)
</span><span class="lines">@@ -32,8 +32,9 @@
</span><span class="cx"> using namespace std;
</span><span class="cx"> using namespace WebCore;
</span><span class="cx">
</span><del>-ImageGStreamer::ImageGStreamer(GstBuffer* buffer, GstCaps* caps)
</del><ins>+ImageGStreamer::ImageGStreamer(GstSample* sample)
</ins><span class="cx"> {
</span><ins>+ GstCaps* caps = gst_sample_get_caps(sample);
</ins><span class="cx"> GstVideoInfo videoInfo;
</span><span class="cx"> gst_video_info_init(&videoInfo);
</span><span class="cx"> if (!gst_video_info_from_caps(&videoInfo, caps))
</span><span class="lines">@@ -42,6 +43,7 @@
</span><span class="cx"> // Right now the TextureMapper only supports chromas with one plane
</span><span class="cx"> ASSERT(GST_VIDEO_INFO_N_PLANES(&videoInfo) == 1);
</span><span class="cx">
</span><ins>+ GstBuffer* buffer = gst_sample_get_buffer(sample);
</ins><span class="cx"> if (!gst_video_frame_map(&m_videoFrame, &videoInfo, buffer, GST_MAP_READ))
</span><span class="cx"> return;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgstreamerMediaPlayerPrivateGStreamerBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp (175369 => 175370)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp        2014-10-30 08:02:20 UTC (rev 175369)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp        2014-10-30 08:53:39 UTC (rev 175370)
</span><span class="lines">@@ -79,9 +79,9 @@
</span><span class="cx"> player->muteChanged();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static void mediaPlayerPrivateRepaintCallback(WebKitVideoSink*, GstBuffer *buffer, MediaPlayerPrivateGStreamerBase* playerPrivate)
</del><ins>+static void mediaPlayerPrivateRepaintCallback(WebKitVideoSink*, GstSample* sample, MediaPlayerPrivateGStreamerBase* playerPrivate)
</ins><span class="cx"> {
</span><del>- playerPrivate->triggerRepaint(buffer);
</del><ins>+ playerPrivate->triggerRepaint(sample);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase(MediaPlayer* player)
</span><span class="lines">@@ -89,12 +89,12 @@
</span><span class="cx"> , m_fpsSink(0)
</span><span class="cx"> , m_readyState(MediaPlayer::HaveNothing)
</span><span class="cx"> , m_networkState(MediaPlayer::Empty)
</span><del>- , m_buffer(0)
</del><ins>+ , m_sample(0)
</ins><span class="cx"> , m_repaintHandler(0)
</span><span class="cx"> , m_volumeSignalHandler(0)
</span><span class="cx"> , m_muteSignalHandler(0)
</span><span class="cx"> {
</span><del>- g_mutex_init(&m_bufferMutex);
</del><ins>+ g_mutex_init(&m_sampleMutex);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase()
</span><span class="lines">@@ -104,11 +104,11 @@
</span><span class="cx"> m_repaintHandler = 0;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- g_mutex_clear(&m_bufferMutex);
</del><ins>+ g_mutex_clear(&m_sampleMutex);
</ins><span class="cx">
</span><del>- if (m_buffer)
- gst_buffer_unref(m_buffer);
- m_buffer = 0;
</del><ins>+ if (m_sample)
+ gst_sample_unref(m_sample);
+ m_sample = 0;
</ins><span class="cx">
</span><span class="cx"> m_player = 0;
</span><span class="cx">
</span><span class="lines">@@ -137,7 +137,11 @@
</span><span class="cx"> if (!m_videoSize.isEmpty())
</span><span class="cx"> return m_videoSize;
</span><span class="cx">
</span><del>- GRefPtr<GstCaps> caps = currentVideoSinkCaps();
</del><ins>+ GMutexLocker<GMutex> lock(m_sampleMutex);
+ if (!m_sample)
+ return IntSize();
+
+ GstCaps* caps = gst_sample_get_caps(m_sample);
</ins><span class="cx"> if (!caps)
</span><span class="cx"> return IntSize();
</span><span class="cx">
</span><span class="lines">@@ -152,7 +156,7 @@
</span><span class="cx"> int pixelAspectRatioNumerator, pixelAspectRatioDenominator, stride;
</span><span class="cx"> IntSize originalSize;
</span><span class="cx"> GstVideoFormat format;
</span><del>- if (!getVideoSizeAndFormatFromCaps(caps.get(), originalSize, format, pixelAspectRatioNumerator, pixelAspectRatioDenominator, stride))
</del><ins>+ if (!getVideoSizeAndFormatFromCaps(caps, originalSize, format, pixelAspectRatioNumerator, pixelAspectRatioDenominator, stride))
</ins><span class="cx"> return IntSize();
</span><span class="cx">
</span><span class="cx"> LOG_MEDIA_MESSAGE("Original video size: %dx%d", originalSize.width(), originalSize.height());
</span><span class="lines">@@ -275,25 +279,26 @@
</span><span class="cx"> #if USE(TEXTURE_MAPPER_GL) && !USE(COORDINATED_GRAPHICS)
</span><span class="cx"> PassRefPtr<BitmapTexture> MediaPlayerPrivateGStreamerBase::updateTexture(TextureMapper* textureMapper)
</span><span class="cx"> {
</span><del>- GMutexLocker<GMutex> lock(m_bufferMutex);
- if (!m_buffer)
</del><ins>+ GMutexLocker<GMutex> lock(m_sampleMutex);
+ if (!m_sample)
</ins><span class="cx"> return nullptr;
</span><span class="cx">
</span><del>- GRefPtr<GstCaps> caps = currentVideoSinkCaps();
</del><ins>+ GstCaps* caps = gst_sample_get_caps(m_sample);
</ins><span class="cx"> if (!caps)
</span><span class="cx"> return nullptr;
</span><span class="cx">
</span><span class="cx"> GstVideoInfo videoInfo;
</span><span class="cx"> gst_video_info_init(&videoInfo);
</span><del>- if (!gst_video_info_from_caps(&videoInfo, caps.get()))
</del><ins>+ if (!gst_video_info_from_caps(&videoInfo, caps))
</ins><span class="cx"> return nullptr;
</span><span class="cx">
</span><span class="cx"> IntSize size = IntSize(GST_VIDEO_INFO_WIDTH(&videoInfo), GST_VIDEO_INFO_HEIGHT(&videoInfo));
</span><span class="cx"> RefPtr<BitmapTexture> texture = textureMapper->acquireTextureFromPool(size, GST_VIDEO_INFO_HAS_ALPHA(&videoInfo) ? BitmapTexture::SupportsAlpha : BitmapTexture::NoFlag);
</span><ins>+ GstBuffer* buffer = gst_sample_get_buffer(m_sample);
</ins><span class="cx">
</span><span class="cx"> #if GST_CHECK_VERSION(1, 1, 0)
</span><span class="cx"> GstVideoGLTextureUploadMeta* meta;
</span><del>- if ((meta = gst_buffer_get_video_gl_texture_upload_meta(m_buffer))) {
</del><ins>+ if ((meta = gst_buffer_get_video_gl_texture_upload_meta(buffer))) {
</ins><span class="cx"> if (meta->n_textures == 1) { // BRGx & BGRA formats use only one texture.
</span><span class="cx"> const BitmapTextureGL* textureGL = static_cast<const BitmapTextureGL*>(texture.get());
</span><span class="cx"> guint ids[4] = { textureGL->id(), 0, 0, 0 };
</span><span class="lines">@@ -308,7 +313,7 @@
</span><span class="cx"> ASSERT(GST_VIDEO_INFO_N_PLANES(&videoInfo) == 1);
</span><span class="cx">
</span><span class="cx"> GstVideoFrame videoFrame;
</span><del>- if (!gst_video_frame_map(&videoFrame, &videoInfo, m_buffer, GST_MAP_READ))
</del><ins>+ if (!gst_video_frame_map(&videoFrame, &videoInfo, buffer, GST_MAP_READ))
</ins><span class="cx"> return nullptr;
</span><span class="cx">
</span><span class="cx"> int stride = GST_VIDEO_FRAME_PLANE_STRIDE(&videoFrame, 0);
</span><span class="lines">@@ -320,13 +325,15 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>-void MediaPlayerPrivateGStreamerBase::triggerRepaint(GstBuffer* buffer)
</del><ins>+void MediaPlayerPrivateGStreamerBase::triggerRepaint(GstSample* sample)
</ins><span class="cx"> {
</span><del>- g_return_if_fail(GST_IS_BUFFER(buffer));
</del><ins>+ g_return_if_fail(GST_IS_SAMPLE(sample));
</ins><span class="cx">
</span><span class="cx"> {
</span><del>- GMutexLocker<GMutex> lock(m_bufferMutex);
- gst_buffer_replace(&m_buffer, buffer);
</del><ins>+ GMutexLocker<GMutex> lock(m_sampleMutex);
+ if (m_sample)
+ gst_sample_unref(m_sample);
+ m_sample = gst_sample_ref(sample);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #if USE(TEXTURE_MAPPER_GL) && !USE(COORDINATED_GRAPHICS)
</span><span class="lines">@@ -357,15 +364,11 @@
</span><span class="cx"> if (!m_player->visible())
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- GMutexLocker<GMutex> lock(m_bufferMutex);
- if (!m_buffer)
</del><ins>+ GMutexLocker<GMutex> lock(m_sampleMutex);
+ if (!m_sample)
</ins><span class="cx"> return;
</span><span class="cx">
</span><del>- GRefPtr<GstCaps> caps = currentVideoSinkCaps();
- if (!caps)
- return;
-
- RefPtr<ImageGStreamer> gstImage = ImageGStreamer::createImage(m_buffer, caps.get());
</del><ins>+ RefPtr<ImageGStreamer> gstImage = ImageGStreamer::createImage(m_sample);
</ins><span class="cx"> if (!gstImage)
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="lines">@@ -409,16 +412,6 @@
</span><span class="cx"> return MediaPlayer::Download;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-GRefPtr<GstCaps> MediaPlayerPrivateGStreamerBase::currentVideoSinkCaps() const
-{
- if (!m_webkitVideoSink)
- return nullptr;
-
- GRefPtr<GstCaps> currentCaps;
- g_object_get(G_OBJECT(m_webkitVideoSink.get()), "current-caps", &currentCaps.outPtr(), NULL);
- return currentCaps;
-}
-
</del><span class="cx"> GstElement* MediaPlayerPrivateGStreamerBase::createVideoSink()
</span><span class="cx"> {
</span><span class="cx"> ASSERT(initializeGStreamer());
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgstreamerMediaPlayerPrivateGStreamerBaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h (175369 => 175370)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h        2014-10-30 08:02:20 UTC (rev 175369)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h        2014-10-30 08:53:39 UTC (rev 175370)
</span><span class="lines">@@ -36,7 +36,7 @@
</span><span class="cx"> #include "TextureMapperPlatformLayer.h"
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>-typedef struct _GstBuffer GstBuffer;
</del><ins>+typedef struct _GstSample GstSample;
</ins><span class="cx"> typedef struct _GstElement GstElement;
</span><span class="cx"> typedef struct _GstMessage GstMessage;
</span><span class="cx"> typedef struct _GstStreamVolume GstStreamVolume;
</span><span class="lines">@@ -77,7 +77,7 @@
</span><span class="cx"> void setSize(const IntSize&);
</span><span class="cx"> void sizeChanged();
</span><span class="cx">
</span><del>- void triggerRepaint(GstBuffer*);
</del><ins>+ void triggerRepaint(GstSample*);
</ins><span class="cx"> void paint(GraphicsContext*, const IntRect&);
</span><span class="cx">
</span><span class="cx"> virtual bool hasSingleSecurityOrigin() const { return true; }
</span><span class="lines">@@ -110,7 +110,6 @@
</span><span class="cx"> protected:
</span><span class="cx"> MediaPlayerPrivateGStreamerBase(MediaPlayer*);
</span><span class="cx"> virtual GstElement* createVideoSink();
</span><del>- GRefPtr<GstCaps> currentVideoSinkCaps() const;
</del><span class="cx">
</span><span class="cx"> void setStreamVolumeElement(GstStreamVolume*);
</span><span class="cx"> virtual GstElement* createAudioSink() { return 0; }
</span><span class="lines">@@ -123,8 +122,8 @@
</span><span class="cx"> MediaPlayer::ReadyState m_readyState;
</span><span class="cx"> MediaPlayer::NetworkState m_networkState;
</span><span class="cx"> IntSize m_size;
</span><del>- GMutex m_bufferMutex;
- GstBuffer* m_buffer;
</del><ins>+ mutable GMutex m_sampleMutex;
+ GstSample* m_sample;
</ins><span class="cx"> GThreadSafeMainLoopSource m_volumeTimerHandler;
</span><span class="cx"> GThreadSafeMainLoopSource m_muteTimerHandler;
</span><span class="cx"> unsigned long m_repaintHandler;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgstreamerVideoSinkGStreamercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp (175369 => 175370)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp        2014-10-30 08:02:20 UTC (rev 175369)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp        2014-10-30 08:53:39 UTC (rev 175370)
</span><span class="lines">@@ -66,30 +66,25 @@
</span><span class="cx"> LAST_SIGNAL
</span><span class="cx"> };
</span><span class="cx">
</span><del>-enum {
- PROP_0,
- PROP_CAPS
-};
-
</del><span class="cx"> static guint webkitVideoSinkSignals[LAST_SIGNAL] = { 0, };
</span><span class="cx">
</span><span class="cx"> struct _WebKitVideoSinkPrivate {
</span><span class="cx"> _WebKitVideoSinkPrivate()
</span><span class="cx"> {
</span><del>- g_mutex_init(&bufferMutex);
</del><ins>+ g_mutex_init(&sampleMutex);
</ins><span class="cx"> g_cond_init(&dataCondition);
</span><span class="cx"> gst_video_info_init(&info);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ~_WebKitVideoSinkPrivate()
</span><span class="cx"> {
</span><del>- g_mutex_clear(&bufferMutex);
</del><ins>+ g_mutex_clear(&sampleMutex);
</ins><span class="cx"> g_cond_clear(&dataCondition);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- GstBuffer* buffer;
</del><ins>+ GstSample* sample;
</ins><span class="cx"> GThreadSafeMainLoopSource timeoutSource;
</span><del>- GMutex bufferMutex;
</del><ins>+ GMutex sampleMutex;
</ins><span class="cx"> GCond dataCondition;
</span><span class="cx">
</span><span class="cx"> GstVideoInfo info;
</span><span class="lines">@@ -103,7 +98,7 @@
</span><span class="cx"> // everything else isn't running anymore. This will lead
</span><span class="cx"> // to deadlocks because render() holds the stream lock.
</span><span class="cx"> //
</span><del>- // Protected by the buffer mutex
</del><ins>+ // Protected by the sample mutex
</ins><span class="cx"> bool unlocked;
</span><span class="cx"> };
</span><span class="cx">
</span><span class="lines">@@ -114,6 +109,7 @@
</span><span class="cx"> static void webkit_video_sink_init(WebKitVideoSink* sink)
</span><span class="cx"> {
</span><span class="cx"> sink->priv = G_TYPE_INSTANCE_GET_PRIVATE(sink, WEBKIT_TYPE_VIDEO_SINK, WebKitVideoSinkPrivate);
</span><ins>+ g_object_set(GST_BASE_SINK(sink), "enable-last-sample", FALSE, NULL);
</ins><span class="cx"> new (sink->priv) WebKitVideoSinkPrivate();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -121,17 +117,17 @@
</span><span class="cx"> {
</span><span class="cx"> WebKitVideoSinkPrivate* priv = sink->priv;
</span><span class="cx">
</span><del>- GMutexLocker<GMutex> lock(priv->bufferMutex);
- GstBuffer* buffer = priv->buffer;
- priv->buffer = 0;
</del><ins>+ GMutexLocker<GMutex> lock(priv->sampleMutex);
+ GstSample* sample = priv->sample;
+ priv->sample = 0;
</ins><span class="cx">
</span><del>- if (!buffer || priv->unlocked || UNLIKELY(!GST_IS_BUFFER(buffer))) {
</del><ins>+ if (!sample || priv->unlocked || UNLIKELY(!GST_IS_SAMPLE(sample))) {
</ins><span class="cx"> g_cond_signal(&priv->dataCondition);
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- g_signal_emit(sink, webkitVideoSinkSignals[REPAINT_REQUESTED], 0, buffer);
- gst_buffer_unref(buffer);
</del><ins>+ g_signal_emit(sink, webkitVideoSinkSignals[REPAINT_REQUESTED], 0, sample);
+ gst_sample_unref(sample);
</ins><span class="cx"> g_cond_signal(&priv->dataCondition);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -140,17 +136,17 @@
</span><span class="cx"> WebKitVideoSink* sink = WEBKIT_VIDEO_SINK(baseSink);
</span><span class="cx"> WebKitVideoSinkPrivate* priv = sink->priv;
</span><span class="cx">
</span><del>- GMutexLocker<GMutex> lock(priv->bufferMutex);
</del><ins>+ GMutexLocker<GMutex> lock(priv->sampleMutex);
</ins><span class="cx">
</span><span class="cx"> if (priv->unlocked)
</span><span class="cx"> return GST_FLOW_OK;
</span><span class="cx">
</span><del>- priv->buffer = gst_buffer_ref(buffer);
</del><ins>+ priv->sample = gst_sample_new(buffer, priv->currentCaps, 0, 0);
</ins><span class="cx">
</span><span class="cx"> // The video info structure is valid only if the sink handled an allocation query.
</span><span class="cx"> GstVideoFormat format = GST_VIDEO_INFO_FORMAT(&priv->info);
</span><span class="cx"> if (format == GST_VIDEO_FORMAT_UNKNOWN) {
</span><del>- gst_buffer_unref(buffer);
</del><ins>+ gst_sample_unref(priv->sample);
</ins><span class="cx"> return GST_FLOW_ERROR;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -179,13 +175,12 @@
</span><span class="cx"> GstVideoFrame destinationFrame;
</span><span class="cx">
</span><span class="cx"> if (!gst_video_frame_map(&sourceFrame, &priv->info, buffer, GST_MAP_READ)) {
</span><del>- gst_buffer_unref(buffer);
</del><ins>+ gst_sample_unref(priv->sample);
</ins><span class="cx"> gst_buffer_unref(newBuffer);
</span><span class="cx"> return GST_FLOW_ERROR;
</span><span class="cx"> }
</span><span class="cx"> if (!gst_video_frame_map(&destinationFrame, &priv->info, newBuffer, GST_MAP_WRITE)) {
</span><span class="cx"> gst_video_frame_unmap(&sourceFrame);
</span><del>- gst_buffer_unref(buffer);
</del><span class="cx"> gst_buffer_unref(newBuffer);
</span><span class="cx"> return GST_FLOW_ERROR;
</span><span class="cx"> }
</span><span class="lines">@@ -215,8 +210,8 @@
</span><span class="cx">
</span><span class="cx"> gst_video_frame_unmap(&sourceFrame);
</span><span class="cx"> gst_video_frame_unmap(&destinationFrame);
</span><del>- gst_buffer_unref(buffer);
- buffer = priv->buffer = newBuffer;
</del><ins>+ gst_sample_unref(priv->sample);
+ priv->sample = gst_sample_new(newBuffer, priv->currentCaps, 0, 0);
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="lines">@@ -227,7 +222,7 @@
</span><span class="cx"> priv->timeoutSource.schedule("[WebKit] webkitVideoSinkTimeoutCallback", std::function<void()>(std::bind(webkitVideoSinkTimeoutCallback, sink)), G_PRIORITY_DEFAULT,
</span><span class="cx"> [sink] { gst_object_unref(sink); });
</span><span class="cx">
</span><del>- g_cond_wait(&priv->dataCondition, &priv->bufferMutex);
</del><ins>+ g_cond_wait(&priv->dataCondition, &priv->sampleMutex);
</ins><span class="cx"> return GST_FLOW_OK;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -237,33 +232,15 @@
</span><span class="cx"> G_OBJECT_CLASS(parent_class)->finalize(object);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static void webkitVideoSinkGetProperty(GObject* object, guint propertyId, GValue* value, GParamSpec* parameterSpec)
</del><ins>+static void unlockSampleMutex(WebKitVideoSinkPrivate* priv)
</ins><span class="cx"> {
</span><del>- WebKitVideoSink* sink = WEBKIT_VIDEO_SINK(object);
- WebKitVideoSinkPrivate* priv = sink->priv;
</del><ins>+ GMutexLocker<GMutex> lock(priv->sampleMutex);
</ins><span class="cx">
</span><del>- switch (propertyId) {
- case PROP_CAPS: {
- GstCaps* caps = priv->currentCaps;
- if (caps)
- gst_caps_ref(caps);
- g_value_take_boxed(value, caps);
- break;
</del><ins>+ if (priv->sample) {
+ gst_sample_unref(priv->sample);
+ priv->sample = 0;
</ins><span class="cx"> }
</span><del>- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyId, parameterSpec);
- }
-}
</del><span class="cx">
</span><del>-static void unlockBufferMutex(WebKitVideoSinkPrivate* priv)
-{
- GMutexLocker<GMutex> lock(priv->bufferMutex);
-
- if (priv->buffer) {
- gst_buffer_unref(priv->buffer);
- priv->buffer = 0;
- }
-
</del><span class="cx"> priv->unlocked = true;
</span><span class="cx">
</span><span class="cx"> g_cond_signal(&priv->dataCondition);
</span><span class="lines">@@ -273,7 +250,7 @@
</span><span class="cx"> {
</span><span class="cx"> WebKitVideoSink* sink = WEBKIT_VIDEO_SINK(baseSink);
</span><span class="cx">
</span><del>- unlockBufferMutex(sink->priv);
</del><ins>+ unlockSampleMutex(sink->priv);
</ins><span class="cx">
</span><span class="cx"> return GST_CALL_PARENT_WITH_DEFAULT(GST_BASE_SINK_CLASS, unlock, (baseSink), TRUE);
</span><span class="cx"> }
</span><span class="lines">@@ -283,7 +260,7 @@
</span><span class="cx"> WebKitVideoSinkPrivate* priv = WEBKIT_VIDEO_SINK(baseSink)->priv;
</span><span class="cx">
</span><span class="cx"> {
</span><del>- GMutexLocker<GMutex> lock(priv->bufferMutex);
</del><ins>+ GMutexLocker<GMutex> lock(priv->sampleMutex);
</ins><span class="cx"> priv->unlocked = false;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -294,7 +271,7 @@
</span><span class="cx"> {
</span><span class="cx"> WebKitVideoSinkPrivate* priv = WEBKIT_VIDEO_SINK(baseSink)->priv;
</span><span class="cx">
</span><del>- unlockBufferMutex(priv);
</del><ins>+ unlockSampleMutex(priv);
</ins><span class="cx">
</span><span class="cx"> if (priv->currentCaps) {
</span><span class="cx"> gst_caps_unref(priv->currentCaps);
</span><span class="lines">@@ -308,7 +285,7 @@
</span><span class="cx"> {
</span><span class="cx"> WebKitVideoSinkPrivate* priv = WEBKIT_VIDEO_SINK(baseSink)->priv;
</span><span class="cx">
</span><del>- GMutexLocker<GMutex> lock(priv->bufferMutex);
</del><ins>+ GMutexLocker<GMutex> lock(priv->sampleMutex);
</ins><span class="cx"> priv->unlocked = false;
</span><span class="cx"> return TRUE;
</span><span class="cx"> }
</span><span class="lines">@@ -363,7 +340,6 @@
</span><span class="cx"> g_type_class_add_private(klass, sizeof(WebKitVideoSinkPrivate));
</span><span class="cx">
</span><span class="cx"> gobjectClass->finalize = webkitVideoSinkFinalize;
</span><del>- gobjectClass->get_property = webkitVideoSinkGetProperty;
</del><span class="cx">
</span><span class="cx"> baseSinkClass->unlock = webkitVideoSinkUnlock;
</span><span class="cx"> baseSinkClass->unlock_stop = webkitVideoSinkUnlockStop;
</span><span class="lines">@@ -374,9 +350,6 @@
</span><span class="cx"> baseSinkClass->set_caps = webkitVideoSinkSetCaps;
</span><span class="cx"> baseSinkClass->propose_allocation = webkitVideoSinkProposeAllocation;
</span><span class="cx">
</span><del>- g_object_class_install_property(gobjectClass, PROP_CAPS,
- g_param_spec_boxed("current-caps", "Current-Caps", "Current caps", GST_TYPE_CAPS, G_PARAM_READABLE));
-
</del><span class="cx"> webkitVideoSinkSignals[REPAINT_REQUESTED] = g_signal_new("repaint-requested",
</span><span class="cx"> G_TYPE_FROM_CLASS(klass),
</span><span class="cx"> static_cast<GSignalFlags>(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
</span><span class="lines">@@ -386,7 +359,7 @@
</span><span class="cx"> g_cclosure_marshal_generic,
</span><span class="cx"> G_TYPE_NONE, // Return type
</span><span class="cx"> 1, // Only one parameter
</span><del>- GST_TYPE_BUFFER);
</del><ins>+ GST_TYPE_SAMPLE);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>