WebKit Bugzilla
Attachment 349662 Details for
Bug 189584
: [GStreamer] WebAudio idle/silence playback improvements
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-189584-20180913160042.patch (text/plain), 4.16 KB, created by
Philippe Normand
on 2018-09-13 07:00:43 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Philippe Normand
Created:
2018-09-13 07:00:43 PDT
Size:
4.16 KB
patch
obsolete
>Subversion Revision: 235971 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 88320c4bcbd18747d145ec17242163c27b11a2b3..eaae5187d0a225af53f72ecdc28b9758ddaedcbb 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,15 @@ >+2018-09-13 Philippe Normand <pnormand@igalia.com> >+ >+ [GStreamer] WebAudio idle/silence playback improvements >+ https://bugs.webkit.org/show_bug.cgi?id=189584 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Initial patch by: Arunakiran Chennubhatla <arunakiran.chennubhatla@valuelabs.com> >+ >+ * platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp: >+ (webKitWebAudioSrcLoop): Allow idle sleep when the audio bus is silent. >+ > 2018-09-13 Xabier Rodriguez Calvar <calvaris@igalia.com> > > [GStreamer][EME] decrypt-key-needed message renamed to drm-cdm-instance-needed >diff --git a/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp b/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp >index 55cdb42cc6edd0158fc91645d40998b6682f95fc..dbbf39d39300e43577d633d02b77a5864158ba81 100644 >--- a/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp >+++ b/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp >@@ -29,6 +29,8 @@ > #include <gst/app/gstappsrc.h> > #include <gst/audio/audio-info.h> > #include <gst/pbutils/missing-plugins.h> >+#include <wtf/Seconds.h> >+#include <wtf/WallTime.h> > #include <wtf/glib/GUniquePtr.h> > > using namespace WebCore; >@@ -49,6 +51,7 @@ struct _WebKitWebAudioSrcClass { > #define WEBKIT_WEB_AUDIO_SRC_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_WEBAUDIO_SRC, WebKitWebAudioSourcePrivate)) > struct _WebKitWebAudioSourcePrivate { > gfloat sampleRate; >+ Seconds silenceStartTime; > AudioBus* bus; > AudioIOCallback* provider; > guint framesToPull; >@@ -352,6 +355,17 @@ static void webKitWebAudioSrcLoop(WebKitWebAudioSrc* src) > // FIXME: Add support for local/live audio input. > priv->provider->render(nullptr, priv->bus, priv->framesToPull); > >+ if (priv->bus->isSilent()) { >+ priv->numberOfSamples -= priv->framesToPull; >+ if (!priv->silenceStartTime.value()) >+ priv->silenceStartTime = WTF::WallTime::now().secondsSinceEpoch(); >+ } else if (priv->silenceStartTime) { >+ auto delta = WTF::WallTime::now().secondsSinceEpoch() - priv->silenceStartTime; >+ priv->numberOfSamples += delta.seconds() * priv->sampleRate; >+ priv->silenceStartTime = WTF::Seconds::nan(); >+ } >+ >+ GstFlowReturn ret = GST_FLOW_OK; > ASSERT(channelBufferList.size() == priv->sources.size()); > bool failed = false; > for (unsigned i = 0; i < priv->sources.size(); ++i) { >@@ -366,15 +380,20 @@ static void webKitWebAudioSrcLoop(WebKitWebAudioSrc* src) > continue; > > auto& appsrc = priv->sources[i]; >- // Leak the buffer ref, because gst_app_src_push_buffer steals it. >- GstFlowReturn ret = gst_app_src_push_buffer(GST_APP_SRC(appsrc.get()), buffer.leakRef()); >- if (ret != GST_FLOW_OK) { >- // FLUSHING and EOS are not errors. >- if (ret < GST_FLOW_EOS || ret == GST_FLOW_NOT_LINKED) >- GST_ELEMENT_ERROR(src, CORE, PAD, ("Internal WebAudioSrc error"), ("Failed to push buffer on %s flow: %s", GST_OBJECT_NAME(appsrc.get()), gst_flow_get_name(ret))); >- gst_task_stop(src->priv->task.get()); >- failed = true; >- } >+ >+ if ((ret == GST_FLOW_OK) && (!priv->bus->isSilent())) { >+ >+ // Leak the buffer ref, because gst_app_src_push_buffer steals it. >+ ret = gst_app_src_push_buffer(GST_APP_SRC(appsrc.get()), buffer.leakRef()); >+ if (ret != GST_FLOW_OK) { >+ // FLUSHING and EOS are not errors. >+ if (ret < GST_FLOW_EOS || ret == GST_FLOW_NOT_LINKED) >+ GST_ELEMENT_ERROR(src, CORE, PAD, ("Internal WebAudioSrc error"), ("Failed to push buffer on %s flow: %s", GST_OBJECT_NAME(appsrc.get()), gst_flow_get_name(ret))); >+ gst_task_stop(src->priv->task.get()); >+ failed = true; >+ } >+ } else >+ g_usleep(1000); > } > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
ews-watchlist
:
commit-queue-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 189584
: 349662 |
349674