Bug 209941 - Filter some capture device names
Summary: Filter some capture device names
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebRTC (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Eric Carlson
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-04-02 16:53 PDT by Eric Carlson
Modified: 2020-04-03 11:22 PDT (History)
9 users (show)

See Also:


Attachments
Patch (4.91 KB, patch)
2020-04-02 17:06 PDT, Eric Carlson
no flags Details | Formatted Diff | Diff
Patch for landing (4.93 KB, patch)
2020-04-03 10:31 PDT, Eric Carlson
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Carlson 2020-04-02 16:53:01 PDT
Filter some capture device names
Comment 1 Eric Carlson 2020-04-02 16:53:40 PDT
<rdar://problem/59141886>
Comment 2 Eric Carlson 2020-04-02 17:06:48 PDT
Created attachment 395327 [details]
Patch
Comment 3 youenn fablet 2020-04-03 01:29:41 PDT
Comment on attachment 395327 [details]
Patch

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

> Source/WebCore/platform/mediastream/CaptureDevice.h:50
> +        static NeverDestroyed<String> airPods(MAKE_STATIC_STRING_IMPL("AirPods"));

This seems ok to special case AirPods name, I would restrict this to Microphone DeviceType.
Maybe we should move that method to a CPP file as well.

Also we do not protect other device names.
We could sanitize all bluetooth microphone devices, by checking kAudioDevicePropertyTransportType in CoreAudioCaptureDevice.cpp.
We would then continue special casing AirPods but would rename other BT microphones to "Bluetooth Microphone" or "Bluetooth Microphone: xxx" with the first letters of the real names.
Comment 4 Eric Carlson 2020-04-03 10:31:27 PDT
Created attachment 395393 [details]
Patch for landing
Comment 5 Eric Carlson 2020-04-03 10:56:16 PDT
Comment on attachment 395327 [details]
Patch

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

>> Source/WebCore/platform/mediastream/CaptureDevice.h:50
>> +        static NeverDestroyed<String> airPods(MAKE_STATIC_STRING_IMPL("AirPods"));
> 
> This seems ok to special case AirPods name, I would restrict this to Microphone DeviceType.
> Maybe we should move that method to a CPP file as well.
> 
> Also we do not protect other device names.
> We could sanitize all bluetooth microphone devices, by checking kAudioDevicePropertyTransportType in CoreAudioCaptureDevice.cpp.
> We would then continue special casing AirPods but would rename other BT microphones to "Bluetooth Microphone" or "Bluetooth Microphone: xxx" with the first letters of the real names.

I agree that we should look at sanitizing other device names. 

I'll land this after updating to only change the name if the device is a microphone, and we can figure out a more cohesive strategy for the future.
Comment 6 EWS 2020-04-03 11:22:09 PDT
Committed r259477: <https://trac.webkit.org/changeset/259477>

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