#![warn(rust_2018_idioms)]
#![warn(missing_docs)]
#![allow(dead_code)]
use std::time::Instant;
pub(crate) mod chain;
pub(crate) mod noop;
pub(crate) mod pass_through;
pub(crate) mod registry;
pub(crate) mod adaptive_jitter_buffer;
pub(crate) mod audio_red;
pub(crate) mod cc;
pub(crate) mod circuit_breaker;
pub(crate) mod flexfec;
pub(crate) mod gcc;
pub(crate) mod intervalpli;
pub(crate) mod jitterbuffer;
pub(crate) mod keyframe;
pub(crate) mod nack;
pub(crate) mod never_sent;
pub(crate) mod ntp_timestamp;
pub(crate) mod pacing;
pub(crate) mod packet;
pub(crate) mod pause_resume;
pub(crate) mod report;
pub(crate) mod rfc8888;
pub(crate) mod rtcp_session;
pub(crate) mod rtp_session;
pub(crate) mod rtpfb;
pub(crate) mod stream_info;
pub(crate) mod tst;
pub(crate) mod twcc;
pub(crate) mod ulpfec;
pub(crate) mod wire_image;
pub(crate) mod xr;
pub use adaptive_jitter_buffer::{
JitterBufferBuilder as AdaptiveJitterBufferBuilder, JitterBufferControl,
JitterBufferInterceptor as AdaptiveJitterBufferInterceptor,
};
pub use audio_red::{
AudioRedundancy, RED_AUDIO_DEFAULT_MAX_PAYLOAD_SIZE, RED_AUDIO_DEFAULT_REDUNDANCY,
RedAudioBuilder, RedAudioInterceptor,
};
pub use cc::estimator::{BandwidthEstimator, ConstantBitrate, EstimatorStats};
pub use cc::fec_rate::{FecRate, MIN_LOSS as FEC_MIN_LOSS};
pub use cc::feedback::{CongestionFeedbackFormat, negotiated_congestion_feedback};
pub use cc::interceptor::{
CongestionControlBuilder, CongestionControlHandle, CongestionControlInterceptor,
DEFAULT_PRUNE_HORIZON as CONGESTION_CONTROL_DEFAULT_PRUNE_HORIZON, REMB_TIMEOUT,
};
pub use cc::probe::{
PROBE_AFTER_DROP_TIMEOUT, PROBE_APPLICATION_LIMITED_INTERVAL, PROBE_MAX_OCTETS,
PROBE_MIN_DURATION, PROBE_MIN_PACKETS, PROBE_RESULT_TIMEOUT, ProbeController, ProbePacket,
ProbeRequest, probe_estimate,
};
pub use cc::tmmbr::{TMMBR_OWNER_TIMEOUT, TmmbEntry};
pub use cc::tmmbr_request::{TMMBR_REPEAT_INTERVAL, TmmbrControl};
pub use circuit_breaker::{
CircuitBreakerBuilder, CircuitBreakerHandle, CircuitBreakerInterceptor, CircuitBreakerReason,
CircuitBreakerState,
DEFAULT_NON_REPORTING_THRESHOLD as CIRCUIT_BREAKER_NON_REPORTING_THRESHOLD,
DEFAULT_RTCP_INTERVAL as CIRCUIT_BREAKER_RTCP_INTERVAL, MediaUsability,
PacketSize as CircuitBreakerPacketSize,
};
pub use flexfec::bit_array::BitArray;
pub use flexfec::coverage::{MAX_FEC_PACKETS, MAX_MEDIA_PACKETS, ProtectionCoverage};
pub use flexfec::draft03::decoder::{FlexFec03Decoder, ParseError as FlexFecParseError};
pub use flexfec::draft03::encoder::DRAFT03_MAX_MEDIA_PACKETS as FLEXFEC03_MAX_MEDIA_PACKETS;
pub use flexfec::draft03::encoder::FlexFec03Encoder;
pub use flexfec::draft03::receiver::{FlexFec03ReceiveBuilder, FlexFec03ReceiveInterceptor};
pub use flexfec::draft03::sender::{
DEFAULT_NUM_FEC_PACKETS, DEFAULT_NUM_MEDIA_PACKETS, FlexFec03SendBuilder,
FlexFec03SendInterceptor,
};
pub use flexfec::rfc8627::decoder::{
FLEXFEC_DEFAULT_REPAIR_WINDOW, FlexFecDecoder, FlexFecDecoderConfig, FlexFecDecoderStats,
};
pub use flexfec::rfc8627::encoder::{
FlexFecEncodeError, FlexFecEncoder, FlexFecLayout, FlexFecProtection,
};
pub use flexfec::rfc8627::header::{
FLEXFEC_MAX_MASK_BITS, FLEXFEC_MAX_PROTECTED_SSRCS, FLEXFEC_RECOVERY_SIZE, FlexFecBlock,
FlexFecHeader, FlexFecHeaderError, FlexFecProtected,
};
pub use flexfec::rfc8627::params::FlexFecParameters;
pub use flexfec::rfc8627::receiver::{
FLEXFEC_MAX_REPAIR_WINDOW, FlexFecReceiveBuilder, FlexFecReceiveInterceptor,
};
pub use flexfec::rfc8627::sender::{
FLEXFEC_DEFAULT_PROTECTION, FlexFecSendBuilder, FlexFecSendInterceptor,
};
pub use gcc::arrival_group::{
ArrivalGroup, ArrivalGroupAccumulator, DEFAULT_BURST_INTERVAL as GCC_DEFAULT_BURST_INTERVAL,
InterGroupDelay,
};
pub use gcc::estimator::{
DEFAULT_INITIAL_BITRATE as GCC_INITIAL_BITRATE, DEFAULT_MAX_BITRATE as GCC_MAX_BITRATE,
DEFAULT_MIN_BITRATE as GCC_MIN_BITRATE, Gcc,
};
pub use gcc::kalman::Kalman;
pub use gcc::loss::{
DEFAULT_HIGH_LOSS as GCC_HIGH_LOSS, DEFAULT_LOSS_INTERVAL as GCC_LOSS_INTERVAL,
DEFAULT_LOW_LOSS as GCC_LOW_LOSS, LossController,
};
pub use gcc::overuse::{DEFAULT_OVERUSE_TIME as GCC_DEFAULT_OVERUSE_TIME, OveruseDetector, Usage};
pub use gcc::queue_limit::{
QUEUE_AT_LIMIT_MIN_DELAY, QUEUE_AT_LIMIT_SHARE, QUEUE_BASE_WINDOW, QUEUE_HIGH_WINDOW,
QueueLimitDetector,
};
pub use gcc::rate_calc::{DEFAULT_WINDOW as GCC_RATE_WINDOW, RateCalculator};
pub use gcc::rate_control::{
DEFAULT_DECREASE_FACTOR as GCC_DECREASE_FACTOR, DEFAULT_INCREASE_FACTOR as GCC_INCREASE_FACTOR,
DEFAULT_RATE_CONTROL_INTERVAL as GCC_RATE_CONTROL_INTERVAL, RateController, ReceivedRateBound,
};
pub use gcc::remb::{
ABS_SEND_TIME_SLOT, ABS_SEND_TIME_URI, AbsSendTimeInterceptor, GOOG_REMB,
REMB_DECREASE_TRIGGER, REMB_GENERATOR_SLOT, REMB_INITIALIZATION_TIME, REMB_MAX_INTERVAL,
REMB_UPDATE_INTERVAL, RembGeneratorBuilder, RembGeneratorInterceptor,
};
pub use gcc::slope::{DelayTrend, SlopeEstimator};
pub use gcc::state::RateControlState;
pub use gcc::threshold::{
AdaptiveThreshold, DEFAULT_INITIAL_MS as GCC_THRESHOLD_INITIAL_MS, ThresholdTimeBase,
};
pub use gcc::twcc_gcc::{GccHandle, GccInterceptor, GccInterceptorBuilder, GccShared};
pub use interceptor_derive::{Interceptor, interceptor};
pub use intervalpli::generator::{
DEFAULT_INTERVAL as INTERVAL_PLI_DEFAULT_INTERVAL, IntervalPliInterceptor,
};
pub use jitterbuffer::buffer::{
JitterBuffer, JitterBufferStats, Rejected, State as JitterBufferState,
};
pub use jitterbuffer::receiver::{
DEFAULT_CAPACITY as JITTER_BUFFER_DEFAULT_CAPACITY,
DEFAULT_DEPTH as JITTER_BUFFER_DEFAULT_DEPTH, JitterBufferBuilder, JitterBufferInterceptor,
};
pub use keyframe::{FirCommands, KeyFrameRequestInterceptor};
pub use nack::NackControl;
pub use nack::generator::{
NackGeneratorBuilder, NackGeneratorInterceptor,
SUGGESTED_MAX_NACKS_PER_PACKET as NACK_SUGGESTED_MAX_NACKS_PER_PACKET,
SUGGESTED_MAX_PACKET_AGE as NACK_SUGGESTED_MAX_PACKET_AGE,
};
pub use nack::responder::{
MAX_RETRANSMISSION_RESERVE, MinimumTarget, NackResponderBuilder, NackResponderInterceptor,
PENDING_REQUEST_LIFETIME, PROBE_PADDING_OCTETS, RETRANSMISSION_RATE_WINDOW,
RetransmissionRateLimit, RetransmissionReserve,
};
pub use noop::NoopInterceptor;
pub use ntp_timestamp::{
NTP_TIMESTAMP_INITIAL_WINDOW, NTP_TIMESTAMP_INTERVAL, NTP_TIMESTAMP_SLOT, NtpTimestampBuilder,
NtpTimestampInterceptor,
};
pub use pacing::pacer::{
BURST_TIME as PACER_BURST_TIME, MIN_BURST_BITS as PACER_MIN_BURST_BITS, Pacer,
};
pub use pacing::sender::{
DEFAULT_BITRATE as PACER_DEFAULT_BITRATE, DEFAULT_QUEUE_LIMIT as PACER_DEFAULT_QUEUE_LIMIT,
DEFAULT_QUEUE_TIME_LIMIT as PACER_DEFAULT_QUEUE_TIME_LIMIT, PacerBuilder, PacerDiscard,
PacerInterceptor, PacerPause, QueueOverflow as PacerQueueOverflow, RetransmissionsLeft,
};
pub use packet::{Attribute, AttributedPacket, Packet, TaggedPacket};
pub use pass_through::PassThroughInterceptor;
pub use pause_resume::{
PAUSE_DEFAULT_REPORT_INTERVAL, PAUSE_DEFAULT_ROUND_TRIP_TIME, PAUSED_REPETITIONS,
PauseCapability, PauseResumeBuilder, PauseResumeControl, PauseResumeHandle,
PauseResumeInterceptor, PauseState, RTCP_FB_CCM_PAUSE, RemotePauseState, pause_config_answer,
};
pub use registry::{Registry, Slot};
pub use report::receiver::{RTCP_FB_RRTR, ReceiverReportBuilder, ReceiverReportInterceptor};
pub use report::sender::{SenderReportBuilder, SenderReportInterceptor};
pub use rfc8888::ecn::{
CONFIRMATIONS as ECN_CONFIRMATIONS, DEFAULT_RETRY_AFTER as ECN_DEFAULT_RETRY_AFTER, EcnFailure,
EcnInitiation, EcnMarking, EcnState, EcnValidation, EctPreference,
PROBE_INTERVAL as ECN_PROBE_INTERVAL, PROBE_SPACING as ECN_PROBE_SPACING,
};
pub use rfc8888::recorder::CcFeedbackRecorder;
pub use rfc8888::sender::{
DEFAULT_INTERVAL as RFC8888_DEFAULT_INTERVAL,
DEFAULT_MAX_REPORT_SIZE as RFC8888_DEFAULT_MAX_REPORT_SIZE, Rfc8888Builder, Rfc8888Interceptor,
};
pub use rtcp_session::identity::{RtcpRandom, generate_rtcp_cname};
pub use rtcp_session::{
RTCP_SESSION_DEFAULT_MTU, RTCP_SESSION_DEFAULT_T_RR_INTERVAL, RTCP_SESSION_MIN_BANDWIDTH,
RTCP_SESSION_NOMINAL_AUDIO_BANDWIDTH, RTCP_SESSION_NOMINAL_VIDEO_BANDWIDTH,
RepeatInRegularReports, RtcpBandwidth, RtcpProfile, RtcpSessionBuilder, RtcpSessionControl,
RtcpSessionEvent, RtcpSessionInterceptor,
};
pub use rtp_session::{PathChanged, PerRtpSession, RtpSession, RtpSessionAssignment};
pub use rtpfb::acknowledgement::{Acknowledgement, PacketReport, Report};
pub use rtpfb::convert::{FeedbackTimeline, convert_ccfb, convert_twcc};
pub use rtpfb::history::History;
pub use stream_info::{RTCPFeedback, RTPHeaderExtension, StreamInfo};
pub use tst::{TstnResponderBuilder, TstnResponderInterceptor, TstrCommands, VbcmCommands};
pub use twcc::receiver::{TwccReceiverBuilder, TwccReceiverInterceptor};
pub use twcc::sender::{TwccSenderBuilder, TwccSenderInterceptor};
pub use ulpfec::decoder::{ULPFEC_MAX_HELD_FEC, ULPFEC_MEDIA_WINDOW};
pub use ulpfec::sender::{ULPFEC_DEFAULT_NUM_FEC_PACKETS, ULPFEC_DEFAULT_NUM_MEDIA_PACKETS};
pub use ulpfec::{
FEC_HEADER_LENGTH as ULPFEC_HEADER_LENGTH, LONG_MASK_BITS as ULPFEC_LONG_MASK_BITS,
MAX_LEVELS as ULPFEC_MAX_LEVELS, ProtectionLevel as UlpfecProtectionLevel, RedFecPayload,
RedPlacement, SHORT_MASK_BITS as ULPFEC_SHORT_MASK_BITS, UlpfecDecoder, UlpfecDecoderStats,
UlpfecEncoder, UlpfecError, UlpfecLevel, UlpfecPacket, UlpfecReceiveBuilder,
UlpfecReceiveInterceptor, UlpfecRepair, UlpfecSendBuilder, UlpfecSendInterceptor,
UlpfecStreamPacketizer, depacketize_red as depacketize_red_for_ulpfec,
one_level_only_from_fmtp as ulpfec_one_level_only_from_fmtp,
validate_scheme as validate_ulpfec_scheme,
};
pub use wire_image::{MAX_HELD_WIRE_IMAGES, WireImageTap, WireImages, wire_image_tap};
pub use xr::{
DEFAULT_GMIN as XR_DEFAULT_GMIN, DEFAULT_INTERVAL as XR_DEFAULT_INTERVAL, JitterBufferMetrics,
RTCP_FB_NACK_ECN, RTCP_FB_XR, RTCP_XR_ECN_SUMMARY, XrReportBuilder, XrReportInterceptor,
};
pub trait Interceptor:
sansio::Protocol<
TaggedPacket,
TaggedPacket,
(),
Rout = TaggedPacket,
Wout = TaggedPacket,
Eout = (),
Time = Instant,
Error = shared::error::Error,
> + Send
+ Sync
{
fn with<O, F>(self, f: F) -> O
where
Self: Sized,
F: FnOnce(Self) -> O,
O: Interceptor,
{
f(self)
}
fn bind_local_stream(&mut self, info: &StreamInfo);
fn unbind_local_stream(&mut self, info: &StreamInfo);
fn move_local_stream_out(&mut self, info: &StreamInfo) {
self.unbind_local_stream(info);
}
fn bind_remote_stream(&mut self, info: &StreamInfo);
fn unbind_remote_stream(&mut self, info: &StreamInfo);
}
pub type BoxedInterceptor = Box<dyn Interceptor>;
impl<P: Interceptor + ?Sized> Interceptor for Box<P> {
fn bind_local_stream(&mut self, info: &StreamInfo) {
(**self).bind_local_stream(info)
}
fn unbind_local_stream(&mut self, info: &StreamInfo) {
(**self).unbind_local_stream(info)
}
fn bind_remote_stream(&mut self, info: &StreamInfo) {
(**self).bind_remote_stream(info)
}
fn unbind_remote_stream(&mut self, info: &StreamInfo) {
(**self).unbind_remote_stream(info)
}
}
impl<P: Interceptor + ?Sized> Interceptor for &mut P {
fn bind_local_stream(&mut self, info: &StreamInfo) {
(**self).bind_local_stream(info)
}
fn unbind_local_stream(&mut self, info: &StreamInfo) {
(**self).unbind_local_stream(info)
}
fn bind_remote_stream(&mut self, info: &StreamInfo) {
(**self).bind_remote_stream(info)
}
fn unbind_remote_stream(&mut self, info: &StreamInfo) {
(**self).unbind_remote_stream(info)
}
}