提交 8ba457ea authored 作者: José Luis Millán's avatar José Luis Millán

VP8: Don't rely on payload descriptor flags to assure the existence of data

上级 725ea8b7
...@@ -65,8 +65,11 @@ namespace RTC ...@@ -65,8 +65,11 @@ namespace RTC
uint8_t keyIndex : 5; uint8_t keyIndex : 5;
bool isKeyFrame = { false }; bool isKeyFrame = { false };
bool hasPictureId = { false };
bool hasOneBytePictureId = { false }; bool hasOneBytePictureId = { false };
bool hasTwoBytesPictureId = { false }; bool hasTwoBytesPictureId = { false };
bool hasTl0PictureIndex = { false };
bool hasTlIndex = { false };
}; };
public: public:
......
...@@ -64,6 +64,8 @@ namespace RTC ...@@ -64,6 +64,8 @@ namespace RTC
payloadDescriptor->pictureId = byte & 0x7F; payloadDescriptor->pictureId = byte & 0x7F;
} }
payloadDescriptor->hasPictureId = true;
} }
if (payloadDescriptor->l) if (payloadDescriptor->l)
...@@ -71,6 +73,8 @@ namespace RTC ...@@ -71,6 +73,8 @@ namespace RTC
if (len < ++offset + 1) if (len < ++offset + 1)
return nullptr; return nullptr;
payloadDescriptor->hasTl0PictureIndex = true;
payloadDescriptor->tl0PictureIndex = data[offset]; payloadDescriptor->tl0PictureIndex = data[offset];
} }
...@@ -81,6 +85,8 @@ namespace RTC ...@@ -81,6 +85,8 @@ namespace RTC
byte = data[offset]; byte = data[offset];
payloadDescriptor->hasTlIndex = true;
payloadDescriptor->tlIndex = (byte >> 6) & 0x03; payloadDescriptor->tlIndex = (byte >> 6) & 0x03;
payloadDescriptor->y = (byte >> 5) & 0x01; payloadDescriptor->y = (byte >> 5) & 0x01;
payloadDescriptor->keyIndex = byte & 0x1F; payloadDescriptor->keyIndex = byte & 0x1F;
...@@ -154,8 +160,11 @@ namespace RTC ...@@ -154,8 +160,11 @@ namespace RTC
MS_DUMP(" y : %" PRIu8, this->y); MS_DUMP(" y : %" PRIu8, this->y);
MS_DUMP(" keyIndex : %" PRIu8, this->keyIndex); MS_DUMP(" keyIndex : %" PRIu8, this->keyIndex);
MS_DUMP(" isKeyFrame : %s", this->isKeyFrame ? "true" : "false"); MS_DUMP(" isKeyFrame : %s", this->isKeyFrame ? "true" : "false");
MS_DUMP(" hasPictureId : %s", this->hasPictureId ? "true" : "false");
MS_DUMP(" hasOneBytePictureId : %s", this->hasOneBytePictureId ? "true" : "false"); MS_DUMP(" hasOneBytePictureId : %s", this->hasOneBytePictureId ? "true" : "false");
MS_DUMP(" hasTwoBytesPictureId : %s", this->hasTwoBytesPictureId ? "true" : "false"); MS_DUMP(" hasTwoBytesPictureId : %s", this->hasTwoBytesPictureId ? "true" : "false");
MS_DUMP(" hasTl0PictureIndex : %s", this->hasTl0PictureIndex ? "true" : "false");
MS_DUMP(" hasTlIndex : %s", this->hasTlIndex ? "true" : "false");
MS_DUMP("</PayloadDescriptor>"); MS_DUMP("</PayloadDescriptor>");
} }
...@@ -179,10 +188,14 @@ namespace RTC ...@@ -179,10 +188,14 @@ namespace RTC
} }
// Incremental pictureId. Check the temporal layer. // Incremental pictureId. Check the temporal layer.
if (
this->payloadDescriptor->hasPictureId && this->payloadDescriptor->hasTlIndex &&
this->payloadDescriptor->hasTl0PictureIndex)
{
if (RTC::SeqManager<uint16_t>::IsSeqHigherThan( if (RTC::SeqManager<uint16_t>::IsSeqHigherThan(
this->payloadDescriptor->pictureId, context->pictureIdManager.GetMaxInput())) this->payloadDescriptor->pictureId, context->pictureIdManager.GetMaxInput()))
{ {
if (this->payloadDescriptor->t && this->payloadDescriptor->tlIndex > context->preferences.temporalLayer) if (this->payloadDescriptor->tlIndex > context->preferences.temporalLayer)
{ {
context->pictureIdManager.Drop(this->payloadDescriptor->pictureId); context->pictureIdManager.Drop(this->payloadDescriptor->pictureId);
context->tl0PictureIndexManager.Drop(this->payloadDescriptor->tl0PictureIndex); context->tl0PictureIndexManager.Drop(this->payloadDescriptor->tl0PictureIndex);
...@@ -190,6 +203,7 @@ namespace RTC ...@@ -190,6 +203,7 @@ namespace RTC
return false; return false;
} }
} }
}
// Update pictureId and tl0PictureIndex values. // Update pictureId and tl0PictureIndex values.
uint16_t pictureId; uint16_t pictureId;
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论