Modified: trunk/Source/WebCore/ChangeLog (217823 => 217824)
--- trunk/Source/WebCore/ChangeLog 2017-06-06 08:10:39 UTC (rev 217823)
+++ trunk/Source/WebCore/ChangeLog 2017-06-06 09:01:12 UTC (rev 217824)
@@ -1,3 +1,29 @@
+2017-06-06 Carlos Garcia Campos <[email protected]>
+
+ [GStreamer] Use the same draw timer and mutex when AC disabled or building without OpenGL
+ https://bugs.webkit.org/show_bug.cgi?id=172923
+
+ Reviewed by Michael Catanzaro.
+
+ We have two different paths to do the same. When building without OpenGL, the VideoRenderRequestScheduler has
+ its own timer and we need to add ifdefs to handle that. But when building with OpenGL we still support
+ non-accelerated rendering that does the same than the VideoRenderRequestScheduler timer, but using the media
+ player timer instead. We can simplify the code and remove more ifdefs by using the media player timer and mutex
+ in all cases for non-accelerated rendering.
+
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
+ (WebCore::MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase):
+ (WebCore::MediaPlayerPrivateGStreamerBase::repaint):
+ (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
+ (WebCore::MediaPlayerPrivateGStreamerBase::cancelRepaint):
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
+ * platform/graphics/gstreamer/VideoSinkGStreamer.cpp:
+ (VideoRenderRequestScheduler::start):
+ (VideoRenderRequestScheduler::stop):
+ (VideoRenderRequestScheduler::requestRender):
+ (VideoRenderRequestScheduler::VideoRenderRequestScheduler): Deleted.
+ (VideoRenderRequestScheduler::render): Deleted.
+
2017-06-05 Antoine Quint <[email protected]>
Update media controls to match latest design specs
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp (217823 => 217824)
--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp 2017-06-06 08:10:39 UTC (rev 217823)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp 2017-06-06 09:01:12 UTC (rev 217824)
@@ -220,9 +220,9 @@
, m_fpsSink(nullptr)
, m_readyState(MediaPlayer::HaveNothing)
, m_networkState(MediaPlayer::Empty)
+ , m_drawTimer(RunLoop::main(), this, &MediaPlayerPrivateGStreamerBase::repaint)
#if USE(TEXTURE_MAPPER_GL)
, m_platformLayerProxy(adoptRef(new TextureMapperPlatformLayerProxy()))
- , m_drawTimer(RunLoop::main(), this, &MediaPlayerPrivateGStreamerBase::repaint)
#endif
{
g_mutex_init(&m_sampleMutex);
@@ -729,7 +729,6 @@
m_player->repaint();
-#if USE(TEXTURE_MAPPER_GL)
#if USE(GSTREAMER_GL)
bool shouldNotifyDraw = !m_renderingCanBeAccelerated;
#else
@@ -739,7 +738,6 @@
LockHolder lock(m_drawMutex);
m_drawCondition.notifyOne();
}
-#endif // USE(TEXTURE_MAPPER_GL)
}
void MediaPlayerPrivateGStreamerBase::triggerRepaint(GstSample* sample)
@@ -756,9 +754,6 @@
m_notifier.notify(MainThreadNotification::SizeChanged, [this] { m_player->sizeChanged(); });
}
-#if !USE(TEXTURE_MAPPER_GL)
- repaint();
-#else
if (!m_renderingCanBeAccelerated) {
LockHolder locker(m_drawMutex);
m_drawTimer.startOneShot(0_s);
@@ -766,6 +761,7 @@
return;
}
+#if USE(TEXTURE_MAPPER_GL)
#if USE(GSTREAMER_GL)
pushTextureToCompositor();
#else
@@ -776,7 +772,7 @@
m_drawCondition.wait(m_drawMutex);
}
#endif
-#endif // !USE(TEXTURE_MAPPER_GL)
+#endif // USE(TEXTURE_MAPPER_GL)
}
void MediaPlayerPrivateGStreamerBase::repaintCallback(MediaPlayerPrivateGStreamerBase* player, GstSample* sample)
@@ -786,7 +782,6 @@
void MediaPlayerPrivateGStreamerBase::cancelRepaint()
{
-#if USE(TEXTURE_MAPPER_GL)
#if USE(GSTREAMER_GL)
bool shouldCancelRepaint = !m_renderingCanBeAccelerated;
#else
@@ -797,7 +792,6 @@
LockHolder locker(m_drawMutex);
m_drawCondition.notifyOne();
}
-#endif // USE(TEXTURE_MAPPER_GL)
}
void MediaPlayerPrivateGStreamerBase::repaintCancelledCallback(MediaPlayerPrivateGStreamerBase* player)
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h (217823 => 217824)
--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h 2017-06-06 08:10:39 UTC (rev 217823)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h 2017-06-06 09:01:12 UTC (rev 217824)
@@ -208,12 +208,13 @@
bool m_usingFallbackVideoSink { false };
bool m_renderingCanBeAccelerated { false };
+ Condition m_drawCondition;
+ Lock m_drawMutex;
+ RunLoop::Timer<MediaPlayerPrivateGStreamerBase> m_drawTimer;
+
#if USE(TEXTURE_MAPPER_GL)
RefPtr<GraphicsContext3D> m_context3D;
RefPtr<TextureMapperPlatformLayerProxy> m_platformLayerProxy;
- Condition m_drawCondition;
- Lock m_drawMutex;
- RunLoop::Timer<MediaPlayerPrivateGStreamerBase> m_drawTimer;
#endif
#if USE(GSTREAMER_GL)
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp (217823 => 217824)
--- trunk/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp 2017-06-06 08:10:39 UTC (rev 217823)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp 2017-06-06 09:01:12 UTC (rev 217824)
@@ -69,13 +69,6 @@
class VideoRenderRequestScheduler {
public:
- VideoRenderRequestScheduler()
-#if !USE(TEXTURE_MAPPER_GL)
- : m_timer(RunLoop::main(), this, &VideoRenderRequestScheduler::render)
-#endif
- {
- }
-
void start()
{
LockHolder locker(m_sampleMutex);
@@ -87,10 +80,6 @@
LockHolder locker(m_sampleMutex);
m_sample = nullptr;
m_unlocked = true;
-#if !USE(TEXTURE_MAPPER_GL)
- m_timer.stop();
- m_dataCondition.notifyOne();
-#endif
}
void drain()
@@ -109,42 +98,18 @@
if (!m_sample)
return false;
-#if USE(TEXTURE_MAPPER_GL)
auto sample = WTFMove(m_sample);
locker.unlockEarly();
if (LIKELY(GST_IS_SAMPLE(sample.get())))
webkitVideoSinkRepaintRequested(sink, sample.get());
-#else
- m_sink = sink;
- m_timer.startOneShot(0_s);
- m_dataCondition.wait(m_sampleMutex);
-#endif
+
return true;
}
private:
-
-#if !USE(TEXTURE_MAPPER_GL)
- void render()
- {
- LockHolder locker(m_sampleMutex);
- GRefPtr<GstSample> sample = WTFMove(m_sample);
- GRefPtr<WebKitVideoSink> sink = WTFMove(m_sink);
- if (sample && !m_unlocked && LIKELY(GST_IS_SAMPLE(sample.get())))
- webkitVideoSinkRepaintRequested(sink.get(), sample.get());
- m_dataCondition.notifyOne();
- }
-#endif
-
Lock m_sampleMutex;
GRefPtr<GstSample> m_sample;
-#if !USE(TEXTURE_MAPPER_GL)
- RunLoop::Timer<VideoRenderRequestScheduler> m_timer;
- Condition m_dataCondition;
- GRefPtr<WebKitVideoSink> m_sink;
-#endif
-
// If this is true all processing should finish ASAP
// This is necessary because there could be a race between
// unlock() and render(), where unlock() wins, signals the