Bug 211509

Summary: Video capture does not get unmuted in case of tab switch on iOS
Product: WebKit Reporter: youenn fablet <youennf>
Component: WebRTCAssignee: youenn fablet <youennf>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, eric.carlson, esprehn+autocc, ews-watchlist, glenn, hta, jer.noble, kangil.han, philipj, sergio, tommyw, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=237359
Attachments:
Description Flags
Patch
none
Patch
none
Patch for landing
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch for landing
none
Patch for landing none

Description youenn fablet 2020-05-06 06:23:46 PDT
Video capture does not get unmuted in case of tab switch on iOS.
This is probably a fall out of https://bugs.webkit.org/show_bug.cgi?id=208516.
Comment 1 youenn fablet 2020-05-06 08:03:13 PDT
Created attachment 398615 [details]
Patch
Comment 2 youenn fablet 2020-05-06 08:31:46 PDT
Created attachment 398620 [details]
Patch
Comment 3 Eric Carlson 2020-05-06 10:00:26 PDT
Comment on attachment 398620 [details]
Patch

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

> Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp:451
> +static bool isSourceCapturingForDocument(RealtimeMediaSource& activeSource, Document& document)

This name is slightly unclear about how it works. Maybe something like `isCapturingFromSameSourceAndDocument` or `isCapturingFromSourceAndDocument`?

> Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp:464
> +void MediaStreamTrack::updateAccordingMutedState()

Nit: this name is also slightly unclear about what the method does. Maybe something like `syncToPageMutedState`, or `updateToPageMutedState`?

> Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp:495
> +        bool muted = page->mutedState() & MediaProducer::AudioAndVideoCaptureIsMuted;

s/muted/pageMuted/

> Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp:501
> +        bool muted = page->mutedState() & MediaProducer::AudioAndVideoCaptureIsMuted;

Ditto.
Comment 4 youenn fablet 2020-05-06 10:21:25 PDT
Created attachment 398633 [details]
Patch for landing
Comment 5 youenn fablet 2020-05-06 10:31:34 PDT
(In reply to youenn fablet from comment #4)
> Created attachment 398633 [details]
> Patch for landing

Wrong bug
Comment 6 youenn fablet 2020-05-06 10:37:53 PDT
iOS test is failing as the ability to allow multiple cloned tracks breaks the ability to mute/unmute the active source.

I plan to temporarily disable this GPU process test and reenable it later on.
The tricky thing about fixing this test is that we do not want to resize video frames in WebProcess, so we cannot use RealtimeVideoSource/RealtimeVideoCaptureSource here.
Comment 7 youenn fablet 2020-05-07 01:23:23 PDT
<rdar://problem/62537166>
Comment 8 youenn fablet 2020-05-07 01:30:23 PDT
(In reply to Eric Carlson from comment #3)
> Comment on attachment 398620 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=398620&action=review
> 
> > Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp:451
> > +static bool isSourceCapturingForDocument(RealtimeMediaSource& activeSource, Document& document)
> 
> This name is slightly unclear about how it works. Maybe something like
> `isCapturingFromSameSourceAndDocument` or `isCapturingFromSourceAndDocument`?

I prefer the current name, we want to know whether the source is used by a track of the given document.

> > Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp:464
> > +void MediaStreamTrack::updateAccordingMutedState()
> 
> Nit: this name is also slightly unclear about what the method does. Maybe
> something like `syncToPageMutedState`, or `updateToPageMutedState`?

I'll go with updateToPageMutedState

> > Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp:495
> > +        bool muted = page->mutedState() & MediaProducer::AudioAndVideoCaptureIsMuted;
> 
> s/muted/pageMuted/

OK

> > Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp:501
> > +        bool muted = page->mutedState() & MediaProducer::AudioAndVideoCaptureIsMuted;
> 
> Ditto.

OK
Comment 9 youenn fablet 2020-05-07 01:54:45 PDT
Created attachment 398713 [details]
Patch
Comment 10 youenn fablet 2020-05-07 01:57:45 PDT
Created attachment 398715 [details]
Patch
Comment 11 youenn fablet 2020-05-07 02:00:52 PDT
Created attachment 398716 [details]
Patch
Comment 12 youenn fablet 2020-05-07 04:19:48 PDT
Created attachment 398720 [details]
Patch
Comment 13 Eric Carlson 2020-05-07 08:15:35 PDT
Comment on attachment 398620 [details]
Patch

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

>>> Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp:451
>>> +static bool isSourceCapturingForDocument(RealtimeMediaSource& activeSource, Document& document)
>> 
>> This name is slightly unclear about how it works. Maybe something like `isCapturingFromSameSourceAndDocument` or `isCapturingFromSourceAndDocument`?
> 
> I prefer the current name, we want to know whether the source is used by a track of the given document.

`isSourceCapturingForTrackInDocument`?
Comment 14 youenn fablet 2020-05-07 08:33:15 PDT
(In reply to Eric Carlson from comment #13)
> Comment on attachment 398620 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=398620&action=review
> 
> >>> Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp:451
> >>> +static bool isSourceCapturingForDocument(RealtimeMediaSource& activeSource, Document& document)
> >> 
> >> This name is slightly unclear about how it works. Maybe something like `isCapturingFromSameSourceAndDocument` or `isCapturingFromSourceAndDocument`?
> > 
> > I prefer the current name, we want to know whether the source is used by a track of the given document.
> 
> `isSourceCapturingForTrackInDocument`?

OK, sounds good
Comment 15 youenn fablet 2020-05-08 02:25:21 PDT
Created attachment 398843 [details]
Patch for landing
Comment 16 EWS 2020-05-08 02:26:58 PDT
ChangeLog entry in Source/WebKit/ChangeLog is not at the top of the file.
Comment 17 youenn fablet 2020-05-08 03:29:16 PDT
Created attachment 398852 [details]
Patch for landing
Comment 18 EWS 2020-05-08 03:54:11 PDT
Committed r261373: <https://trac.webkit.org/changeset/261373>

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