Loading media/libaaudio/src/libaaudio.map.txt +2 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ LIBAAUDIO { AAudioStreamBuilder_setInputPreset; # introduced=28 AAudioStreamBuilder_setAllowedCapturePolicy; # introduced=29 AAudioStreamBuilder_setSessionId; # introduced=28 AAudioStreamBuilder_setPrivacySensitive; # introduced=30 AAudioStreamBuilder_openStream; AAudioStreamBuilder_delete; AAudioStream_close; Loading Loading @@ -56,6 +57,7 @@ LIBAAUDIO { AAudioStream_getSessionId; # introduced=28 AAudioStream_getTimestamp; AAudioStream_isMMapUsed; AAudioStream_isPrivacySensitive; # introduced=30 local: *; }; media/libaaudio/tests/test_attributes.cpp +34 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ static void checkAttributes(aaudio_performance_mode_t perfMode, aaudio_content_type_t contentType, aaudio_input_preset_t preset = DONT_SET, aaudio_allowed_capture_policy_t capturePolicy = DONT_SET, int privacyMode = DONT_SET, aaudio_direction_t direction = AAUDIO_DIRECTION_OUTPUT) { float *buffer = new float[kNumFrames * kChannelCount]; Loading Loading @@ -60,6 +61,9 @@ static void checkAttributes(aaudio_performance_mode_t perfMode, if (capturePolicy != DONT_SET) { AAudioStreamBuilder_setAllowedCapturePolicy(aaudioBuilder, capturePolicy); } if (privacyMode != DONT_SET) { AAudioStreamBuilder_setPrivacySensitive(aaudioBuilder, (bool)privacyMode); } // Create an AAudioStream using the Builder. ASSERT_EQ(AAUDIO_OK, AAudioStreamBuilder_openStream(aaudioBuilder, &aaudioStream)); Loading Loading @@ -90,6 +94,13 @@ static void checkAttributes(aaudio_performance_mode_t perfMode, : preset; EXPECT_EQ(expectedCapturePolicy, AAudioStream_getAllowedCapturePolicy(aaudioStream)); bool expectedPrivacyMode = (privacyMode == DONT_SET) ? ((preset == AAUDIO_INPUT_PRESET_VOICE_COMMUNICATION || preset == AAUDIO_INPUT_PRESET_CAMCORDER) ? true : false) : privacyMode; EXPECT_EQ(expectedPrivacyMode, AAudioStream_isPrivacySensitive(aaudioStream)); EXPECT_EQ(AAUDIO_OK, AAudioStream_requestStart(aaudioStream)); if (direction == AAUDIO_DIRECTION_INPUT) { Loading Loading @@ -155,6 +166,12 @@ static const aaudio_input_preset_t sAllowCapturePolicies[] = { AAUDIO_ALLOW_CAPTURE_BY_NONE, }; static const int sPrivacyModes[] = { DONT_SET, false, true, }; static void checkAttributesUsage(aaudio_performance_mode_t perfMode) { for (aaudio_usage_t usage : sUsages) { checkAttributes(perfMode, usage, DONT_SET); Loading @@ -174,6 +191,7 @@ static void checkAttributesInputPreset(aaudio_performance_mode_t perfMode) { DONT_SET, inputPreset, DONT_SET, DONT_SET, AAUDIO_DIRECTION_INPUT); } } Loading @@ -189,6 +207,18 @@ static void checkAttributesAllowedCapturePolicy(aaudio_performance_mode_t perfMo } } static void checkAttributesPrivacySensitive(aaudio_performance_mode_t perfMode) { for (int privacyMode : sPrivacyModes) { checkAttributes(perfMode, DONT_SET, DONT_SET, DONT_SET, DONT_SET, privacyMode, AAUDIO_DIRECTION_INPUT); } } TEST(test_attributes, aaudio_usage_perfnone) { checkAttributesUsage(AAUDIO_PERFORMANCE_MODE_NONE); } Loading Loading @@ -220,3 +250,7 @@ TEST(test_attributes, aaudio_input_preset_lowlat) { TEST(test_attributes, aaudio_allowed_capture_policy_lowlat) { checkAttributesAllowedCapturePolicy(AAUDIO_PERFORMANCE_MODE_LOW_LATENCY); } TEST(test_attributes, aaudio_allowed_privacy_sensitive_lowlat) { checkAttributesPrivacySensitive(AAUDIO_PERFORMANCE_MODE_LOW_LATENCY); } Loading
media/libaaudio/src/libaaudio.map.txt +2 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ LIBAAUDIO { AAudioStreamBuilder_setInputPreset; # introduced=28 AAudioStreamBuilder_setAllowedCapturePolicy; # introduced=29 AAudioStreamBuilder_setSessionId; # introduced=28 AAudioStreamBuilder_setPrivacySensitive; # introduced=30 AAudioStreamBuilder_openStream; AAudioStreamBuilder_delete; AAudioStream_close; Loading Loading @@ -56,6 +57,7 @@ LIBAAUDIO { AAudioStream_getSessionId; # introduced=28 AAudioStream_getTimestamp; AAudioStream_isMMapUsed; AAudioStream_isPrivacySensitive; # introduced=30 local: *; };
media/libaaudio/tests/test_attributes.cpp +34 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ static void checkAttributes(aaudio_performance_mode_t perfMode, aaudio_content_type_t contentType, aaudio_input_preset_t preset = DONT_SET, aaudio_allowed_capture_policy_t capturePolicy = DONT_SET, int privacyMode = DONT_SET, aaudio_direction_t direction = AAUDIO_DIRECTION_OUTPUT) { float *buffer = new float[kNumFrames * kChannelCount]; Loading Loading @@ -60,6 +61,9 @@ static void checkAttributes(aaudio_performance_mode_t perfMode, if (capturePolicy != DONT_SET) { AAudioStreamBuilder_setAllowedCapturePolicy(aaudioBuilder, capturePolicy); } if (privacyMode != DONT_SET) { AAudioStreamBuilder_setPrivacySensitive(aaudioBuilder, (bool)privacyMode); } // Create an AAudioStream using the Builder. ASSERT_EQ(AAUDIO_OK, AAudioStreamBuilder_openStream(aaudioBuilder, &aaudioStream)); Loading Loading @@ -90,6 +94,13 @@ static void checkAttributes(aaudio_performance_mode_t perfMode, : preset; EXPECT_EQ(expectedCapturePolicy, AAudioStream_getAllowedCapturePolicy(aaudioStream)); bool expectedPrivacyMode = (privacyMode == DONT_SET) ? ((preset == AAUDIO_INPUT_PRESET_VOICE_COMMUNICATION || preset == AAUDIO_INPUT_PRESET_CAMCORDER) ? true : false) : privacyMode; EXPECT_EQ(expectedPrivacyMode, AAudioStream_isPrivacySensitive(aaudioStream)); EXPECT_EQ(AAUDIO_OK, AAudioStream_requestStart(aaudioStream)); if (direction == AAUDIO_DIRECTION_INPUT) { Loading Loading @@ -155,6 +166,12 @@ static const aaudio_input_preset_t sAllowCapturePolicies[] = { AAUDIO_ALLOW_CAPTURE_BY_NONE, }; static const int sPrivacyModes[] = { DONT_SET, false, true, }; static void checkAttributesUsage(aaudio_performance_mode_t perfMode) { for (aaudio_usage_t usage : sUsages) { checkAttributes(perfMode, usage, DONT_SET); Loading @@ -174,6 +191,7 @@ static void checkAttributesInputPreset(aaudio_performance_mode_t perfMode) { DONT_SET, inputPreset, DONT_SET, DONT_SET, AAUDIO_DIRECTION_INPUT); } } Loading @@ -189,6 +207,18 @@ static void checkAttributesAllowedCapturePolicy(aaudio_performance_mode_t perfMo } } static void checkAttributesPrivacySensitive(aaudio_performance_mode_t perfMode) { for (int privacyMode : sPrivacyModes) { checkAttributes(perfMode, DONT_SET, DONT_SET, DONT_SET, DONT_SET, privacyMode, AAUDIO_DIRECTION_INPUT); } } TEST(test_attributes, aaudio_usage_perfnone) { checkAttributesUsage(AAUDIO_PERFORMANCE_MODE_NONE); } Loading Loading @@ -220,3 +250,7 @@ TEST(test_attributes, aaudio_input_preset_lowlat) { TEST(test_attributes, aaudio_allowed_capture_policy_lowlat) { checkAttributesAllowedCapturePolicy(AAUDIO_PERFORMANCE_MODE_LOW_LATENCY); } TEST(test_attributes, aaudio_allowed_privacy_sensitive_lowlat) { checkAttributesPrivacySensitive(AAUDIO_PERFORMANCE_MODE_LOW_LATENCY); }