Modified: releases/WebKitGTK/webkit-2.20/Source/WebCore/ChangeLog (228806 => 228807)
--- releases/WebKitGTK/webkit-2.20/Source/WebCore/ChangeLog 2018-02-20 13:47:49 UTC (rev 228806)
+++ releases/WebKitGTK/webkit-2.20/Source/WebCore/ChangeLog 2018-02-20 13:47:54 UTC (rev 228807)
@@ -1,3 +1,33 @@
+2018-02-19 Philippe Normand <[email protected]>
+
+ [GTK][GStreamer] Replaying a webm video twice causes the video to stop getting rendered
+ https://bugs.webkit.org/show_bug.cgi?id=176789
+
+ Reviewed by Xabier Rodriguez-Calvar.
+
+ Ensure the wrapped GstGLContext is set when the pipeline goes from
+ READY to PAUSED state. This is a workaround for
+ https://bugzilla.gnome.org/show_bug.cgi?id=757933.
+
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+ (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer): Add debug statement.
+ (WebCore::MediaPlayerPrivateGStreamer::readyTimerFired): Ditto.
+ (WebCore::MediaPlayerPrivateGStreamer::changePipelineState):
+ Ensure the wrapped GstGLContext is set when the pipeline goes from
+ READY to PAUSED state.
+ (WebCore::MediaPlayerPrivateGStreamer::didEnd): Add debug statement.
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
+ Change the requestGLContext to be a method instead of a static
+ function. Being a static function was a requirement for the now-removed OpenWebRTC player.
+ (WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage): Add
+ debug statement, fix requestGLContext usage.
+ (WebCore::MediaPlayerPrivateGStreamerBase::requestGLContext): Refactor as method.
+ (WebCore::MediaPlayerPrivateGStreamerBase::flushCurrentBuffer): Fix requestGLContext usage.
+ (WebCore::MediaPlayerPrivateGStreamerBase::createVideoSinkGL): Remove fixed FIXME.
+ (WebCore::MediaPlayerPrivateGStreamerBase::ensureGLVideoSinkContext):
+ Set display and app wrapped contexts on the video sink.
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
+
2018-02-19 Xabier Rodriguez Calvar <[email protected]>
[GStreamer] Crash in WebCore::MediaPlayerRequestInstallMissingPluginsCallback::complete
Modified: releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp (228806 => 228807)
--- releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp 2018-02-20 13:47:49 UTC (rev 228806)
+++ releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp 2018-02-20 13:47:54 UTC (rev 228807)
@@ -165,6 +165,8 @@
MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer()
{
+ GST_DEBUG("Disposing player");
+
#if ENABLE(VIDEO_TRACK)
for (size_t i = 0; i < m_audioTracks.size(); ++i)
m_audioTracks[i]->disconnect();
@@ -345,6 +347,7 @@
void MediaPlayerPrivateGStreamer::readyTimerFired()
{
+ GST_DEBUG("In READY for too long. Releasing pipeline resources.");
changePipelineState(GST_STATE_NULL);
}
@@ -365,6 +368,11 @@
GST_DEBUG("Changing state change to %s from %s with %s pending", gst_element_state_get_name(newState),
gst_element_state_get_name(currentState), gst_element_state_get_name(pending));
+#if USE(GSTREAMER_GL)
+ if (currentState == GST_STATE_READY && newState == GST_STATE_PAUSED)
+ ensureGLVideoSinkContext();
+#endif
+
GstStateChangeReturn setStateResult = gst_element_set_state(m_pipeline.get(), newState);
GstState pausedOrPlaying = newState == GST_STATE_PLAYING ? GST_STATE_PAUSED : GST_STATE_PLAYING;
if (currentState != pausedOrPlaying && setStateResult == GST_STATE_CHANGE_FAILURE) {
@@ -1812,6 +1820,8 @@
void MediaPlayerPrivateGStreamer::didEnd()
{
+ GST_INFO("Playback ended");
+
// Synchronize position and duration values to not confuse the
// HTMLMediaElement. In some cases like reverse playback the
// position is not always reported as 0 for instance.
Modified: releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp (228806 => 228807)
--- releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp 2018-02-20 13:47:49 UTC (rev 228806)
+++ releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp 2018-02-20 13:47:54 UTC (rev 228807)
@@ -322,9 +322,10 @@
const gchar* contextType;
gst_message_parse_context_type(message, &contextType);
+ GST_DEBUG("Handling %s need-context message for %s", contextType, GST_MESSAGE_SRC_NAME(message));
#if USE(GSTREAMER_GL)
- GRefPtr<GstContext> elementContext = adoptGRef(requestGLContext(contextType, this));
+ GRefPtr<GstContext> elementContext = adoptGRef(requestGLContext(contextType));
if (elementContext) {
gst_element_set_context(GST_ELEMENT(message->src), elementContext.get());
return true;
@@ -407,14 +408,14 @@
}
#if USE(GSTREAMER_GL)
-GstContext* MediaPlayerPrivateGStreamerBase::requestGLContext(const gchar* contextType, MediaPlayerPrivateGStreamerBase* player)
+GstContext* MediaPlayerPrivateGStreamerBase::requestGLContext(const char* contextType)
{
- if (!player->ensureGstGLContext())
+ if (!ensureGstGLContext())
return nullptr;
if (!g_strcmp0(contextType, GST_GL_DISPLAY_CONTEXT_TYPE)) {
GstContext* displayContext = gst_context_new(GST_GL_DISPLAY_CONTEXT_TYPE, TRUE);
- gst_context_set_gl_display(displayContext, player->gstGLDisplay());
+ gst_context_set_gl_display(displayContext, gstGLDisplay());
return displayContext;
}
@@ -422,9 +423,9 @@
GstContext* appContext = gst_context_new("gst.gl.app_context", TRUE);
GstStructure* structure = gst_context_writable_structure(appContext);
#if GST_CHECK_VERSION(1, 11, 0)
- gst_structure_set(structure, "context", GST_TYPE_GL_CONTEXT, player->gstGLContext(), nullptr);
+ gst_structure_set(structure, "context", GST_TYPE_GL_CONTEXT, gstGLContext(), nullptr);
#else
- gst_structure_set(structure, "context", GST_GL_TYPE_CONTEXT, player->gstGLContext(), nullptr);
+ gst_structure_set(structure, "context", GST_GL_TYPE_CONTEXT, gstGLContext(), nullptr);
#endif
return appContext;
}
@@ -840,6 +841,7 @@
void MediaPlayerPrivateGStreamerBase::flushCurrentBuffer()
{
+ GST_DEBUG("Flushing video sample");
WTF::GMutexLocker<GMutex> lock(m_sampleMutex);
m_sample.clear();
@@ -1017,10 +1019,6 @@
GstElement* MediaPlayerPrivateGStreamerBase::createVideoSinkGL()
{
- // FIXME: Currently it's not possible to get the video frames and caps using this approach until
- // the pipeline gets into playing state. Due to this, trying to grab a frame and painting it by some
- // other mean (canvas or webgl) before playing state can result in a crash.
- // This is being handled in https://bugs.webkit.org/show_bug.cgi?id=159460.
if (!webkitGstCheckVersion(1, 8, 0))
return nullptr;
@@ -1061,6 +1059,21 @@
}
return videoSink;
}
+
+void MediaPlayerPrivateGStreamerBase::ensureGLVideoSinkContext()
+{
+ if (!m_glDisplayElementContext)
+ m_glDisplayElementContext = adoptGRef(requestGLContext(GST_GL_DISPLAY_CONTEXT_TYPE));
+
+ if (m_glDisplayElementContext)
+ gst_element_set_context(m_videoSink.get(), m_glDisplayElementContext.get());
+
+ if (!m_glAppElementContext)
+ m_glAppElementContext = adoptGRef(requestGLContext("gst.gl.app_context"));
+
+ if (m_glAppElementContext)
+ gst_element_set_context(m_videoSink.get(), m_glAppElementContext.get());
+}
#endif // USE(GSTREAMER_GL)
GstElement* MediaPlayerPrivateGStreamerBase::createVideoSink()
Modified: releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h (228806 => 228807)
--- releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h 2018-02-20 13:47:49 UTC (rev 228806)
+++ releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h 2018-02-20 13:47:54 UTC (rev 228807)
@@ -77,7 +77,7 @@
#if USE(GSTREAMER_GL)
bool ensureGstGLContext();
- static GstContext* requestGLContext(const gchar* contextType, MediaPlayerPrivateGStreamerBase*);
+ GstContext* requestGLContext(const char* contextType);
#endif
static bool initializeGStreamerAndRegisterWebKitElements();
bool supportsMuting() const override { return true; }
@@ -170,6 +170,7 @@
GstElement* createVideoSinkGL();
GstGLContext* gstGLContext() const { return m_glContext.get(); }
GstGLDisplay* gstGLDisplay() const { return m_glDisplay.get(); }
+ void ensureGLVideoSinkContext();
#endif
#if USE(TEXTURE_MAPPER_GL)
@@ -241,6 +242,8 @@
#if USE(GSTREAMER_GL)
GRefPtr<GstGLContext> m_glContext;
GRefPtr<GstGLDisplay> m_glDisplay;
+ GRefPtr<GstContext> m_glDisplayElementContext;
+ GRefPtr<GstContext> m_glAppElementContext;
std::unique_ptr<VideoTextureCopierGStreamer> m_videoTextureCopier;
#endif