Bug 209941

Summary: Filter some capture device names
Product: WebKit Reporter: Eric Carlson <eric.carlson>
Component: WebRTCAssignee: Eric Carlson <eric.carlson>
Status: RESOLVED FIXED    
Severity: Normal CC: ews-watchlist, glenn, hta, jer.noble, philipj, sergio, tommyw, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: Other   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch for landing none

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].