1 /* 2 * Copyright (C) 2021 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.media.audiotestharness.common; 18 19 import com.android.media.audiotestharness.proto.AudioDeviceOuterClass.AudioDevice; 20 import com.android.media.audiotestharness.proto.AudioFormatOuterClass.AudioFormat; 21 22 import java.time.Duration; 23 24 /** 25 * Contains all the defaults for the Audio Test Harness system shared between the client and server 26 * libraries. 27 */ 28 public final class Defaults { 29 30 /** 31 * The default {@link AudioFormat} used for capture. 32 * 33 * <p>Currently set to CD format and quality, thus audio samples are captured as single-channel, 34 * signed, little-endian samples at 16-bit 44100hz. 35 */ 36 public static final AudioFormat AUDIO_FORMAT = 37 AudioFormat.newBuilder() 38 .setSampleRate(44100.0f) 39 .setSampleSizeBits(16) 40 .setChannels(1) 41 .setSigned(true) 42 .setBigEndian(false) 43 .build(); 44 45 /** 46 * The default {@link AudioDevice} used for capture. 47 * 48 * <p>Currently set to a Dayton UMM-6 reference microphone which are commonly used by existing 49 * audio boxes. 50 */ 51 public static final AudioDevice AUDIO_DEVICE = 52 AudioDevice.newBuilder() 53 .setName("UMM-6") 54 .addCapabilities(AudioDevice.Capability.CAPTURE) 55 .build(); 56 57 /** Target size for each chunk captured and sent from host to client. */ 58 public static final int CAPTURE_CHUNK_TARGET_SIZE_BYTES = 256; 59 60 /** 61 * Timeout for all calls between client and host at which point any outstanding calls will be 62 * cancelled or aborted. 63 */ 64 public static final Duration SYSTEM_TIMEOUT = Duration.ofHours(1); 65 66 /** 67 * The port that the device attempts to connect to by default. 68 * 69 * <p>During test set up actions, requests are forwarded from this port on the device to the 70 * server port on the host. 71 */ 72 public static final int DEVICE_PORT = 55555; 73 } 74