Merge "Fix issue 5355047: Automated effect tests fail."
This commit is contained in:
@@ -46,6 +46,10 @@ public class MediaBassBoostTest extends ActivityInstrumentationTestCase2<MediaFr
|
||||
private final static int MIN_ENERGY_RATIO_2 = 3;
|
||||
private final static short TEST_STRENGTH = 500;
|
||||
private final static int TEST_VOLUME = 4;
|
||||
// Implementor UUID for volume controller effect defined in
|
||||
// frameworks/base/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
|
||||
private final static UUID VOLUME_EFFECT_UUID =
|
||||
UUID.fromString("119341a0-8469-11df-81f9-0002a5d5c51b");
|
||||
|
||||
private BassBoost mBassBoost = null;
|
||||
private int mSession = -1;
|
||||
@@ -201,14 +205,15 @@ public class MediaBassBoostTest extends ActivityInstrumentationTestCase2<MediaFr
|
||||
// creating a volume controller on output mix ensures that ro.audio.silent mutes
|
||||
// audio after the effects and not before
|
||||
vc = new AudioEffect(
|
||||
AudioEffect.EFFECT_TYPE_NULL,
|
||||
UUID.fromString("119341a0-8469-11df-81f9-0002a5d5c51b"),
|
||||
0,
|
||||
0);
|
||||
AudioEffect.EFFECT_TYPE_NULL,
|
||||
VOLUME_EFFECT_UUID,
|
||||
0,
|
||||
0);
|
||||
vc.setEnabled(true);
|
||||
|
||||
mp = new MediaPlayer();
|
||||
mp.setDataSource(MediaNames.SINE_200_1000);
|
||||
mp.setLooping(true);
|
||||
mp.setAudioStreamType(AudioManager.STREAM_MUSIC);
|
||||
getBassBoost(mp.getAudioSessionId());
|
||||
mp.prepare();
|
||||
@@ -219,7 +224,7 @@ public class MediaBassBoostTest extends ActivityInstrumentationTestCase2<MediaFr
|
||||
int refEnergy1000 = probe.capture(1000);
|
||||
mBassBoost.setStrength((short)1000);
|
||||
mBassBoost.setEnabled(true);
|
||||
Thread.sleep(500);
|
||||
Thread.sleep(4000);
|
||||
// measure energy around 1kHz with band level at min
|
||||
int energy200 = probe.capture(200);
|
||||
int energy1000 = probe.capture(1000);
|
||||
|
||||
@@ -49,6 +49,14 @@ public class MediaEnvReverbTest extends ActivityInstrumentationTestCase2<MediaFr
|
||||
private final static float DELAY_TOLERANCE = 1.05f;
|
||||
// allow +/- 5% tolerance between set and get ratios
|
||||
private final static float RATIO_TOLERANCE = 1.05f;
|
||||
// Implementor UUID for volume controller effect defined in
|
||||
// frameworks/base/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
|
||||
private final static UUID VOLUME_EFFECT_UUID =
|
||||
UUID.fromString("119341a0-8469-11df-81f9-0002a5d5c51b");
|
||||
// Implementor UUID for environmental reverb effect defined in
|
||||
// frameworks/base/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
|
||||
private final static UUID ENV_REVERB_EFFECT_UUID =
|
||||
UUID.fromString("c7a511a0-a3bb-11df-860e-0002a5d5c51b");
|
||||
|
||||
private EnvironmentalReverb mReverb = null;
|
||||
private int mSession = -1;
|
||||
@@ -354,10 +362,10 @@ public class MediaEnvReverbTest extends ActivityInstrumentationTestCase2<MediaFr
|
||||
// creating a volume controller on output mix ensures that ro.audio.silent mutes
|
||||
// audio after the effects and not before
|
||||
vc = new AudioEffect(
|
||||
AudioEffect.EFFECT_TYPE_NULL,
|
||||
UUID.fromString("119341a0-8469-11df-81f9-0002a5d5c51b"),
|
||||
0,
|
||||
0);
|
||||
AudioEffect.EFFECT_TYPE_NULL,
|
||||
VOLUME_EFFECT_UUID,
|
||||
0,
|
||||
0);
|
||||
vc.setEnabled(true);
|
||||
|
||||
mp = new MediaPlayer();
|
||||
@@ -424,10 +432,10 @@ public class MediaEnvReverbTest extends ActivityInstrumentationTestCase2<MediaFr
|
||||
// creating a volume controller on output mix ensures that ro.audio.silent mutes
|
||||
// audio after the effects and not before
|
||||
vc = new AudioEffect(
|
||||
AudioEffect.EFFECT_TYPE_NULL,
|
||||
UUID.fromString("119341a0-8469-11df-81f9-0002a5d5c51b"),
|
||||
0,
|
||||
0);
|
||||
AudioEffect.EFFECT_TYPE_NULL,
|
||||
VOLUME_EFFECT_UUID,
|
||||
0,
|
||||
0);
|
||||
vc.setEnabled(true);
|
||||
|
||||
mp = new MediaPlayer();
|
||||
@@ -438,7 +446,7 @@ public class MediaEnvReverbTest extends ActivityInstrumentationTestCase2<MediaFr
|
||||
// auxiliary reverb will be chosen by the effect framework as we are on session 0
|
||||
rvb = new AudioEffect(
|
||||
AudioEffect.EFFECT_TYPE_NULL,
|
||||
UUID.fromString("c7a511a0-a3bb-11df-860e-0002a5d5c51b"),
|
||||
ENV_REVERB_EFFECT_UUID,
|
||||
0,
|
||||
0);
|
||||
|
||||
|
||||
@@ -49,6 +49,11 @@ public class MediaEqualizerTest extends ActivityInstrumentationTestCase2<MediaFr
|
||||
private final static int TEST_FREQUENCY_MILLIHERTZ = 1000000;
|
||||
private final static int MIN_NUMBER_OF_PRESETS = 4;
|
||||
private final static int TEST_VOLUME = 4;
|
||||
// Implementor UUID for volume controller effect defined in
|
||||
// frameworks/base/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
|
||||
private final static UUID VOLUME_EFFECT_UUID =
|
||||
UUID.fromString("119341a0-8469-11df-81f9-0002a5d5c51b");
|
||||
|
||||
private Equalizer mEqualizer = null;
|
||||
private int mSession = -1;
|
||||
|
||||
@@ -267,10 +272,10 @@ public class MediaEqualizerTest extends ActivityInstrumentationTestCase2<MediaFr
|
||||
// creating a volume controller on output mix ensures that ro.audio.silent mutes
|
||||
// audio after the effects and not before
|
||||
vc = new AudioEffect(
|
||||
AudioEffect.EFFECT_TYPE_NULL,
|
||||
UUID.fromString("119341a0-8469-11df-81f9-0002a5d5c51b"),
|
||||
0,
|
||||
0);
|
||||
AudioEffect.EFFECT_TYPE_NULL,
|
||||
VOLUME_EFFECT_UUID,
|
||||
0,
|
||||
0);
|
||||
vc.setEnabled(true);
|
||||
|
||||
mp = new MediaPlayer();
|
||||
|
||||
@@ -43,6 +43,14 @@ import java.util.UUID;
|
||||
*/
|
||||
public class MediaPresetReverbTest extends ActivityInstrumentationTestCase2<MediaFrameworkTest> {
|
||||
private String TAG = "MediaPresetReverbTest";
|
||||
// Implementor UUID for volume controller effect defined in
|
||||
// frameworks/base/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
|
||||
private final static UUID VOLUME_EFFECT_UUID =
|
||||
UUID.fromString("119341a0-8469-11df-81f9-0002a5d5c51b");
|
||||
// Implementor UUID for preset reverb effect defined in
|
||||
// frameworks/base/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
|
||||
private final static UUID PRESET_REVERB_EFFECT_UUID =
|
||||
UUID.fromString("172cdf00-a3bc-11df-a72f-0002a5d5c51b");
|
||||
|
||||
private PresetReverb mReverb = null;
|
||||
private int mSession = -1;
|
||||
@@ -199,10 +207,10 @@ public class MediaPresetReverbTest extends ActivityInstrumentationTestCase2<Medi
|
||||
// creating a volume controller on output mix ensures that ro.audio.silent mutes
|
||||
// audio after the effects and not before
|
||||
vc = new AudioEffect(
|
||||
AudioEffect.EFFECT_TYPE_NULL,
|
||||
UUID.fromString("119341a0-8469-11df-81f9-0002a5d5c51b"),
|
||||
0,
|
||||
0);
|
||||
AudioEffect.EFFECT_TYPE_NULL,
|
||||
VOLUME_EFFECT_UUID,
|
||||
0,
|
||||
0);
|
||||
vc.setEnabled(true);
|
||||
|
||||
mp = new MediaPlayer();
|
||||
@@ -267,24 +275,21 @@ public class MediaPresetReverbTest extends ActivityInstrumentationTestCase2<Medi
|
||||
// creating a volume controller on output mix ensures that ro.audio.silent mutes
|
||||
// audio after the effects and not before
|
||||
vc = new AudioEffect(
|
||||
AudioEffect.EFFECT_TYPE_NULL,
|
||||
UUID.fromString("119341a0-8469-11df-81f9-0002a5d5c51b"),
|
||||
0,
|
||||
0);
|
||||
AudioEffect.EFFECT_TYPE_NULL,
|
||||
VOLUME_EFFECT_UUID,
|
||||
0,
|
||||
0);
|
||||
vc.setEnabled(true);
|
||||
|
||||
mp = new MediaPlayer();
|
||||
mp.setDataSource(MediaNames.SINE_200_1000);
|
||||
mp.setAudioStreamType(AudioManager.STREAM_MUSIC);
|
||||
getReverb(mp.getAudioSessionId());
|
||||
mReverb.setPreset((short)PresetReverb.PRESET_PLATE);
|
||||
mReverb.setEnabled(true);
|
||||
|
||||
// create reverb with UUID instead of PresetReverb constructor otherwise an auxiliary
|
||||
// reverb will be chosen by the effect framework as we are on session 0
|
||||
rvb = new AudioEffect(
|
||||
AudioEffect.EFFECT_TYPE_NULL,
|
||||
UUID.fromString("172cdf00-a3bc-11df-a72f-0002a5d5c51b"),
|
||||
PRESET_REVERB_EFFECT_UUID,
|
||||
0,
|
||||
0);
|
||||
|
||||
@@ -317,7 +322,6 @@ public class MediaPresetReverbTest extends ActivityInstrumentationTestCase2<Medi
|
||||
loge(msg, "sleep() interrupted");
|
||||
}
|
||||
finally {
|
||||
releaseReverb();
|
||||
if (mp != null) {
|
||||
mp.release();
|
||||
}
|
||||
|
||||
@@ -43,9 +43,13 @@ import java.util.UUID;
|
||||
*/
|
||||
public class MediaVirtualizerTest extends ActivityInstrumentationTestCase2<MediaFrameworkTest> {
|
||||
private String TAG = "MediaVirtualizerTest";
|
||||
private final static int MIN_ENERGY_RATIO_2 = 3;
|
||||
private final static int MIN_ENERGY_RATIO_2 = 2;
|
||||
private final static short TEST_STRENGTH = 500;
|
||||
private final static int TEST_VOLUME = 4;
|
||||
// Implementor UUID for volume controller effect defined in
|
||||
// frameworks/base/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
|
||||
private final static UUID VOLUME_EFFECT_UUID =
|
||||
UUID.fromString("119341a0-8469-11df-81f9-0002a5d5c51b");
|
||||
|
||||
private Virtualizer mVirtualizer = null;
|
||||
private int mSession = -1;
|
||||
@@ -202,14 +206,15 @@ public class MediaVirtualizerTest extends ActivityInstrumentationTestCase2<Media
|
||||
// creating a volume controller on output mix ensures that ro.audio.silent mutes
|
||||
// audio after the effects and not before
|
||||
vc = new AudioEffect(
|
||||
AudioEffect.EFFECT_TYPE_NULL,
|
||||
UUID.fromString("119341a0-8469-11df-81f9-0002a5d5c51b"),
|
||||
0,
|
||||
0);
|
||||
AudioEffect.EFFECT_TYPE_NULL,
|
||||
VOLUME_EFFECT_UUID,
|
||||
0,
|
||||
0);
|
||||
vc.setEnabled(true);
|
||||
|
||||
mp = new MediaPlayer();
|
||||
mp.setDataSource(MediaNames.SINE_200_1000);
|
||||
mp.setLooping(true);
|
||||
mp.setAudioStreamType(AudioManager.STREAM_MUSIC);
|
||||
getVirtualizer(mp.getAudioSessionId());
|
||||
mp.prepare();
|
||||
@@ -220,7 +225,7 @@ public class MediaVirtualizerTest extends ActivityInstrumentationTestCase2<Media
|
||||
int refEnergy1000 = probe.capture(1000);
|
||||
mVirtualizer.setStrength((short)1000);
|
||||
mVirtualizer.setEnabled(true);
|
||||
Thread.sleep(500);
|
||||
Thread.sleep(4000);
|
||||
// measure energy around 1kHz with band level at min
|
||||
int energy200 = probe.capture(200);
|
||||
int energy1000 = probe.capture(1000);
|
||||
@@ -230,7 +235,7 @@ public class MediaVirtualizerTest extends ActivityInstrumentationTestCase2<Media
|
||||
// audio file but is not the primary effect of the virtualizer. A better way would
|
||||
// be to have a stereo PCM capture and check that a strongly paned input is centered
|
||||
// when output. However, we cannot capture stereo with the visualizer.
|
||||
assertTrue(msg + ": virtiualizer has no effect",
|
||||
assertTrue(msg + ": virtualizer has no effect",
|
||||
((float)energy200/(float)energy1000) >
|
||||
(MIN_ENERGY_RATIO_2 * ((float)refEnergy200/(float)refEnergy1000)));
|
||||
result = true;
|
||||
|
||||
@@ -47,6 +47,10 @@ public class MediaVisualizerTest extends ActivityInstrumentationTestCase2<MediaF
|
||||
private final static int MAX_SAMPLING_RATE = 48000000;
|
||||
private final static int MIN_CAPTURE_SIZE_MAX = 1024;
|
||||
private final static int MAX_CAPTURE_SIZE_MIN = 128;
|
||||
// Implementor UUID for volume controller effect defined in
|
||||
// frameworks/base/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
|
||||
private final static UUID VOLUME_EFFECT_UUID =
|
||||
UUID.fromString("119341a0-8469-11df-81f9-0002a5d5c51b");
|
||||
|
||||
private Visualizer mVisualizer = null;
|
||||
private int mSession = -1;
|
||||
@@ -205,10 +209,10 @@ public class MediaVisualizerTest extends ActivityInstrumentationTestCase2<MediaF
|
||||
// creating a volume controller on output mix ensures that ro.audio.silent mutes
|
||||
// audio after the effects and not before
|
||||
vc = new AudioEffect(
|
||||
AudioEffect.EFFECT_TYPE_NULL,
|
||||
UUID.fromString("119341a0-8469-11df-81f9-0002a5d5c51b"),
|
||||
0,
|
||||
0);
|
||||
AudioEffect.EFFECT_TYPE_NULL,
|
||||
VOLUME_EFFECT_UUID,
|
||||
0,
|
||||
0);
|
||||
vc.setEnabled(true);
|
||||
|
||||
mp = new MediaPlayer();
|
||||
@@ -281,10 +285,10 @@ public class MediaVisualizerTest extends ActivityInstrumentationTestCase2<MediaF
|
||||
// creating a volume controller on output mix ensures that ro.audio.silent mutes
|
||||
// audio after the effects and not before
|
||||
vc = new AudioEffect(
|
||||
AudioEffect.EFFECT_TYPE_NULL,
|
||||
UUID.fromString("119341a0-8469-11df-81f9-0002a5d5c51b"),
|
||||
0,
|
||||
0);
|
||||
AudioEffect.EFFECT_TYPE_NULL,
|
||||
VOLUME_EFFECT_UUID,
|
||||
0,
|
||||
0);
|
||||
vc.setEnabled(true);
|
||||
|
||||
mp = new MediaPlayer();
|
||||
|
||||
@@ -7440,12 +7440,21 @@ void AudioFlinger::EffectChain::setEffectSuspendedAll_l(bool suspend)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// The volume effect is used for automated tests only
|
||||
#ifndef OPENSL_ES_H_
|
||||
static const effect_uuid_t SL_IID_VOLUME_ = { 0x09e8ede0, 0xddde, 0x11db, 0xb4f6,
|
||||
{ 0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b } };
|
||||
const effect_uuid_t * const SL_IID_VOLUME = &SL_IID_VOLUME_;
|
||||
#endif //OPENSL_ES_H_
|
||||
|
||||
bool AudioFlinger::EffectChain::isEffectEligibleForSuspend(const effect_descriptor_t& desc)
|
||||
{
|
||||
// auxiliary effects and visualizer are never suspended on output mix
|
||||
if ((mSessionId == AUDIO_SESSION_OUTPUT_MIX) &&
|
||||
(((desc.flags & EFFECT_FLAG_TYPE_MASK) == EFFECT_FLAG_TYPE_AUXILIARY) ||
|
||||
(memcmp(&desc.type, SL_IID_VISUALIZATION, sizeof(effect_uuid_t)) == 0))) {
|
||||
(memcmp(&desc.type, SL_IID_VISUALIZATION, sizeof(effect_uuid_t)) == 0) ||
|
||||
(memcmp(&desc.type, SL_IID_VOLUME, sizeof(effect_uuid_t)) == 0))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user