video_coding: Allowing for a decodable state independent of selective nacking
Review URL: http://webrtc-codereview.appspot.com/263001
git-svn-id: http://webrtc.googlecode.com/svn/trunk@993 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 799a5d3..58206d0 100644
--- a/src/modules/video_coding/main/source/session_info.cc
+++ b/src/modules/video_coding/main/source/session_info.cc
@@ -18,6 +18,7 @@
_markerBit(false),
_sessionNACK(false),
_completeSession(false),
+ _decodableSession(false),
_frameType(kVideoFrameDelta),
_previousFrameLoss(false),
_lowSeqNum(-1),
@@ -70,6 +71,7 @@
_emptySeqNumHigh = -1;
_markerBit = false;
_completeSession = false;
+ _decodableSession = false;
_frameType = kVideoFrameDelta;
_previousFrameLoss = false;
_sessionNACK = false;
@@ -186,34 +188,37 @@
_markerSeqNum = packet.seqNum;
}
- UpdateCompleteSession();
-
return returnLength;
}
-void
-VCMSessionInfo::UpdateCompleteSession()
-{
- if (_packets[0].isFirstPacket && _markerBit)
- {
- // Do we have all the packets in this session?
- bool completeSession = true;
+void VCMSessionInfo::UpdateCompleteSession() {
+ if (_packets[0].isFirstPacket && _markerBit) {
+ // Do we have all the packets in this session?
+ bool completeSession = true;
- for (int i = 0; i <= _highestPacketIndex; ++i)
- {
- if (_packets[i].completeNALU == kNaluUnset)
- {
- completeSession = false;
- break;
- }
- }
- _completeSession = completeSession;
+ for (int i = 0; i <= _highestPacketIndex; ++i) {
+ if (_packets[i].completeNALU == kNaluUnset) {
+ completeSession = false;
+ break;
+ }
}
+ _completeSession = completeSession;
+ }
}
-bool VCMSessionInfo::IsSessionComplete() const
-{
- return _completeSession;
+void VCMSessionInfo::UpdateDecodableSession(WebRtc_UWord32 rttMs) {
+ // Irrelevant if session is already complete or decodable
+ if (_completeSession || _decodableSession)
+ return;
+ // First iteration - do nothing
+}
+
+bool VCMSessionInfo::IsSessionComplete() const {
+ return _completeSession;
+}
+
+bool VCMSessionInfo::IsSessionDecodable() const {
+ return _decodableSession;
}
// Find the start and end index of packetIndex packet.
@@ -537,7 +542,7 @@
WebRtc_Word32
VCMSessionInfo::ZeroOutSeqNumHybrid(WebRtc_Word32* list,
WebRtc_Word32 numberOfSeqNum,
- float rttScore)
+ WebRtc_UWord32 rttMs)
{
if (NULL == list || numberOfSeqNum < 1)
{
@@ -590,6 +595,9 @@
_emptySeqNumLow - 1: _highSeqNum;
}
+ // Place holder
+ int rttScore = 1.0f;
+
while (list[index] <= highMediaPacket && index < numberOfSeqNum)
{
if (_packets[i].completeNALU != kNaluUnset)
@@ -659,7 +667,9 @@
WebRtc_Word64
VCMSessionInfo::InsertPacket(const VCMPacket& packet,
- WebRtc_UWord8* ptrStartOfLayer)
+ WebRtc_UWord8* ptrStartOfLayer,
+ bool enableDecodableState,
+ WebRtc_UWord32 rttMs)
{
// not allowed
assert(!packet.insertStartCode || !packet.bits);
@@ -765,7 +775,11 @@
_highestPacketIndex = packetIndex > _highestPacketIndex ?
packetIndex :_highestPacketIndex;
- return InsertBuffer(ptrStartOfLayer, packetIndex, packet);
+ int returnLength = InsertBuffer(ptrStartOfLayer, packetIndex, packet);
+ UpdateCompleteSession();
+ if (enableDecodableState)
+ UpdateDecodableSession(rttMs);
+ return returnLength;
}