multiplex: Add option to manually set remote SSRC of media stream

This commit is contained in:
Heikki Tampio 2023-04-19 12:47:36 +03:00
parent 0298c9e9a9
commit 0a554938d0
3 changed files with 19 additions and 4 deletions

View File

@ -422,6 +422,7 @@ namespace uvgrtp {
ssize_t fps_denominator_ = 1;
uint32_t bandwidth_ = 0;
std::shared_ptr<std::atomic<std::uint32_t>> ssrc_;
std::shared_ptr<std::atomic<std::uint32_t>> remote_ssrc_;
};
}

View File

@ -363,12 +363,18 @@ enum RTP_CTX_CONFIGURATION_FLAGS {
*/
RCC_FPS_DENOMINATOR = 9,
/** Set the SSRC of the stream manually
/** Set the local SSRC of the stream manually
*
* By default SSRC is generated randomly
* By default local SSRC is generated randomly
*/
RCC_SSRC = 10,
/** Set the remote SSRC of the stream manually
*
* By default remote SSRC is generated randomly
*/
RCC_REMOTE_SSRC = 11,
/** Set bandwidth for the session
*
* uvgRTP chooses this automatically depending on the format of the data being transferred.
@ -381,7 +387,7 @@ enum RTP_CTX_CONFIGURATION_FLAGS {
* Larger bandwidth values result in shorter RTCP intervals, and vice versa.
* See RFC 3550 Appendix A.7 for further information on RTCP interval
*/
RCC_SESSION_BANDWIDTH = 11,
RCC_SESSION_BANDWIDTH = 12,
/// \cond DO_NOT_DOCUMENT
RCC_LAST

View File

@ -58,7 +58,8 @@ uvgrtp::media_stream::media_stream(std::string cname, std::string remote_addr,
cname_(cname),
fps_numerator_(30),
fps_denominator_(1),
ssrc_(std::make_shared<std::atomic<std::uint32_t>>(uvgrtp::random::generate_32()))
ssrc_(std::make_shared<std::atomic<std::uint32_t>>(uvgrtp::random::generate_32())),
remote_ssrc_(std::make_shared<std::atomic<std::uint32_t>>(uvgrtp::random::generate_32()))
{
//socket_ = sfp_->create_new_socket();
//holepuncher_ = std::unique_ptr<uvgrtp::holepuncher>(new uvgrtp::holepuncher(socket_));
@ -768,6 +769,13 @@ rtp_error_t uvgrtp::media_stream::configure_ctx(int rcc_flag, ssize_t value)
*ssrc_ = (uint32_t)value;
break;
}
case RCC_REMOTE_SSRC: {
if (value <= 0 || value > (ssize_t)UINT32_MAX)
return RTP_INVALID_VALUE;
*remote_ssrc_ = (uint32_t)value;
break;
}
default:
return RTP_INVALID_VALUE;
}