1 /** 2 * Copyright (C) 2022 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 #ifndef AUDIO_FLINGER_H_INCLUDED 18 #define AUDIO_FLINGER_H_INCLUDED 19 20 #define VOIP_MAX_VOC_PKT_SIZE 4096 21 #define PCM_BUFFER_SIZE 640 22 // #define PCM_BUFFER_SIZE 1600 23 24 struct voip_frame_hdr 25 { 26 uint32_t timestamp; 27 union 28 { 29 uint32_t frame_type; 30 uint32_t packet_rate; 31 }; 32 }; 33 34 struct voip_frame 35 { 36 struct voip_frame_hdr frm_hdr; 37 uint32_t pktlen; 38 uint8_t voc_pkt[VOIP_MAX_VOC_PKT_SIZE]; 39 }; 40 41 // #define DEBUG_PCM_DUMP // Write PCM Dump 42 #define PCM_DUMP_SIZE 960000 43 44 const uint32_t AMR_NB_NOTI_COUNT[8] = { 45 12, // 4.75 46 13, // 5.15 47 15, // 5.90 48 17, // 6.70 49 19, // 7.40 50 20, // 7.95 51 26, // 10.20 52 31, // 12.20 53 }; 54 const uint32_t AMR_WB_NOTI_COUNT[9] = { 55 17, // 6.6 56 23, // 8.85 57 32, // 12.65 58 36, // 14.25 59 40, // 15.85 60 46, // 18.25 61 50, // 19.85 62 58, // 23.05 63 60, // 23.85 64 }; 65 66 const uint32_t AMR_NB_INDEX[8] = {4750, 5150, 5900, 6700, 7400, 7950, 10200, 12200}; 67 68 const uint32_t AMR_WB_INDEX[9] = {6600, 8850, 12650, 14250, 15850, 18250, 19850, 23050, 23850}; 69 70 #endif // AUDIO_FLINGER_H_INCLUDED 71