Modified: trunk/Source/WebCore/ChangeLog (281134 => 281135)
--- trunk/Source/WebCore/ChangeLog 2021-08-17 13:09:28 UTC (rev 281134)
+++ trunk/Source/WebCore/ChangeLog 2021-08-17 13:47:41 UTC (rev 281135)
@@ -1,3 +1,17 @@
+2021-08-17 Philippe Normand <[email protected]>
+
+ REGRESSION(r218083): [GStreamer] webrtc unexpected failures
+ https://bugs.webkit.org/show_bug.cgi?id=229187
+
+ Reviewed by Xabier Rodriguez-Calvar.
+
+ The stream-collection messages actually don't need to be handled synchronously in the
+ mediastream cases. The limitations of the MSE backend do not apply there.
+
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+ (WebCore::MediaPlayerPrivateGStreamer::handleStreamCollectionMessage):
+ (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
+
2021-08-17 Jean-Yves Avenard <[email protected]>
Implement API to ensure MediaRemote key mapping is correct
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp (281134 => 281135)
--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp 2021-08-17 13:09:28 UTC (rev 281134)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp 2021-08-17 13:47:41 UTC (rev 281135)
@@ -1506,12 +1506,11 @@
if (m_isLegacyPlaybin)
return;
- // GStreamer workaround:
- // Unfortunately, when we have a stream-collection aware source (like WebKitMediaSrc or
- // MediaStreamSource) parsebin and decodebin3 emit their own stream-collection messages, but
- // late, and sometimes with duplicated streams. Let's only listen for stream-collection messages
- // from the source to avoid these issues.
- if (GST_MESSAGE_SRC(message) != GST_OBJECT(m_source.get())) {
+ // GStreamer workaround: Unfortunately, when we have a stream-collection aware source (like
+ // WebKitMediaSrc) parsebin and decodebin3 emit their own stream-collection messages, but late,
+ // and sometimes with duplicated streams. Let's only listen for stream-collection messages from
+ // the source to avoid these issues.
+ if (isMediaSource() && GST_MESSAGE_SRC(message) != GST_OBJECT(m_source.get())) {
GST_DEBUG_OBJECT(pipeline(), "Ignoring redundant STREAM_COLLECTION from %" GST_PTR_FORMAT, message->src);
return;
}
@@ -1519,8 +1518,11 @@
ASSERT(GST_MESSAGE_TYPE(message) == GST_MESSAGE_STREAM_COLLECTION);
GRefPtr<GstStreamCollection> collection;
gst_message_parse_stream_collection(message, &collection.outPtr());
+ if (!collection)
+ return;
+
#ifndef GST_DISABLE_DEBUG
- GST_DEBUG_OBJECT(pipeline(), "Received STREAM_COLLECTION message with upstream id \"%s\" defining the following streams:", gst_stream_collection_get_upstream_id(collection.get()));
+ GST_DEBUG_OBJECT(pipeline(), "Received STREAM_COLLECTION message with upstream id \"%s\" from %" GST_PTR_FORMAT " defining the following streams:", gst_stream_collection_get_upstream_id(collection.get()), GST_MESSAGE_SRC(message));
unsigned numStreams = gst_stream_collection_get_size(collection.get());
for (unsigned i = 0; i < numStreams; i++) {
GstStream* stream = gst_stream_collection_get_stream(collection.get(), i);
@@ -1528,13 +1530,15 @@
}
#endif
- if (!collection)
- return;
-
- callOnMainThreadAndWait([player = makeWeakPtr(*this), collection = WTFMove(collection)] {
+ auto callback = [player = makeWeakPtr(*this), collection = WTFMove(collection)] {
if (player)
player->updateTracks(collection);
- });
+ };
+
+ if (isMediaSource())
+ callOnMainThreadAndWait(WTFMove(callback));
+ else
+ callOnMainThread(WTFMove(callback));
}
bool MediaPlayerPrivateGStreamer::handleNeedContextMessage(GstMessage* message)
@@ -2682,10 +2686,14 @@
g_signal_connect_swapped(bus.get(), "sync-message::need-context", G_CALLBACK(+[](MediaPlayerPrivateGStreamer* player, GstMessage* message) {
player->handleNeedContextMessage(message);
}), this);
- // In the MSE case stream collection messages are emitted from the main thread right before the initilization segment
- // is parsed and "updateend" is fired. We need therefore to handle these synchronously in the same main thread tick
- // to make the tracks information available to JS no later than "updateend".
- g_signal_connect_swapped(bus.get(), "sync-message::stream-collection", G_CALLBACK(+[](MediaPlayerPrivateGStreamer* player, GstMessage* message) {
+
+ // In the MSE case stream collection messages are emitted from the main thread right before the
+ // initilization segment is parsed and "updateend" is fired. We need therefore to handle these
+ // synchronously in the same main thread tick to make the tracks information available to JS no
+ // later than "updateend". There is no such limitation otherwise (if playbin3 is enabled or in
+ // MediaStream cases).
+ auto streamCollectionSignalName = makeString(isMediaSource() ? "sync-" : "", "message::stream-collection");
+ g_signal_connect_swapped(bus.get(), streamCollectionSignalName.ascii().data(), G_CALLBACK(+[](MediaPlayerPrivateGStreamer* player, GstMessage* message) {
player->handleStreamCollectionMessage(message);
}), this);