Commit 278f78f2 authored by Vladimir Malenovsky's avatar Vladimir Malenovsky
Browse files

need to populate p_head_pose_buf - needed by ivas_syn_output

parent 43f3e899
Loading
Loading
Loading
Loading
Loading
+25 −3
Original line number Diff line number Diff line
@@ -4362,13 +4362,35 @@ ivas_error IVAS_DEC_Flush(

            *nSamplesFlushed = nOutSamples;

            /* Flush the remaing audio output in SR mode. Metadata generation is handled during normal decoding */
            /* Flush the remaining audio output in SR mode.
               For BINAURAL_SPLIT_PCM, generate metadata and binaural PCM from the ring buffer.
               The ISAR metadata output is discarded (flush frames are not written to the metadata file). */
            if ( hIvasDec->st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
            {
                Decoder_Struct *st_ivas_flush = hIvasDec->st_ivas;
                ISAR_SPLIT_REND_BITS_DATA flushSplitRendBits;
                uint8_t flushBitsBuf[ISAR_MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES];

                flushSplitRendBits.bits_buf = flushBitsBuf;
                flushSplitRendBits.bits_read = 0;
                flushSplitRendBits.bits_written = 0;
                flushSplitRendBits.buf_len = ISAR_MAX_SPLIT_REND_BITS_BUFFER_SIZE_IN_BYTES;
                flushSplitRendBits.codec = ISAR_SPLIT_REND_CODEC_DEFAULT;
                flushSplitRendBits.pose_correction = ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE;
                flushSplitRendBits.codec_frame_size_ms = 0;
                flushSplitRendBits.isar_frame_size_ms = 0;
                flushSplitRendBits.lc3plus_highres = 0;

                /* Pop from ring buffer and generate binaural PCM into p_head_pose_buf */
                if ( ( error = isar_generate_metadata_and_bitstream( st_ivas_flush, p_head_pose_buf, nOutSamples, &flushSplitRendBits ) ) != IVAS_ERR_OK )
                {
                    return error;
                }

#ifndef DISABLE_LIMITER
                ivas_limiter_dec( hIvasDec->st_ivas->hLimiter, p_head_pose_buf, hIvasDec->st_ivas->hDecoderConfig->nchan_out, nOutSamples, hIvasDec->st_ivas->BER_detect );
                ivas_limiter_dec( st_ivas_flush->hLimiter, p_head_pose_buf, st_ivas_flush->hDecoderConfig->nchan_out, nOutSamples, st_ivas_flush->BER_detect );
#endif
                ivas_syn_output( p_head_pose_buf, nOutSamples, hIvasDec->st_ivas->hDecoderConfig->nchan_out, (int16_t *) pcmBuf );
                ivas_syn_output( p_head_pose_buf, nOutSamples, st_ivas_flush->hDecoderConfig->nchan_out, (int16_t *) pcmBuf );
            }
        }
        else