Title: [261803] trunk
- Revision
- 261803
- Author
- ab...@igalia.com
- Date
- 2020-05-18 02:09:29 -0700 (Mon, 18 May 2020)
Log Message
Source/WebCore:
[GStreamer][MediaSource] Remove orphaned tracks in updateTracks()
https://bugs.webkit.org/show_bug.cgi?id=211980
Reviewed by Xabier Rodriguez-Calvar.
This patch ensures tracks missing from a subsequent updateTracks()
calls are removed from the player.
This fixes regressions on the following tests caused on r261683.
imported/w3c/web-platform-tests/mediacapture-streams/MediaStream-removetrack.https.html
imported/w3c/web-platform-tests/mediacapture-streams/MediaStreamTrack-applyConstraints.https.html
* platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::hashSetFromHashMapKeys):
(WebCore::MediaPlayerPrivateGStreamer::updateTracks):
LayoutTests:
[GStreamer] Remove orphaned tracks in updateTracks()
https://bugs.webkit.org/show_bug.cgi?id=211980
Reviewed by Xabier Rodriguez-Calvar.
Updated test expectations.
* platform/gtk/TestExpectations:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (261802 => 261803)
--- trunk/LayoutTests/ChangeLog 2020-05-18 08:37:39 UTC (rev 261802)
+++ trunk/LayoutTests/ChangeLog 2020-05-18 09:09:29 UTC (rev 261803)
@@ -1,3 +1,14 @@
+2020-05-18 Alicia Boya García <ab...@igalia.com>
+
+ [GStreamer] Remove orphaned tracks in updateTracks()
+ https://bugs.webkit.org/show_bug.cgi?id=211980
+
+ Reviewed by Xabier Rodriguez-Calvar.
+
+ Updated test expectations.
+
+ * platform/gtk/TestExpectations:
+
2020-05-18 Zan Dobersek <zdober...@igalia.com>
Unreviewed WPE gardening. Providing custom baselines for tests
Modified: trunk/LayoutTests/platform/gtk/TestExpectations (261802 => 261803)
--- trunk/LayoutTests/platform/gtk/TestExpectations 2020-05-18 08:37:39 UTC (rev 261802)
+++ trunk/LayoutTests/platform/gtk/TestExpectations 2020-05-18 09:09:29 UTC (rev 261803)
@@ -1243,7 +1243,7 @@
webkit.org/b/206655 inspector/page/overrideSetting-MockCaptureDevicesEnabled.html [ Failure ]
-webkit.org/b/206656 imported/w3c/web-platform-tests/mediacapture-streams/MediaStream-removetrack.https.html [ Failure Crash Timeout ]
+webkit.org/b/206656 imported/w3c/web-platform-tests/mediacapture-streams/MediaStream-removetrack.https.html [ Failure Crash ]
webkit.org/b/206656 imported/w3c/web-platform-tests/mediacapture-streams/MediaStreamTrack-MediaElement-disabled-video-is-black.https.html [ Failure ]
webkit.org/b/206656 imported/w3c/web-platform-tests/mediacapture-streams/MediaStream-MediaElement-preload-none-manual.https.html [ Crash Failure Pass ]
@@ -2898,8 +2898,6 @@
webkit.org/b/211836 imported/w3c/web-platform-tests/fetch/api/abort/general.any.worker.html [ Failure Pass ]
-webkit.org/b/211946 imported/w3c/web-platform-tests/mediacapture-streams/MediaStreamTrack-applyConstraints.https.html [ Pass Crash ]
-
webkit.org/b/211948 webanimations/accelerated-animation-playback-rate.html [ ImageOnlyFailure Timeout Pass ]
webkit.org/b/211166 webrtc/disable-encryption.html [ Crash Pass ]
Modified: trunk/Source/WebCore/ChangeLog (261802 => 261803)
--- trunk/Source/WebCore/ChangeLog 2020-05-18 08:37:39 UTC (rev 261802)
+++ trunk/Source/WebCore/ChangeLog 2020-05-18 09:09:29 UTC (rev 261803)
@@ -1,3 +1,22 @@
+2020-05-18 Alicia Boya García <ab...@igalia.com>
+
+ [GStreamer][MediaSource] Remove orphaned tracks in updateTracks()
+ https://bugs.webkit.org/show_bug.cgi?id=211980
+
+ Reviewed by Xabier Rodriguez-Calvar.
+
+ This patch ensures tracks missing from a subsequent updateTracks()
+ calls are removed from the player.
+
+ This fixes regressions on the following tests caused on r261683.
+
+ imported/w3c/web-platform-tests/mediacapture-streams/MediaStream-removetrack.https.html
+ imported/w3c/web-platform-tests/mediacapture-streams/MediaStreamTrack-applyConstraints.https.html
+
+ * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
+ (WebCore::hashSetFromHashMapKeys):
+ (WebCore::MediaPlayerPrivateGStreamer::updateTracks):
+
2020-05-18 Carlos Garcia Campos <cgar...@igalia.com>
[GTK] "ASSERTION FAILED: !m_adoptionIsRequired" when double clicking on a word
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp (261802 => 261803)
--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp 2020-05-18 08:37:39 UTC (rev 261802)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp 2020-05-18 09:09:29 UTC (rev 261803)
@@ -115,11 +115,6 @@
m_player->add##Type##Track(*track); \
} \
} G_STMT_END
-
-#define CLEAR_TRACKS(tracks, method) \
- for (auto& track : tracks.values())\
- method(*track);\
- tracks.clear();
#else
#define CREATE_TRACK(type, Type) G_STMT_START { \
m_has##Type## = true; \
@@ -1507,6 +1502,15 @@
g_list_free_full(streams, reinterpret_cast<GDestroyNotify>(g_free));
}
+template<typename K, typename V>
+HashSet<K> hashSetFromHashMapKeys(const HashMap<K, V>& hashMap)
+{
+ HashSet<K> keys;
+ for (auto& key : hashMap.keys())
+ keys.add(key);
+ return keys;
+}
+
void MediaPlayerPrivateGStreamer::updateTracks(GRefPtr<GstStreamCollection>&& streamCollection)
{
ASSERT(!m_isLegacyPlaybin);
@@ -1522,11 +1526,18 @@
unsigned audioTrackIndex = 0;
unsigned videoTrackIndex = 0;
unsigned textTrackIndex = 0;
+ HashSet<AtomString> orphanedAudioTrackIds = hashSetFromHashMapKeys(m_audioTracks);
+ HashSet<AtomString> orphanedVideoTrackIds = hashSetFromHashMapKeys(m_videoTracks);
+ HashSet<AtomString> orphanedTextTrackIds = hashSetFromHashMapKeys(m_textTracks);
for (unsigned i = 0; i < length; i++) {
GRefPtr<GstStream> stream = gst_stream_collection_get_stream(streamCollection.get(), i);
String streamId(gst_stream_get_stream_id(stream.get()));
GstStreamType type = gst_stream_get_stream_type(stream.get());
+ orphanedAudioTrackIds.remove(streamId);
+ orphanedVideoTrackIds.remove(streamId);
+ orphanedTextTrackIds.remove(streamId);
+
GST_DEBUG_OBJECT(pipeline(), "Inspecting %s track with ID %s", gst_stream_type_get_name(type), streamId.utf8().data());
if ((type & GST_STREAM_TYPE_AUDIO && m_audioTracks.contains(streamId)) || (type & GST_STREAM_TYPE_VIDEO && m_videoTracks.contains(streamId))
|| (type & GST_STREAM_TYPE_TEXT && m_textTracks.contains(streamId)))
@@ -1549,6 +1560,17 @@
GST_WARNING("Unknown track type found for stream %s", streamId.utf8().data());
}
+#define REMOVE_ORPHANED_TRACKS(type, Type) \
+ for (auto& trackId : orphaned##Type##TrackIds) { \
+ auto iter = m_##type##Tracks.find(trackId); \
+ m_player->remove##Type##Track(*iter->value); \
+ m_##type##Tracks.remove(iter->key); \
+ }
+
+ REMOVE_ORPHANED_TRACKS(audio, Audio);
+ REMOVE_ORPHANED_TRACKS(video, Video);
+ REMOVE_ORPHANED_TRACKS(text, Text);
+
if (oldHasVideo != m_hasVideo || oldHasAudio != m_hasAudio)
m_player->characteristicChanged();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes