Commit 2e3b3225 authored by bayers's avatar bayers
Browse files

fix for split rendering with pcm (probably not the full picture yet)

parent 17699507
Loading
Loading
Loading
Loading
Loading
+23 −6
Original line number Diff line number Diff line
@@ -813,7 +813,8 @@ int main(
    IVAS_VECTOR3 Pos[RENDERER_HEAD_POSITIONS_PER_FRAME];
#endif
#ifdef API_5MS
    bool splitBinNeedsNewFrame = true;
    bool splitBinNeedsNewAudioFrame = true;
    bool splitBinNeedsNewBitstreamFrame = true;
#endif

#ifdef WMOPS
@@ -1497,13 +1498,26 @@ int main(
        num_in_channels = inBuffer.config.numChannels;
#ifdef API_5MS
        const bool isCurrentFrameMultipleOf20ms = !args.framing_5ms || frame % 4 == 0;

        if ( ( hSplitRendFileReadWrite != NULL ) && is_split_post_rend_mode( &args ) )
        {
            if ( args.inConfig.binBuses[0].audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
            {
                /* this is always 20 ms*/
                splitBinNeedsNewBitstreamFrame = isCurrentFrameMultipleOf20ms;
            }
            else
            {
                splitBinNeedsNewBitstreamFrame = splitBinNeedsNewAudioFrame;
            }
        }
#endif

#ifdef SPLIT_REND_WITH_HEAD_ROT
        numSamplesRead = 0;
        if ( ( hSplitRendFileReadWrite != NULL ) && is_split_post_rend_mode( &args )
#ifdef API_5MS
             && splitBinNeedsNewFrame
             && splitBinNeedsNewBitstreamFrame
#endif
        )
        {
@@ -1544,7 +1558,7 @@ int main(

        if ( numSamplesRead == 0
#ifdef API_5MS
             && splitBinNeedsNewFrame
             && splitBinNeedsNewAudioFrame
#endif
        )
        {
@@ -1687,7 +1701,7 @@ int main(
        /* Read from split renderer bfi file if specified */
        if ( splitRendBFIReader != NULL
#ifdef API_5MS
             && splitBinNeedsNewFrame
             && splitBinNeedsNewBitstreamFrame
#endif
        )
        {
@@ -1866,7 +1880,7 @@ int main(
        for ( i = 0; i < args.inConfig.numBinBuses; ++i )
        {
#ifdef API_5MS
            if ( splitBinNeedsNewFrame )
            if ( splitBinNeedsNewAudioFrame )
            {
#endif
                if ( ( error = IVAS_REND_GetInputNumChannels( hIvasRend, splitBinIds[i], &numChannels ) ) != IVAS_ERR_OK )
@@ -1883,6 +1897,9 @@ int main(
                }

#ifdef API_5MS
            }
            if ( splitBinNeedsNewBitstreamFrame )
            {
                if ( ( error = IVAS_REND_FeedSplitBinauralBitstream( hIvasRend, splitBinIds[i], &bitsBuffer ) ) != IVAS_ERR_OK )
                {
                    fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) );
@@ -1896,7 +1913,7 @@ int main(
#if defined API_5MS && defined SPLIT_REND_WITH_HEAD_ROT
        if ( args.inConfig.numBinBuses != 0 )
        {
            if ( ( error = IVAS_REND_GetSplitBinauralSamples( hIvasRend, outBuffer, &splitBinNeedsNewFrame ) ) != IVAS_ERR_OK )
            if ( ( error = IVAS_REND_GetSplitBinauralSamples( hIvasRend, outBuffer, &splitBinNeedsNewAudioFrame ) ) != IVAS_ERR_OK )
            {
                fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) );
                exit( -1 );