Add metric for number of packets discarded by JB due to not being decodable
Also fixes a couple of bugs related to sequence number wrap found while
testing.
BUG=
TEST=
Review URL: http://webrtc-codereview.appspot.com/218001
git-svn-id: http://webrtc.googlecode.com/svn/trunk@732 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/src/modules/video_coding/main/source/session_info.cc b/src/modules/video_coding/main/source/session_info.cc
index 3b416d2..58d95dc 100644
--- a/src/modules/video_coding/main/source/session_info.cc
+++ b/src/modules/video_coding/main/source/session_info.cc
@@ -8,13 +8,9 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "packet.h"
#include "session_info.h"
-#include <string.h>
-#include <cassert>
-
-#include "internal_defines.h"
+#include "packet.h"
namespace webrtc {
@@ -29,7 +25,8 @@
_highestPacketIndex(0),
_emptySeqNumLow(-1),
_emptySeqNumHigh(-1),
- _markerSeqNum(-1)
+ _markerSeqNum(-1),
+ _packetsNotDecodable(0)
{
}
@@ -55,7 +52,7 @@
WebRtc_Word32
VCMSessionInfo::GetHighSeqNum() const
{
- return VCM_MAX(_emptySeqNumHigh, _highSeqNum);
+ return LatestSequenceNumber(_emptySeqNumHigh, _highSeqNum, NULL);
}
void
@@ -73,6 +70,7 @@
_sessionNACK = false;
_highestPacketIndex = 0;
_markerSeqNum = -1;
+ _packetsNotDecodable = 0;
}
WebRtc_UWord32
@@ -202,7 +200,7 @@
}
}
-bool VCMSessionInfo::IsSessionComplete()
+bool VCMSessionInfo::IsSessionComplete() const
{
return _completeSession;
}
@@ -287,6 +285,7 @@
{
bytesToDelete += _packets[j].sizeBytes;
_packets[j].Reset();
+ ++_packetsNotDecodable;
}
if (bytesToDelete > 0)
{
@@ -362,7 +361,7 @@
return new_length;
}
-int VCMSessionInfo::FindNextPartitionBeginning(int packet_index) const {
+int VCMSessionInfo::FindNextPartitionBeginning(int packet_index) {
while (packet_index <= _highestPacketIndex) {
if (_packets[packet_index].completeNALU == kNaluUnset) {
// Missing packet
@@ -371,8 +370,13 @@
}
const bool beginning = _packets[packet_index].codecSpecificHeader.
codecHeader.VP8.beginningOfPartition;
- if (beginning)
+ if (beginning) {
return packet_index;
+ } else {
+ // This packet belongs to a partition with a previous loss and can't
+ // be decoded.
+ ++_packetsNotDecodable;
+ }
++packet_index;
}
return packet_index;
@@ -433,7 +437,7 @@
}
returnLength += DeletePackets(ptrStartOfLayer,
- packetIndex, endIndex);
+ packetIndex + 1, endIndex);
packetIndex = endIndex;
}// end lost packet
}
@@ -636,7 +640,7 @@
}
bool
-VCMSessionInfo::HaveLastPacket()
+VCMSessionInfo::HaveLastPacket() const
{
return _markerBit;
}
@@ -649,25 +653,11 @@
}
bool
-VCMSessionInfo::IsRetransmitted()
+VCMSessionInfo::IsRetransmitted() const
{
return _sessionNACK;
}
-void
-VCMSessionInfo::UpdatePacketSize(WebRtc_Word32 packetIndex,
- WebRtc_UWord32 length)
-{
- // sanity
- if (packetIndex >= kMaxPacketsInJitterBuffer || packetIndex < 0)
- {
- // not allowed
- assert(!"SessionInfo::UpdatePacketSize Error: invalid packetIndex");
- return;
- }
- _packets[packetIndex].sizeBytes = length;
-}
-
WebRtc_Word64
VCMSessionInfo::InsertPacket(const VCMPacket& packet,
WebRtc_UWord8* ptrStartOfLayer)
@@ -848,6 +838,7 @@
// missing the previous packet.
memset(ptrFirstByte, 0, _packets[i].sizeBytes);
previousLost = true;
+ ++_packetsNotDecodable;
}
else if (_packets[i].sizeBytes > 0) // Ignore if empty packet
{
@@ -870,6 +861,7 @@
{
memset(ptrStartOfLayer, 0, _packets[i].sizeBytes);
previousLost = true;
+ ++_packetsNotDecodable;
}
}
else if (_packets[i].sizeBytes == 0 && codec == kVideoCodecH263)
@@ -899,4 +891,8 @@
return length;
}
+int VCMSessionInfo::NotDecodablePackets() const {
+ return _packetsNotDecodable;
+}
+
}