[GStreamer][MediaStream] Use the new dispatchMediaSampleToObservers to dispatch new...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 11 Jul 2019 10:57:54 +0000 (10:57 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 11 Jul 2019 10:57:54 +0000 (10:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=199689

Patch by Thibault Saunier <tsaunier@igalia.com> on 2019-07-11
Reviewed by Philippe Normand.

We already have tests for this.

* platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp:
(WebCore::GStreamerVideoCaptureSource::processNewFrame):
(WebCore::GStreamerVideoCaptureSource::newSampleCallback):
* platform/mediastream/gstreamer/GStreamerVideoCaptureSource.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247347 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp
Source/WebCore/platform/mediastream/gstreamer/GStreamerVideoCaptureSource.h

index 37e1d6a..9e2e9a9 100644 (file)
@@ -1,3 +1,17 @@
+2019-07-11  Thibault Saunier  <tsaunier@igalia.com>
+
+        [GStreamer][MediaStream] Use the new dispatchMediaSampleToObservers to dispatch new buffers
+        https://bugs.webkit.org/show_bug.cgi?id=199689
+
+        Reviewed by Philippe Normand.
+
+        We already have tests for this.
+
+        * platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp:
+        (WebCore::GStreamerVideoCaptureSource::processNewFrame):
+        (WebCore::GStreamerVideoCaptureSource::newSampleCallback):
+        * platform/mediastream/gstreamer/GStreamerVideoCaptureSource.h:
+
 2019-07-10  Simon Fraser  <simon.fraser@apple.com>
 
         [iOS WK2] With modal overlay and body overflow:hidden, can't access all the content
index 42eb4ac..e5d9b0e 100644 (file)
@@ -160,14 +160,21 @@ void GStreamerVideoCaptureSource::startProducingData()
     m_capturer->play();
 }
 
+void GStreamerVideoCaptureSource::processNewFrame(Ref<MediaSample>&& sample)
+{
+    if (!isProducingData() || muted())
+        return;
+
+    dispatchMediaSampleToObservers(WTFMove(sample));
+}
+
 GstFlowReturn GStreamerVideoCaptureSource::newSampleCallback(GstElement* sink, GStreamerVideoCaptureSource* source)
 {
     auto gstSample = adoptGRef(gst_app_sink_pull_sample(GST_APP_SINK(sink)));
     auto mediaSample = MediaSampleGStreamer::create(WTFMove(gstSample), WebCore::FloatSize(), String());
 
-    // FIXME - Check how presentationSize is supposed to be used here.
-    callOnMainThread([protectedThis = makeRef(*source), mediaSample = WTFMove(mediaSample)] {
-        protectedThis->videoSampleAvailable(mediaSample.get());
+    source->scheduleDeferredTask([source, sample = WTFMove(mediaSample)] () mutable {
+        source->processNewFrame(WTFMove(sample));
     });
 
     return GST_FLOW_OK;
index 380611b..5f54c0b 100644 (file)
@@ -40,6 +40,7 @@ public:
     const RealtimeMediaSourceSettings& settings() override;
     GstElement* pipeline() { return m_capturer->pipeline(); }
     GStreamerCapturer* capturer() { return m_capturer.get(); }
+    void processNewFrame(Ref<MediaSample>&&);
 
 protected:
     GStreamerVideoCaptureSource(String&& deviceID, String&& name, String&& hashSalt, const gchar * source_factory);