Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix format
  • Loading branch information
misos1 committed Sep 6, 2024
commit 81a9449d893dc055c1e0fa4e7eca7fdf272294d6
Original file line number Diff line number Diff line change
Expand Up @@ -1328,7 +1328,8 @@ static void upgradeAudioSessionCategory(AVAudioSessionCategory requestedCategory
setWithObjects:AVAudioSessionCategoryPlayback, AVAudioSessionCategoryPlayAndRecord, nil];
NSSet *recordCategories =
[NSSet setWithObjects:AVAudioSessionCategoryRecord, AVAudioSessionCategoryPlayAndRecord, nil];
NSSet *requiredCategories = [NSSet setWithObjects:requestedCategory, AVAudioSession.sharedInstance.category, nil];
NSSet *requiredCategories =
[NSSet setWithObjects:requestedCategory, AVAudioSession.sharedInstance.category, nil];
BOOL needPlay = [requiredCategories intersectsSet:playCategories];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: requiresPlay, requiresRecord (rather than introduce a second term that means the same thing within the same method).

BOOL needRecord = [requiredCategories intersectsSet:recordCategories];
if (needPlay && needRecord) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,8 @@ static void upgradeAudioSessionCategory(AVAudioSessionCategory requestedCategory
setWithObjects:AVAudioSessionCategoryPlayback, AVAudioSessionCategoryPlayAndRecord, nil];
NSSet *recordCategories =
[NSSet setWithObjects:AVAudioSessionCategoryRecord, AVAudioSessionCategoryPlayAndRecord, nil];
NSSet *requiredCategories = [NSSet setWithObjects:requestedCategory, AVAudioSession.sharedInstance.category, nil];
NSSet *requiredCategories =
[NSSet setWithObjects:requestedCategory, AVAudioSession.sharedInstance.category, nil];
BOOL needPlay = [requiredCategories intersectsSet:playCategories];
BOOL needRecord = [requiredCategories intersectsSet:recordCategories];
if (needPlay && needRecord) {
Expand All @@ -854,9 +855,11 @@ - (void)setMixWithOthers:(BOOL)mixWithOthers
// AVAudioSession doesn't exist on macOS, and audio always mixes, so just no-op.
#else
if (mixWithOthers) {
upgradeAudioSessionCategory(AVAudioSession.sharedInstance.category, AVAudioSessionCategoryOptionMixWithOthers, 0);
upgradeAudioSessionCategory(AVAudioSession.sharedInstance.category,
AVAudioSessionCategoryOptionMixWithOthers, 0);
} else {
upgradeAudioSessionCategory(AVAudioSession.sharedInstance.category, 0, AVAudioSessionCategoryOptionMixWithOthers);
upgradeAudioSessionCategory(AVAudioSession.sharedInstance.category, 0,
AVAudioSessionCategoryOptionMixWithOthers);
}
#endif
}
Expand Down