Bug 211980 - [GStreamer][MediaStream] Remove orphaned tracks in updateTracks()
Summary: [GStreamer][MediaStream] Remove orphaned tracks in updateTracks()
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alicia Boya García
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-16 03:01 PDT by Alicia Boya García
Modified: 2020-05-18 02:09 PDT (History)
13 users (show)

See Also:


Attachments
Patch (6.58 KB, patch)
2020-05-16 05:26 PDT, Alicia Boya García
no flags Details | Formatted Diff | Diff
Patch (6.63 KB, patch)
2020-05-16 09:17 PDT, Alicia Boya García
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alicia Boya García 2020-05-16 03:01:25 PDT
This patch ensures tracks missing from a subsequent updateTracks()
calls are removed from the player.

This fixes the following tests regressed by the track switch rework:

imported/w3c/web-platform-tests/mediacapture-streams/MediaStream-removetrack.https.html
imported/w3c/web-platform-tests/mediacapture-streams/MediaStreamTrack-applyConstraints.https.html
Comment 1 Alicia Boya García 2020-05-16 05:26:31 PDT
Created attachment 399548 [details]
Patch
Comment 2 Alicia Boya García 2020-05-16 09:17:18 PDT
Created attachment 399555 [details]
Patch
Comment 3 Philippe Normand 2020-05-18 01:15:46 PDT
Comment on attachment 399555 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=399555&action=review

> Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1512
> +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;
> +}

Would this be worth moving to HashMap as a new method?
Comment 4 Alicia Boya García 2020-05-18 01:52:04 PDT
Comment on attachment 399555 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=399555&action=review

>> Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1512
>> +}
> 
> Would this be worth moving to HashMap as a new method?

I don't know, all HashMap methods are pretty basic, so maybe someone would oppose this in WTF, or maybe a function already exists and I just didn't find it. I wanted a self-contained fix that didn't need a potentially stalling WTF review, so this was a reasonable solution.

I've asked in the WebKit slack, if it turns out there was an existing function or there wasn't but people really want it in WTF another patch can be made that moves it there. For now I'm using this.
Comment 5 EWS 2020-05-18 02:09:34 PDT
Committed r261803: <https://trac.webkit.org/changeset/261803>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 399555 [details].