Title: [266109] trunk/Source/WebCore
- Revision
- 266109
- Author
- [email protected]
- Date
- 2020-08-25 01:13:20 -0700 (Tue, 25 Aug 2020)
Log Message
[GStreamer][WebAudio] Fill in output timestamps
https://bugs.webkit.org/show_bug.cgi?id=215703
Reviewed by Xabier Rodriguez-Calvar.
Set the output timestamp as the buffer PTS. The monotonic timestamp is retrieved using the
corresponding GLib API, offset'ed by the pipeline clock time (which always starts at 0).
* platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:
(webKitWebAudioSrcAllocateBuffersAndRenderAudio):
* platform/graphics/gstreamer/GRefPtrGStreamer.cpp:
(WTF::adoptGRef):
(WTF::refGPtr<GstClock>):
(WTF::derefGPtr<GstClock>):
* platform/graphics/gstreamer/GRefPtrGStreamer.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (266108 => 266109)
--- trunk/Source/WebCore/ChangeLog 2020-08-25 08:11:32 UTC (rev 266108)
+++ trunk/Source/WebCore/ChangeLog 2020-08-25 08:13:20 UTC (rev 266109)
@@ -1,3 +1,21 @@
+2020-08-25 Philippe Normand <[email protected]>
+
+ [GStreamer][WebAudio] Fill in output timestamps
+ https://bugs.webkit.org/show_bug.cgi?id=215703
+
+ Reviewed by Xabier Rodriguez-Calvar.
+
+ Set the output timestamp as the buffer PTS. The monotonic timestamp is retrieved using the
+ corresponding GLib API, offset'ed by the pipeline clock time (which always starts at 0).
+
+ * platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:
+ (webKitWebAudioSrcAllocateBuffersAndRenderAudio):
+ * platform/graphics/gstreamer/GRefPtrGStreamer.cpp:
+ (WTF::adoptGRef):
+ (WTF::refGPtr<GstClock>):
+ (WTF::derefGPtr<GstClock>):
+ * platform/graphics/gstreamer/GRefPtrGStreamer.h:
+
2020-08-25 Carlos Garcia Campos <[email protected]>
Unreviewed. Fix GTK/WPE build after r266103
Modified: trunk/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp (266108 => 266109)
--- trunk/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp 2020-08-25 08:11:32 UTC (rev 266108)
+++ trunk/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp 2020-08-25 08:13:20 UTC (rev 266109)
@@ -349,8 +349,15 @@
channelBufferList.uncheckedAppend(WTFMove(buffer));
}
+ auto clock = adoptGRef(gst_element_get_clock(GST_ELEMENT_CAST(src)));
+ auto clockTime = gst_clock_get_time(clock.get());
+ auto outputTimestamp = AudioIOPosition {
+ Seconds::fromNanoseconds(timestamp),
+ MonotonicTime::fromRawSeconds(static_cast<double>((g_get_monotonic_time() + GST_TIME_AS_USECONDS(clockTime)) / 1000000.0))
+ };
+
// FIXME: Add support for local/live audio input.
- priv->provider->render(nullptr, priv->bus, priv->framesToPull, { });
+ priv->provider->render(nullptr, priv->bus, priv->framesToPull, outputTimestamp);
return makeOptional(channelBufferList);
}
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.cpp (266108 => 266109)
--- trunk/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.cpp 2020-08-25 08:11:32 UTC (rev 266108)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.cpp 2020-08-25 08:13:20 UTC (rev 266109)
@@ -416,6 +416,28 @@
gst_object_unref(ptr);
}
+template <>
+GRefPtr<GstClock> adoptGRef(GstClock* ptr)
+{
+ return GRefPtr<GstClock>(ptr, GRefPtrAdopt);
+}
+
+template <>
+GstClock* refGPtr<GstClock>(GstClock* ptr)
+{
+ if (ptr)
+ gst_object_ref(GST_OBJECT_CAST(ptr));
+
+ return ptr;
+}
+
+template <>
+void derefGPtr<GstClock>(GstClock* ptr)
+{
+ if (ptr)
+ gst_object_unref(ptr);
+}
+
template <> GRefPtr<WebKitVideoSink> adoptGRef(WebKitVideoSink* ptr)
{
ASSERT(!ptr || !g_object_is_floating(ptr));
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.h (266108 => 266109)
--- trunk/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.h 2020-08-25 08:11:32 UTC (rev 266108)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.h 2020-08-25 08:13:20 UTC (rev 266109)
@@ -124,6 +124,10 @@
template<> GstStreamCollection* refGPtr<GstStreamCollection>(GstStreamCollection*);
template<> void derefGPtr<GstStreamCollection>(GstStreamCollection*);
+template<> GRefPtr<GstClock> adoptGRef(GstClock*);
+template<> GstClock* refGPtr<GstClock>(GstClock*);
+template<> void derefGPtr<GstClock>(GstClock*);
+
#if USE(GSTREAMER_GL)
template<> GRefPtr<GstGLDisplay> adoptGRef(GstGLDisplay* ptr);
template<> GstGLDisplay* refGPtr<GstGLDisplay>(GstGLDisplay* ptr);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes