Skip to content

Commit 5930519

Browse files
author
Sundeep Gopalaswamy
committed
Added test to check for AAC_LC offload
Added test to check if offloading of AAC_LC codec works. It is done only for Wear devices since there is a known issue on phones. Bug: 271055403 Test: m cts in cts-tradefed: run cts -m CtsMediaAudioTestCases -t android.media.audio.cts.AudioTrackOffloadTest Change-Id: I558da3e3cb470558a73c0265302713e97d10125f (cherry picked from commit fc47777)
1 parent 6966a12 commit 5930519

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

1.08 MB
Binary file not shown.

tests/tests/media/audio/src/android/media/audio/cts/AudioTrackOffloadTest.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
import android.annotation.Nullable;
2424
import android.annotation.RawRes;
25+
import android.content.pm.PackageManager;
2526
import android.content.res.AssetFileDescriptor;
2627
import android.media.AudioAttributes;
2728
import android.media.AudioFormat;
@@ -59,6 +60,19 @@ public class AudioTrackOffloadTest extends CtsAndroidTestCase {
5960

6061
private static final AudioAttributes DEFAULT_ATTR = new AudioAttributes.Builder().build();
6162

63+
// flag to indicate if AAC related tests need to be run or not.
64+
private boolean mTestAacSupport = false;
65+
66+
@Override
67+
protected void setUp() throws Exception {
68+
super.setUp();
69+
boolean isWatch = getContext().getPackageManager()
70+
.hasSystemFeature(PackageManager.FEATURE_WATCH);
71+
if (isWatch) {
72+
mTestAacSupport = true;
73+
}
74+
}
75+
6276
public void testIsOffloadSupportedNullFormat() throws Exception {
6377
try {
6478
final boolean offloadableFormat = AudioManager.isOffloadedPlaybackSupported(null,
@@ -125,6 +139,15 @@ public void testOpusAudioTrackOffload() throws Exception {
125139
getAudioFormatWithEncoding(AudioFormat.ENCODING_OPUS));
126140
}
127141

142+
public void testAacLCAudioTrackOffload() throws Exception {
143+
if (!mTestAacSupport) {
144+
return;
145+
}
146+
testAudioTrackOffload(R.raw.sine40dblong_44k_128kbps_LC,
147+
/* bitRateInkbps= */ 128,
148+
getAudioFormatWithEncoding(AudioFormat.ENCODING_AAC_LC));
149+
}
150+
128151
@CddTest(requirement="5.5.4")
129152
public void testGaplessMP3AudioTrackOffload() throws Exception {
130153
// sine882hz3s has a gapless delay of 576 and padding of 756.

0 commit comments

Comments
 (0)