Bug 211509 - Video capture does not get unmuted in case of tab switch on iOS
Summary: Video capture does not get unmuted in case of tab switch on iOS
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebRTC (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: youenn fablet
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-05-06 06:23 PDT by youenn fablet
Modified: 2022-03-10 13:08 PST (History)
13 users (show)

See Also:


Attachments
Patch (21.42 KB, patch)
2020-05-06 08:03 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch (22.74 KB, patch)
2020-05-06 08:31 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch for landing (26.20 KB, patch)
2020-05-06 10:21 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch (29.15 KB, patch)
2020-05-07 01:54 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch (29.95 KB, patch)
2020-05-07 01:57 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch (30.07 KB, patch)
2020-05-07 02:00 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch (29.73 KB, patch)
2020-05-07 04:19 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch for landing (30.04 KB, patch)
2020-05-08 02:25 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch for landing (29.61 KB, patch)
2020-05-08 03:29 PDT, youenn fablet
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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].