• Andy Paicu's avatar
    Immediately stop media streams if users revokes consent · 4e31d46a
    Andy Paicu authored
    Since camera and microphone are particularly sensitive permissions we
    should be viligent and stop streams immediately when the user revokes
    the permission.
    
    This CL uses the permission controller subscription functionality to
    listen to permission changes on the relevant origins. Each DeviceRequest
    will have up to 2 permission subscriptions (1 audio, 1 video). When
    a permission is changed to non-Granted the specific DeviceRequest is
    canceled. Subscriptions are removed when the DeviceRequest is deleted.
    
    Because MediaStreamManager is an IO thread class but
    PermissionController is a UI thread class, this CL has to do a bit of
    thread hoping:
    
    FinalizeStream(IO) > SubscribeToPermissionControllerOnUIThread(UI) >
    SetPermissionSubscriptionIDs(IO) >(maybe)>
    UnsubscribeFromPermissionControllerOnUIThread(UI)
    
    DeleteRequest(IO) > UnsubscribeFromPermissionControllerOnUIThread(UI)
    
    Bug: 1116435
    
    Change-Id: I6649125e028d607eeb7ba5701b710a715addf6f2
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2352790
    Commit-Queue: Andy Paicu <andypaicu@chromium.org>
    Reviewed-by: default avatarGuido Urdaneta <guidou@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#798564}
    4e31d46a
webrtc_browsertest_base.h 11.1 KB