RTCP: Implement the ability to set session bandwidth via a context flag
Session bandwidth affects the RTCP packet transmission interval. Related to issue #65.
This commit is contained in:
parent
371a3fa816
commit
9dff5f3c58
|
@ -345,6 +345,8 @@ namespace uvgrtp {
|
|||
|
||||
ssize_t fps_numerator_ = 30;
|
||||
ssize_t fps_denominator_ = 1;
|
||||
uint32_t bandwidth_ = 0;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -362,6 +362,15 @@ enum RTP_CTX_CONFIGURATION_FLAGS {
|
|||
* See RCC_FPS_NUMERATOR for more info.
|
||||
*/
|
||||
RCC_FPS_DENOMINATOR = 9,
|
||||
|
||||
/** Set bandwidth for the session
|
||||
*
|
||||
* uvgRTP chooses this automatically depending on the format of the data being transferred.
|
||||
* It is possible to manually set it in order to change the interval at which RTCP
|
||||
* reports are being sent.
|
||||
*/
|
||||
RCC_SESSION_BANDWIDTH = 10,
|
||||
|
||||
/// \cond DO_NOT_DOCUMENT
|
||||
RCC_LAST
|
||||
/// \endcond
|
||||
|
|
|
@ -395,7 +395,8 @@ rtp_error_t uvgrtp::media_stream::start_components()
|
|||
else
|
||||
{
|
||||
rtcp_->add_participant(local_address_, remote_address_, src_port_ + 1, dst_port_ + 1, rtp_->get_clock_rate());
|
||||
rtcp_->set_session_bandwidth(get_default_bandwidth_kbps(fmt_));
|
||||
bandwidth_ = get_default_bandwidth_kbps(fmt_);
|
||||
rtcp_->set_session_bandwidth(bandwidth_);
|
||||
rtcp_->start();
|
||||
}
|
||||
}
|
||||
|
@ -659,7 +660,19 @@ rtp_error_t uvgrtp::media_stream::configure_ctx(int rcc_flag, ssize_t value)
|
|||
|
||||
media_->set_fps(fps_numerator_, fps_denominator_);
|
||||
break;
|
||||
}
|
||||
}
|
||||
case RCC_SESSION_BANDWIDTH: {
|
||||
bandwidth_ = value;
|
||||
// TODO: Is there a max value for bandwidth?
|
||||
if (value <= 0) {
|
||||
UVG_LOG_WARN("Bandwidth cannot be negative");
|
||||
return RTP_INVALID_VALUE;
|
||||
}
|
||||
if (rtcp_) {
|
||||
rtcp_->set_session_bandwidth(bandwidth_);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
return RTP_INVALID_VALUE;
|
||||
|
|
Loading…
Reference in New Issue