1 /* Copyright 2019 The Chromium OS Authors. All rights reserved. 2 * Use of this source code is governed by a BSD-style license that can be 3 * found in the LICENSE file. 4 */ 5 6 #include <stdint.h> 7 8 #include "cras_audio_codec.h" 9 10 /* PLC library provides helper functions to mask the effects of lost or 11 * disrupted packets. It currentyl only supports the mSBC codec. 12 * 13 * This struct contains informations needed for applying the PLC algorithm. 14 */ 15 struct cras_msbc_plc; 16 17 /* Creates a plc component for mSBC codec, which is used for wideband speech 18 * mode of HFP 19 */ 20 struct cras_msbc_plc *cras_msbc_plc_create(); 21 22 /* Destroys a mSBC PLC. 23 * Args: 24 * plc - The PLC to destroy. 25 */ 26 void cras_msbc_plc_destroy(struct cras_msbc_plc *plc); 27 28 /* Conceals the packet loss by writing the substitution samples to the ouput 29 * buffer provided by the caller. The samples will be generated based on the 30 * informations recorded in the PLC struct passed in. 31 * Args: 32 * plc - The PLC you use. 33 * codec - The mSBC codec. 34 * output - Pointer to the output buffer. 35 * Returns: 36 * The number of bytes written to the output buffer. 37 */ 38 int cras_msbc_plc_handle_bad_frames(struct cras_msbc_plc *plc, 39 struct cras_audio_codec *codec, 40 uint8_t *output); 41 42 /* Updates informations needed and potentially processes the input samples to 43 * help it to reconverge after a frame loss. 44 * 45 * The memory space input and output pointers point to can be overlapping. 46 * Args: 47 * plc - The PLC you use. 48 * input - Pointer to the true input. 49 * output - Pointer to the output buffer. 50 * Returns: 51 * The number of bytes written to the output buffer. 52 */ 53 int cras_msbc_plc_handle_good_frames(struct cras_msbc_plc *plc, 54 const uint8_t *input, uint8_t *output); 55