Skip to content

Commit

Permalink
av: Remove restrictions for system audio record
Browse files Browse the repository at this point in the history
* Give freedom to screen recorder apps

Change-Id: I726bde4f44bba6fc8cd771ae90c8864b26cdd919
Signed-off-by: Pranav Vashi <[email protected]>
  • Loading branch information
jhenrique09 authored and fazilsheik96 committed Mar 1, 2025
1 parent 5971fc0 commit 31b6990
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 26 deletions.
4 changes: 2 additions & 2 deletions media/libaaudio/src/utility/AAudioUtilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ audio_flags_mask_t AAudio_computeAudioFlagsMask(
bool isContentSpatialized,
audio_output_flags_t outputFlags) {
audio_flags_mask_t flagsMask = AUDIO_FLAG_NONE;
switch (policy) {
/*switch (policy) {
case AAUDIO_UNSPECIFIED:
case AAUDIO_ALLOW_CAPTURE_BY_ALL:
// flagsMask is not modified
Expand All @@ -276,7 +276,7 @@ audio_flags_mask_t AAudio_computeAudioFlagsMask(
default:
ALOGE("%s() 0x%08X unrecognized capture policy", __func__, policy);
// flagsMask is not modified
}
}*/

switch (spatializationBehavior) {
case AAUDIO_UNSPECIFIED:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,30 +426,6 @@ bool AudioPolicyMixCollection::mixMatch(const AudioMix* mix, size_t mixIndex,
uid_t uid, audio_session_t session) {

if (mix->mMixType == MIX_TYPE_PLAYERS) {
// Loopback render mixes are created from a public API and thus restricted
// to non sensible audio that have not opted out.
if (is_mix_loopback_render(mix->mRouteFlags)) {
if (!(attributes.usage == AUDIO_USAGE_UNKNOWN ||
attributes.usage == AUDIO_USAGE_MEDIA ||
attributes.usage == AUDIO_USAGE_GAME ||
attributes.usage == AUDIO_USAGE_VOICE_COMMUNICATION)) {
return false;
}
auto hasFlag = [](auto flags, auto flag) { return (flags & flag) == flag; };
if (hasFlag(attributes.flags, AUDIO_FLAG_NO_SYSTEM_CAPTURE)) {
return false;
}

if (attributes.usage == AUDIO_USAGE_VOICE_COMMUNICATION) {
if (!mix->mVoiceCommunicationCaptureAllowed) {
return false;
}
} else if (!mix->mAllowPrivilegedMediaPlaybackCapture &&
hasFlag(attributes.flags, AUDIO_FLAG_NO_MEDIA_PROJECTION)) {
return false;
}
}

// Permit match only if requested format and mix format are PCM and can be format
// adapted by the mixer, or are the same (compressed) format.
if (!is_mix_loopback(mix->mRouteFlags) &&
Expand Down

0 comments on commit 31b6990

Please sign in to comment.