diff --git a/apps/decoder.c b/apps/decoder.c index f37b0acec923ef1cf9b8c9999b8c79318933d15d..fca2d9e6ed41e4de2dd0e34cdc163e2d06ab6043 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1728,6 +1728,9 @@ static ivas_error initOnFirstGoodFrame( uint16_t rtpDecSeed = RANDOM_INITSEED_DEC; uint32_t ssrc = ( (uint32_t) IVAS_RTP_OwnRandom( &rtpDecSeed ) & 0x0000FFFF ) | ( (uint32_t) IVAS_RTP_OwnRandom( &rtpDecSeed ) << 16 ); uint16_t seqNumInitVal = IVAS_RTP_OwnRandom( &rtpDecSeed ); +#ifdef FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API + uint8_t payloadType = DEFAULT_IVAS_PAYLOAD_TYPE; /* Dynamic PT are in range [96, 127] */ +#endif if ( ( error = IVAS_DEC_GetDelay( hIvasDec, delayNumSamples_temp, &delayTimeScale_temp ) ) != IVAS_ERR_OK ) { @@ -1764,7 +1767,11 @@ static ivas_error initOnFirstGoodFrame( /* Split Rendering RTPDump Output file */ +#ifdef FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API + if ( ( error = IVAS_RTP_WRITER_Init( srRtp, arg.outputWavFilename, 1000 / ( IVAS_NUM_FRAMES_PER_SEC * splitRendCodecFrameSizeMs ), payloadType, ssrc, seqNumInitVal ) ) != IVAS_ERR_OK ) +#else if ( ( error = IVAS_RTP_WRITER_Init( srRtp, arg.outputWavFilename, 1000 / ( IVAS_NUM_FRAMES_PER_SEC * splitRendCodecFrameSizeMs ), ssrc, seqNumInitVal ) ) != IVAS_ERR_OK ) +#endif { fprintf( stderr, "\nError: Can't open SR output bitstream file for RTP output %s \n\n", arg.outputWavFilename ); return error; diff --git a/apps/encoder.c b/apps/encoder.c index 31d9b448c12086cf44d354d70b05f015bcdce377..e157cc8c60e7a9a60f10f393d13f7d5043ffbd57 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -227,6 +227,9 @@ int main( uint16_t rtpEncSeed = RANDOM_INITSEED_ENC; uint32_t ssrc = ( (uint32_t) IVAS_RTP_OwnRandom( &rtpEncSeed ) & 0x0000FFFF ) | ( (uint32_t) IVAS_RTP_OwnRandom( &rtpEncSeed ) << 16 ); uint16_t seqNumInitVal = IVAS_RTP_OwnRandom( &rtpEncSeed ); +#ifdef FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API + uint8_t payloadType = DEFAULT_IVAS_PAYLOAD_TYPE; /* Dynamic PT are in range [96, 127] */ +#endif /*------------------------------------------------------------------------------------------* * Parse command-line arguments @@ -618,7 +621,11 @@ int main( if ( arg.rtpdumpOutput ) { +#ifdef FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API + if ( ( error = IVAS_RTP_WRITER_Init( &ivasRtp, arg.outputBitstreamFilename, arg.numFramesPerPacket, payloadType, ssrc, seqNumInitVal ) ) != IVAS_ERR_OK ) +#else if ( ( error = IVAS_RTP_WRITER_Init( &ivasRtp, arg.outputBitstreamFilename, arg.numFramesPerPacket, ssrc, seqNumInitVal ) ) != IVAS_ERR_OK ) +#endif { fprintf( stderr, "\nError: Can't open output bitstream file for RTP output %s \n\n", arg.outputBitstreamFilename ); goto cleanup; diff --git a/apps/encoder_fmtsw.c b/apps/encoder_fmtsw.c index 036144175bb19bd589391fcfe777b7c8f725a8ed..0222bef66f418843cbebac0a4d7896cc572dbebd 100644 --- a/apps/encoder_fmtsw.c +++ b/apps/encoder_fmtsw.c @@ -338,6 +338,9 @@ int encoder_main( uint16_t rtpEncSeed = RANDOM_INITSEED_ENC; uint32_t ssrc = ( (uint32_t) IVAS_RTP_OwnRandom( &rtpEncSeed ) & 0x0000FFFF ) | ( (uint32_t) IVAS_RTP_OwnRandom( &rtpEncSeed ) << 16 ); uint16_t seqNumInitVal = IVAS_RTP_OwnRandom( &rtpEncSeed ); +#ifdef FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API + uint8_t payloadType = DEFAULT_IVAS_PAYLOAD_TYPE; /* Dynamic PT are in range [96, 127] */ +#endif /*------------------------------------------------------------------------------------------* * Parse command-line arguments @@ -727,7 +730,11 @@ int encoder_main( if ( arg.rtpdumpOutput && init_RtpWriter ) { +#ifdef FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API + if ( ( error = IVAS_RTP_WRITER_Init( ivasRtp, arg.outputBitstreamFilename, arg.numFramesPerPacket, payloadType, ssrc, seqNumInitVal ) ) != IVAS_ERR_OK ) +#else if ( ( error = IVAS_RTP_WRITER_Init( ivasRtp, arg.outputBitstreamFilename, arg.numFramesPerPacket, ssrc, seqNumInitVal ) ) != IVAS_ERR_OK ) +#endif { fprintf( stderr, "\nError: Can't open output bitstream file for RTP output %s \n\n", arg.outputBitstreamFilename ); goto cleanup; diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index aac5939fce0fbd9da95f550c749ffe8ff5d6fb36..5b158d957fbb062f99105191ca8d803ec09d0825 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -68,6 +68,10 @@ #define IVAS_TIME_SCALE_MIN 50 /* min. time-scaling [%] */ #define IVAS_TIME_SCALE_MAX 150 /* max. time-scaling [%] */ +#ifdef FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API +/* RTP constants */ +#define DEFAULT_IVAS_PAYLOAD_TYPE ( 96 ) +#endif /*----------------------------------------------------------------------------------* * Common API enum for output audio configurations diff --git a/lib_com/options.h b/lib_com/options.h index 374e387ded1e7b70d3347b730ae54892e5e26eae..07ebed8ce3aa43dc6f99eab5d418e85f26c863da 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -99,6 +99,7 @@ #define FIX_1543_MID_LSF_BITS /* VA: float issue 1543: Resolve "MSAN: use-of-uninitialized-value in lib_enc/lsf_enc.c:262:5 for EVS encoder" */ #define FIX_2488_PREVENT_NEG_PITCH /* VA: Fix for 2488, use saturation to prevent possible wrap-around, thus negative pitch values */ #define FIX_1547_ISMDTX_HANDLE /* VA: float issue 1547: fix use of 'hISMDTX' handle */ +#define FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API /* Expose Payload Type setting in RTP Header */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_util/ivas_rtp_api.h b/lib_util/ivas_rtp_api.h index f196539fbbb22c65adabdc2e3b609f89a60a7f7d..db889f5625f63c73a9bbe7cd6d68db5cc84c1db9 100644 --- a/lib_util/ivas_rtp_api.h +++ b/lib_util/ivas_rtp_api.h @@ -303,8 +303,10 @@ void IVAS_RTP_PACK_Close( ); /* Update the RTP Header structure */ +#ifdef FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API ivas_error IVAS_RTP_PACK_UpdateHeader( IVAS_RTP_PACK_HANDLE hIvasPack, /* i/o: pointer to an IVAS rtp packer handle to be opened */ + uint8_t payloadType, /* i : 7-bit payload type indication, negotiated via sdp */ uint16_t seqNumInitVal, /* i : Initial sequence number to be used for 1st packet */ uint32_t ssrc, /* i : Unique 32-bit Source ID as negotiated during SDP */ uint8_t numCC, /* i : numCC indicates no. of contributing sources */ @@ -313,6 +315,18 @@ ivas_error IVAS_RTP_PACK_UpdateHeader( uint16_t numExtensionBytes, /* i : length of the extension data */ uint8_t *extData /* i : extension data pointer */ ); +#else +ivas_error IVAS_RTP_PACK_UpdateHeader( + IVAS_RTP_PACK_HANDLE hIvasPack, /* i/o: pointer to an IVAS rtp packer handle to be opened */ + uint16_t seqNumInitVal, /* i : Initial sequence number to be used for 1st packet */ + uint32_t ssrc, /* i : Unique 32-bit Source ID as negotiated during SDP */ + uint8_t numCC, /* i : numCC indicates no. of contributing sources */ + uint32_t *csrc, /* i : SSRCs of contributing Sources for a mixed stream */ + uint16_t extHeaderId, /* i : extension header ID */ + uint16_t numExtensionBytes, /* i : length of the extension data */ + uint8_t *extData /* i : extension data pointer */ +); +#endif /* Add requests for remote sender using a key value pair api * each key must be provided with a corresponding value type diff --git a/lib_util/ivas_rtp_file.c b/lib_util/ivas_rtp_file.c index 37d03a385e2474a9d169c638609fb80b2ce63c2e..3a6ccaddc376eb0b530f4cbd385ab05d2066223f 100644 --- a/lib_util/ivas_rtp_file.c +++ b/lib_util/ivas_rtp_file.c @@ -864,13 +864,24 @@ void IVAS_RTP_Term( } } +#ifdef FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API ivas_error IVAS_RTP_WRITER_Init( IVAS_RTP *rtp, /* i/o : IVAS RTP File writer handle */ const char *outputBitstreamFilename, /* i : RTP Dump filename */ uint32_t numFramesPerPacket, /* i : No. of frames per packet desired */ + uint8_t payloadType, /* i : Payload Type negotiated via sdp */ uint32_t SSRC, /* i : SSRC for RTP Header */ uint16_t seqNumInitVal /* i : Initial seq number in rtp header */ ) +#else +ivas_error IVAS_RTP_WRITER_Init( + IVAS_RTP *rtp, /* i/o : IVAS RTP File writer handle */ + const char *outputBitstreamFilename, /* i : RTP Dump filename */ + uint32_t numFramesPerPacket, /* i : No. of frames per packet desired */ + uint32_t SSRC, /* i : SSRC for RTP Header */ + uint16_t seqNumInitVal /* i : Initial seq number in rtp header */ +) +#endif { ivas_error error = IVAS_ERR_OK; @@ -891,7 +902,11 @@ ivas_error IVAS_RTP_WRITER_Init( return error; } +#ifdef FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API + error = IVAS_RTP_PACK_UpdateHeader( rtp->hPack, payloadType, seqNumInitVal, SSRC, 0, NULL, 0, 0, NULL ); +#else error = IVAS_RTP_PACK_UpdateHeader( rtp->hPack, seqNumInitVal, SSRC, 0, NULL, 0, 0, NULL ); +#endif if ( error != IVAS_ERR_OK ) { fprintf( stderr, "error in IVAS_RTP_PACK_UpdateHeader(): %d\n", error ); diff --git a/lib_util/ivas_rtp_file.h b/lib_util/ivas_rtp_file.h index a3742c6c81ad277a5d96f851a7bf6e660279f017..4483dea95b58926423fc9c8629a929f14ff5bdce 100644 --- a/lib_util/ivas_rtp_file.h +++ b/lib_util/ivas_rtp_file.h @@ -68,7 +68,11 @@ typedef struct IVAS_RTP_SR_INFO srInfo; } IVAS_RTP; +#ifdef FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API +ivas_error IVAS_RTP_WRITER_Init( IVAS_RTP *rtp, const char *outputBitstreamFilename, uint32_t numFramesPerPacket, uint8_t payloadType, uint32_t SSRC, uint16_t seqNumInitVal ); +#else ivas_error IVAS_RTP_WRITER_Init( IVAS_RTP *rtp, const char *outputBitstreamFilename, uint32_t numFramesPerPacket, uint32_t SSRC, uint16_t seqNumInitVal ); +#endif ivas_error IVAS_RTP_READER_Init( IVAS_RTP *rtp, const char *inputBitstreamFilename, const char *piOutputFilename, bool isExtOutput, const char *outputWavFilename ); void IVAS_RTP_Term( IVAS_RTP *rtp ); ivas_error IVAS_RTP_WriteNextFrame( IVAS_RTP *rtp, uint8_t *au, const IVAS_RTP_SR_INFO *srInfo, int16_t auSizeBits, bool isMono, bool forcePacket ); diff --git a/lib_util/ivas_rtp_payload.c b/lib_util/ivas_rtp_payload.c index 137c44119e9caeb85127be5bc74a75ab9124051c..77b1c641afbbba296a39f7ccafd756e8ff7cb3a1 100644 --- a/lib_util/ivas_rtp_payload.c +++ b/lib_util/ivas_rtp_payload.c @@ -173,8 +173,10 @@ static const uint32_t amrWBIOFrameSizeInBits[] = { /* Update the RTP Header structure */ +#ifdef FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API ivas_error IVAS_RTP_PACK_UpdateHeader( IVAS_RTP_PACK_HANDLE hPack, /* i/o: pointer to an IVAS rtp packer handle to be opened */ + uint8_t payloadType, /* i : 7-bit payload type indication, negotiated via sdp */ uint16_t seqNumInitVal, /* i : Initial sequence number to be used for 1st packet */ uint32_t ssrc, /* i : Unique 32-bit Source ID as negotiated during SDP */ uint8_t numCC, /* i : numCC indicates no. of contributing sources */ @@ -183,6 +185,18 @@ ivas_error IVAS_RTP_PACK_UpdateHeader( uint16_t numExtensionBytes, /* i : length of the extension data */ uint8_t *extData /* i : extension data pointer */ ) +#else +ivas_error IVAS_RTP_PACK_UpdateHeader( + IVAS_RTP_PACK_HANDLE hPack, /* i/o: pointer to an IVAS rtp packer handle to be opened */ + uint16_t seqNumInitVal, /* i : Initial sequence number to be used for 1st packet */ + uint32_t ssrc, /* i : Unique 32-bit Source ID as negotiated during SDP */ + uint8_t numCC, /* i : numCC indicates no. of contributing sources */ + uint32_t *csrc, /* i : SSRCs of contributing Sources for a mixed stream */ + uint16_t extHeaderId, /* i : extension header ID */ + uint16_t numExtensionBytes, /* i : length of the extension data */ + uint8_t *extData /* i : extension data pointer */ +) +#endif { RTP_HEADER *header = &hPack->header; @@ -191,6 +205,9 @@ ivas_error IVAS_RTP_PACK_UpdateHeader( return IVAS_ERROR( IVAS_ERR_WRONG_PARAMS, "CC must be less than 16" ); } +#ifdef FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API + header->payloadType = payloadType; +#endif header->seqNumber = seqNumInitVal; header->ssrc = ssrc; header->CC = numCC;