Commit 891368ed authored by Mickaël Turnel's avatar Mickaël Turnel

Immediate NACK mode is enabled/disabled by the nack context object itself

parent 6b925368
......@@ -214,7 +214,6 @@ typedef struct OrtpRtcpSendAlgorithm {
typedef struct OrtpRtcpFbConfiguration {
bool_t generic_nack_enabled;
bool_t immediate_nack_enabled;
bool_t tmmbr_enabled;
} OrtpRtcpFbConfiguration;
......
......@@ -207,6 +207,8 @@ OrtpNackContext *ortp_nack_context_new(OrtpEvDispatcher *evt) {
qinit(&userData->sent_packets);
bctbx_mutex_init(&userData->sent_packets_mutex, NULL);
rtp_session_enable_avpf_feature(userData->session, ORTP_AVPF_FEATURE_IMMEDIATE_NACK, TRUE);
ortp_ev_dispatcher_connect(userData->ev_dispatcher
, ORTP_EVENT_RTCP_PACKET_RECEIVED
, RTCP_RTPFB
......@@ -222,6 +224,8 @@ void ortp_nack_context_destroy(OrtpNackContext *ctx) {
, RTCP_RTPFB
, (OrtpEvDispatcherCb)generic_nack_received);
rtp_session_enable_avpf_feature(ctx->session, ORTP_AVPF_FEATURE_IMMEDIATE_NACK, FALSE);
bctbx_mutex_lock(&ctx->sent_packets_mutex);
flushq(&ctx->sent_packets, FLUSHALL);
bctbx_mutex_unlock(&ctx->sent_packets_mutex);
......
......@@ -248,7 +248,7 @@ static void report_block_init(report_block_t *b, RtpSession *session){
packet_loss = (int)(expected_packets - stream->hwrcv_since_last_SR);
session->stats.cum_packet_loss += packet_loss;
}
if (expected_packets>0){/*prevent division by zero and negative loss fraction*/
if (expected_packets>0 && packet_loss > 0){/*prevent division by zero and negative loss fraction*/
loss_fraction=(int)( 256 * packet_loss) / expected_packets;
/*make sure this fits into 8 bit unsigned*/
if (loss_fraction>255) loss_fraction=255;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment