Title: [247347] trunk/Source/WebCore
Revision
247347
Author
commit-qu...@webkit.org
Date
2019-07-11 03:57:54 -0700 (Thu, 11 Jul 2019)

Log Message

[GStreamer][MediaStream] Use the new dispatchMediaSampleToObservers to dispatch new buffers
https://bugs.webkit.org/show_bug.cgi?id=199689

Patch by Thibault Saunier <tsaun...@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:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (247346 => 247347)


--- trunk/Source/WebCore/ChangeLog	2019-07-11 09:42:22 UTC (rev 247346)
+++ trunk/Source/WebCore/ChangeLog	2019-07-11 10:57:54 UTC (rev 247347)
@@ -1,3 +1,17 @@
+2019-07-11  Thibault Saunier  <tsaun...@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.fra...@apple.com>
 
         [iOS WK2] With modal overlay and body overflow:hidden, can't access all the content

Modified: trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp (247346 => 247347)


--- trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp	2019-07-11 09:42:22 UTC (rev 247346)
+++ trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp	2019-07-11 10:57:54 UTC (rev 247347)
@@ -160,14 +160,21 @@
     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;

Modified: trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerVideoCaptureSource.h (247346 => 247347)


--- trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerVideoCaptureSource.h	2019-07-11 09:42:22 UTC (rev 247346)
+++ trunk/Source/WebCore/platform/mediastream/gstreamer/GStreamerVideoCaptureSource.h	2019-07-11 10:57:54 UTC (rev 247347)
@@ -40,6 +40,7 @@
     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);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to