Commit f20d9381 authored by kinuthia's avatar kinuthia
Browse files

handle case when user specified selected directivity pattern id is not found in config

file
parent 595525c8
Loading
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -138,6 +138,9 @@ typedef enum
#ifdef CONTROL_METADATA_REVERB
    IVAS_ERR_INVALID_RENDER_CONFIG,
    IVAS_ERR_ACOUSTIC_ENVIRONMENT_MISSING,
#ifdef CONTROL_METADATA_DIRECTIVITY
    IVAS_ERR_DIRECTIVITY_PATTERN_ID_MISSING,
#endif
#endif
#ifdef SPLIT_REND_WITH_HEAD_ROT
    IVAS_ERR_LC3PLUS_INVALID_BITRATE,
+19 −4
Original line number Diff line number Diff line
@@ -2955,7 +2955,7 @@ ivas_error RenderConfigReader_getAcousticEnvironment(

#endif

#ifdef CONTROL_METADATA_REVERB
#ifdef CONTROL_METADATA_DIRECTIVITY
/*------------------------------------------------------------------------------------------*
 * RenderConfigReader_getDirectivity()
 *
@@ -2968,7 +2968,9 @@ ivas_error RenderConfigReader_getDirectivity(
    float *directivity                       /* o  : Target directivity                     */
)
{
    uint16_t n;
    uint16_t n, m;
    bool idExists;


    if ( pRenderConfigReader == NULL )
    {
@@ -2987,7 +2989,20 @@ ivas_error RenderConfigReader_getDirectivity(
    {
        for ( n = 0; n < MAX_NUM_OBJECTS; n++ )
        {
            idExists = false;
            for ( m = 0; m < pRenderConfigReader->nDP; m++ )
            {
                if ( id[n] == pRenderConfigReader->pDP[m].id )
                {
                    idExists = true;
                    mvr2r( pRenderConfigReader->pDP[id[n]].pDirectivity, directivity + ( n * 3 ), 3 );
                    break;
                }
            }
            if ( !idExists )
            {
                return IVAS_ERR_DIRECTIVITY_PATTERN_ID_MISSING;
            }
        }
    }
    return IVAS_ERR_OK;