Implement RCC_DYN_PAYLOAD_TYPE

This change removes set_dynamic_payload() as ctx_configure() function
should be used for all context configuration instead of separate functions
for some configurations
This commit is contained in:
Aaro Altonen 2021-02-12 14:41:03 +02:00
parent ca66f6f8dc
commit c950179790
3 changed files with 12 additions and 15 deletions

View File

@ -143,9 +143,6 @@ namespace uvg_rtp {
void set_media_config(void *config);
void *get_media_config();
/* Overwrite the payload type set during initialization */
rtp_error_t set_dynamic_payload(uint8_t payload);
/* Get unique key of the media stream
* Used by session to index media streams */
uint32_t get_key();

View File

@ -217,6 +217,10 @@ enum RTP_CTX_CONFIGURATION_FLAGS {
* i.e. RTP_FORMAT_H26X and RTP_FORMAT_GENERIC with RCE_FRAGMENT_GENERIC (TODO) */
RCC_PKT_MAX_DELAY = 3,
/* Overwrite uvgRTP's own payload type in RTP packets and specify your own
* dynamic payload type for all packets of an RTP stream */
RCC_DYN_PAYLOAD_TYPE = 4,
RCC_LAST
};

View File

@ -617,6 +617,14 @@ rtp_error_t uvg_rtp::media_stream::configure_ctx(int flag, ssize_t value)
}
break;
case RCC_DYN_PAYLOAD_TYPE: {
if (value <= 0)
return RTP_INVALID_VALUE;
rtp_->set_dynamic_payload(value);
}
break;
default:
return RTP_INVALID_VALUE;
}
@ -629,18 +637,6 @@ uint32_t uvg_rtp::media_stream::get_key()
return key_;
}
rtp_error_t uvg_rtp::media_stream::set_dynamic_payload(uint8_t payload)
{
if (!initialized_) {
LOG_ERROR("RTP context has not been initialized fully, cannot continue!");
return RTP_NOT_INITIALIZED;
}
rtp_->set_dynamic_payload(payload);
return RTP_OK;
}
uvg_rtp::rtcp *uvg_rtp::media_stream::get_rtcp()
{
return rtcp_;