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