aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2020-06-29 17:06:43 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2020-06-29 17:06:43 +0200
commit35867ba39effd3c40b727e90163d406d4abcd2bf (patch)
treefc7c9f85d7fedf42134facb398c0021f7c914830
parentbda603e4d1d963f499b2f1a13d16c5a23e9f0246 (diff)
downloadODR-SourceCompanion-35867ba39effd3c40b727e90163d406d4abcd2bf.tar.gz
ODR-SourceCompanion-35867ba39effd3c40b727e90163d406d4abcd2bf.tar.bz2
ODR-SourceCompanion-35867ba39effd3c40b727e90163d406d4abcd2bf.zip
Add RTP sequence number check
-rw-r--r--src/AVTInput.cpp8
-rw-r--r--src/AVTInput.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/src/AVTInput.cpp b/src/AVTInput.cpp
index 955ca33..ab6be76 100644
--- a/src/AVTInput.cpp
+++ b/src/AVTInput.cpp
@@ -216,6 +216,14 @@ const uint8_t* AVTInput::_findDABFrameFromUDP(const uint8_t* buf, size_t size,
uint32_t version = (buf[index] & 0xC0) >> 6;
uint32_t payloadType = (buf[index+1] & 0x7F);
if (version == 2 && payloadType == 34) {
+ const uint16_t seqnr = (buf[index+2] << 8) | buf[index+3];
+ if ((_previousRtpIndex != -1) and
+ (((_previousRtpIndex + 1) % 0xFFFF) != seqnr)) {
+ fprintf(stderr, "RTP sequence number jump from %d to %d\n",
+ _previousRtpIndex, seqnr);
+ }
+ _previousRtpIndex = seqnr;
+
#if 0
// If one wants to decode the RTP timestamp, here is some
// example code. The AVT generates a timestamp which starts
diff --git a/src/AVTInput.h b/src/AVTInput.h
index 71805c7..294f48f 100644
--- a/src/AVTInput.h
+++ b/src/AVTInput.h
@@ -120,6 +120,7 @@ class AVTInput
std::vector<uint8_t> _currentFrame;
int32_t _nbFrames = 0;
int32_t _expectedFrameIndex = 0;
+ int32_t _previousRtpIndex = -1;
std::chrono::system_clock::time_point _frameZeroTimestamp;
size_t _currentFrameSize = 0;