Move helpers to parse base rtp packet fields to rtp_rtcp module
rtp_rtcp_format is lighter build target than rtc_media_base and a more natural place to keep rtp parsing functions. Bug: None Change-Id: Ibcb5661cc65edbdc89a63f3e411d7ad1218353cc Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/226330 Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Reviewed-by: Niels Moller <nisse@webrtc.org> Reviewed-by: Henrik Boström <hbos@webrtc.org> Cr-Commit-Position: refs/heads/master@{#34504}
This commit is contained in:
committed by
WebRTC LUCI CQ
parent
4261a73b56
commit
99a71f49c0
@ -14,6 +14,8 @@
|
||||
#include <cstdint>
|
||||
|
||||
#include "api/array_view.h"
|
||||
#include "modules/rtp_rtcp/source/byte_io.h"
|
||||
#include "rtc_base/checks.h"
|
||||
|
||||
namespace webrtc {
|
||||
namespace {
|
||||
@ -43,4 +45,19 @@ bool IsRtcpPacket(rtc::ArrayView<const uint8_t> packet) {
|
||||
PayloadTypeIsReservedForRtcp(packet[1] & 0x7F);
|
||||
}
|
||||
|
||||
int ParseRtpPayloadType(rtc::ArrayView<const uint8_t> rtp_packet) {
|
||||
RTC_DCHECK(IsRtpPacket(rtp_packet));
|
||||
return rtp_packet[1] & 0x7F;
|
||||
}
|
||||
|
||||
uint16_t ParseRtpSequenceNumber(rtc::ArrayView<const uint8_t> rtp_packet) {
|
||||
RTC_DCHECK(IsRtpPacket(rtp_packet));
|
||||
return ByteReader<uint16_t>::ReadBigEndian(rtp_packet.data() + 2);
|
||||
}
|
||||
|
||||
uint32_t ParseRtpSsrc(rtc::ArrayView<const uint8_t> rtp_packet) {
|
||||
RTC_DCHECK(IsRtpPacket(rtp_packet));
|
||||
return ByteReader<uint32_t>::ReadBigEndian(rtp_packet.data() + 8);
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
Reference in New Issue
Block a user