Title: [275149] trunk/Source/WebCore
- Revision
- 275149
- Author
- [email protected]
- Date
- 2021-03-28 10:46:26 -0700 (Sun, 28 Mar 2021)
Log Message
REGRESSION(r274527): [GStreamer] media/webaudio-background-playback.html now failing
https://bugs.webkit.org/show_bug.cgi?id=223840
Patch by Philippe Normand <[email protected]> on 2021-03-28
Reviewed by Chris Dumez.
r274527 actually exposed a bug that was present since r271197. The AudioDestination pipeline
was not stopping properly because webkitGstSetElementStateSynchronously() was returning too
early.
This patch also includes a few improvements in the webaudiosrc element, most notably
regarding its preroll state. The element now stops emitting buffers downstream as soon as
the AudioDestination is scheduled to stop.
* platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:
(webKitWebAudioSrcRenderAndPushFrames): Return early as soon as the destination is scheduled to stop.
(webKitWebAudioSrcChangeState): Synchronize preroll state with element state.
* platform/graphics/gstreamer/GStreamerCommon.cpp:
(WebCore::webkitGstSetElementStateSynchronously): targetState might be lower than current
state, e.g, when stopping a running pipeline, so we can't return early for those cases,
otherwise the pipeline won't stop.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (275148 => 275149)
--- trunk/Source/WebCore/ChangeLog 2021-03-28 17:40:24 UTC (rev 275148)
+++ trunk/Source/WebCore/ChangeLog 2021-03-28 17:46:26 UTC (rev 275149)
@@ -1,3 +1,26 @@
+2021-03-28 Philippe Normand <[email protected]>
+
+ REGRESSION(r274527): [GStreamer] media/webaudio-background-playback.html now failing
+ https://bugs.webkit.org/show_bug.cgi?id=223840
+
+ Reviewed by Chris Dumez.
+
+ r274527 actually exposed a bug that was present since r271197. The AudioDestination pipeline
+ was not stopping properly because webkitGstSetElementStateSynchronously() was returning too
+ early.
+
+ This patch also includes a few improvements in the webaudiosrc element, most notably
+ regarding its preroll state. The element now stops emitting buffers downstream as soon as
+ the AudioDestination is scheduled to stop.
+
+ * platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:
+ (webKitWebAudioSrcRenderAndPushFrames): Return early as soon as the destination is scheduled to stop.
+ (webKitWebAudioSrcChangeState): Synchronize preroll state with element state.
+ * platform/graphics/gstreamer/GStreamerCommon.cpp:
+ (WebCore::webkitGstSetElementStateSynchronously): targetState might be lower than current
+ state, e.g, when stopping a running pipeline, so we can't return early for those cases,
+ otherwise the pipeline won't stop.
+
2021-03-28 Chris Dumez <[email protected]>
Unreviewed, add an exception for a heap allocation on the WebAudio thread.
Modified: trunk/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp (275148 => 275149)
--- trunk/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp 2021-03-28 17:40:24 UTC (rev 275148)
+++ trunk/Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp 2021-03-28 17:46:26 UTC (rev 275149)
@@ -33,6 +33,7 @@
#include <gst/pbutils/missing-plugins.h>
#include <wtf/Condition.h>
#include <wtf/Lock.h>
+#include <wtf/Scope.h>
#include <wtf/glib/GUniquePtr.h>
#include <wtf/glib/WTFGType.h>
@@ -337,6 +338,16 @@
auto* src = ""
auto* priv = src->priv;
+ auto notifyDispatchOnExit = makeScopeExit([priv] {
+ LockHolder lock(priv->dispatchLock);
+ priv->dispatchDone = true;
+ priv->dispatchCondition.notifyOne();
+ });
+
+ GST_TRACE_OBJECT(element.get(), "Playing: %d", priv->destination->isPlaying());
+ if (priv->hasRenderedAudibleFrame && !priv->destination->isPlaying())
+ return;
+
ASSERT(channelBufferList.size() == priv->sources.size());
GstClockTime timestamp = gst_util_uint64_scale(priv->numberOfSamples, GST_SECOND, priv->sampleRate);
@@ -381,12 +392,6 @@
failed = true;
}
}
-
- {
- LockHolder lock(priv->dispatchLock);
- priv->dispatchDone = true;
- priv->dispatchCondition.notifyOne();
- }
}
static void webKitWebAudioSrcRenderIteration(WebKitWebAudioSrc* src)
@@ -473,6 +478,7 @@
gst_buffer_pool_set_active(priv->pool.get(), FALSE);
priv->pool = nullptr;
+ priv->hasRenderedAudibleFrame = false;
break;
default:
break;
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp (275148 => 275149)
--- trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp 2021-03-28 17:40:24 UTC (rev 275148)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp 2021-03-28 17:46:26 UTC (rev 275149)
@@ -468,7 +468,7 @@
GstState currentState;
auto result = gst_element_get_state(pipeline, ¤tState, nullptr, 10);
- if (result == GST_STATE_CHANGE_SUCCESS && currentState >= targetState) {
+ if (result == GST_STATE_CHANGE_SUCCESS && currentState == targetState) {
GST_DEBUG_OBJECT(pipeline, "Target state already reached");
return true;
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes