/// Demultiplexes combined RTP and RTCP streams.
///
/// This is subject to the profile restrictions under [RFC 5761],
/// which restricts the set of allowed payload types. In particular,
/// this implementation returns an [`RtcpPacket`]
/// if its packet type matches any known [RTCP packet type].
///
/// Returns `None` if the `pkt` is too short (less than 2 bytes).
///
/// [RFC 5761]: https://tools.ietf.org/html/rfc5761#section-4
/// [`RtcpPacket`]: ../rtcp/struct.RtcpPacket.html
/// [RTCP packet type]: ../rtcp/enum.RtcpType.html
Demultiplexes combined RTP and RTCP streams.
This is subject to the profile restrictions under [RFC 5761],
which restricts the set of allowed payload types. In particular,
this implementation returns an [`RtcpPacket`]
if its packet type matches any known [RTCP packet type].

Returns `None` if the `pkt` is too short (less than 2 bytes).


Demultiplexes combined RTP and RTCP streams . This is subject to the profile restrictions under [ RFC 5761 ] which restricts the set of allowed payload types . In particular this implementation returns an [ ` RtcpPacket ` ] if its packet type matches any known [ RTCP packet type ] . Returns ` None ` if the ` pkt ` is too short ( less than 2 bytes ) .
pub fn demux(pkt: &[u8]) -> Demuxed {
	if pkt.len() < 2 {
		Demuxed::TooSmall
	} else {
		let pt = classify_pt(pkt);
		match pt {
			DemuxType::Rtp(_) => RtpPacket::new(pkt).map(Demuxed::Rtp),
			DemuxType::Rtcp(rt) => rt.decode(pkt).map(Demuxed::Rtcp),
		}
		.unwrap_or(Demuxed::FailedParse(pt))
	}
}
pub fn demux ( pkt : & [ u8 ] ) -> Demuxed { if pkt . len ( ) < 2 { Demuxed :: TooSmall } else { let pt = classify_pt ( pkt ) ; match pt { DemuxType :: Rtp ( _ ) => RtpPacket :: new ( pkt ) . map ( Demuxed :: Rtp ) , DemuxType :: Rtcp ( rt ) => rt . decode ( pkt ) . map ( Demuxed :: Rtcp ) , } . unwrap_or ( Demuxed :: FailedParse ( pt ) ) } }
Demultiplexes combined RTP and RTCP streams.
Demultiplexes combined RTP and RTCP streams .
pkt
&[u8]