WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
229327
Prevent AudioSession category from moving out of PlayAndRecord too quickly
https://bugs.webkit.org/show_bug.cgi?id=229327
Summary
Prevent AudioSession category from moving out of PlayAndRecord too quickly
youenn fablet
Reported
2021-08-20 01:50:29 PDT
Prevent AudioSession category to move out of PlayAndRecord to quickly
Attachments
Patch
(8.65 KB, patch)
2021-08-20 02:01 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch
(9.11 KB, patch)
2021-08-20 02:09 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch
(9.47 KB, patch)
2021-08-20 04:41 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch
(11.32 KB, patch)
2021-08-20 05:48 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch
(11.48 KB, patch)
2021-08-20 07:15 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch
(11.56 KB, patch)
2021-08-20 09:02 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch
(11.58 KB, patch)
2021-08-20 09:06 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch for landing
(11.71 KB, patch)
2021-08-20 10:57 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Show Obsolete
(7)
View All
Add attachment
proposed patch, testcase, etc.
youenn fablet
Comment 1
2021-08-20 01:56:02 PDT
<
rdar://81997024
>
youenn fablet
Comment 2
2021-08-20 02:01:50 PDT
Created
attachment 435954
[details]
Patch
youenn fablet
Comment 3
2021-08-20 02:05:44 PDT
<
rdar://81283764
>
youenn fablet
Comment 4
2021-08-20 02:09:08 PDT
Created
attachment 435955
[details]
Patch
youenn fablet
Comment 5
2021-08-20 02:21:07 PDT
We could remove individual MediaStreamTrack registration by making sure the Document media state is updated synchronously. I left this as a follow-up to make this patch small.
youenn fablet
Comment 6
2021-08-20 04:41:33 PDT
Created
attachment 435971
[details]
Patch
youenn fablet
Comment 7
2021-08-20 05:48:33 PDT
Created
attachment 435976
[details]
Patch
youenn fablet
Comment 8
2021-08-20 07:15:00 PDT
Created
attachment 435981
[details]
Patch
youenn fablet
Comment 9
2021-08-20 07:15:55 PDT
(In reply to youenn fablet from
comment #5
)
> We could remove individual MediaStreamTrack registration by making sure the > Document media state is updated synchronously. I left this as a follow-up to > make this patch small.
Initial version was using Document to ensure PlayAndRecord sticks. New version is moving the logic inside MediaSessionManagerCocoa which is more appropriate.
Eric Carlson
Comment 10
2021-08-20 08:57:00 PDT
Comment on
attachment 435981
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=435981&action=review
> Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm:154 > + if (AudioSession::sharedSession().category() == AudioSession::CategoryType::PlayAndRecord && isPlayingAudio) > + category = AudioSession::CategoryType::PlayAndRecord;
Nit: it would be easier to understand if this was first: if (captureCount || AudioSession::sharedSession().category() == AudioSession::CategoryType::PlayAndRecord && isPlayingAudio) category = AudioSession::CategoryType::PlayAndRecord; else if (...
> LayoutTests/http/tests/media/media-stream/audio-capture-and-category.https.html:45 > + assert_equals(internals.audioSessionCategory(), "PlayAndRecord", "category when capturing");
Nit: it would be good to make this assert message different from the one above so if the test fails we can tell which test was the problem.
youenn fablet
Comment 11
2021-08-20 09:02:43 PDT
Created
attachment 435995
[details]
Patch
youenn fablet
Comment 12
2021-08-20 09:06:33 PDT
Created
attachment 435996
[details]
Patch
youenn fablet
Comment 13
2021-08-20 09:07:14 PDT
> > Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm:154 > > + if (AudioSession::sharedSession().category() == AudioSession::CategoryType::PlayAndRecord && isPlayingAudio) > > + category = AudioSession::CategoryType::PlayAndRecord; > > Nit: it would be easier to understand if this was first:
Done
> > LayoutTests/http/tests/media/media-stream/audio-capture-and-category.https.html:45 > > + assert_equals(internals.audioSessionCategory(), "PlayAndRecord", "category when capturing"); > > Nit: it would be good to make this assert message different from the one > above so if the test fails we can tell which test was the problem.
Done as well.
Eric Carlson
Comment 14
2021-08-20 09:51:30 PDT
Comment on
attachment 435996
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=435996&action=review
r=me once the bots are happy
> LayoutTests/http/tests/media/media-stream/audio-capture-and-category.https.html:46 > + assert_equals(internals.audioSessionCategory(), "PlayAndRecord", "category when capturing");
Maybe "category when capturing and playing audio"
> LayoutTests/http/tests/media/media-stream/audio-capture-and-category.https.html:48 > + stream.getAudioTracks()[0].stop();
As we discussed, it would be good to either comment here or use a url src for the audio element to make it obvious that audio will continue to play when the capture track is stopped.
> LayoutTests/http/tests/media/media-stream/audio-capture-and-category.https.html:51 > + assert_equals(internals.audioSessionCategory(), "PlayAndRecord", "category when document did capture but is not capturing anymore");
Maybe "category when capture has stopped but audio continues to play"
youenn fablet
Comment 15
2021-08-20 10:57:19 PDT
Created
attachment 436008
[details]
Patch for landing
EWS
Comment 16
2021-08-21 00:01:30 PDT
Committed
r281367
(
240782@main
): <
https://commits.webkit.org/240782@main
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 436008
[details]
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug