提交 6e719bde authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

2.3.1

上级 b6cd1941
# Changelog # Changelog
### 2.3.1
* H264: Check if there is room for the indicated NAL unit size (thanks @ggarber).
* H264: Code cleanup.
### 2.3.0 ### 2.3.0
* Add new "spy" feature. A "spy" peer cannot produce media and is invisible for other peers in the room. * Add new "spy" feature. A "spy" peer cannot produce media and is invisible for other peers in the room.
......
{ {
"name": "mediasoup", "name": "mediasoup",
"version": "2.3.0", "version": "2.3.1",
"description": "Cutting Edge WebRTC Video Conferencing", "description": "Cutting Edge WebRTC Video Conferencing",
"author": "Iñaki Baz Castillo <ibc@aliax.net> (https://inakibaz.me)", "author": "Iñaki Baz Castillo <ibc@aliax.net> (https://inakibaz.me)",
"contributors": [ "contributors": [
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
"randomatic": "^3.1.0" "randomatic": "^3.1.0"
}, },
"devDependencies": { "devDependencies": {
"eslint": "^5.6.1", "eslint": "^5.7.0",
"gulp": "^4.0.0", "gulp": "^4.0.0",
"gulp-clang-format": "^1.0.27", "gulp-clang-format": "^1.0.27",
"gulp-eslint": "^5.0.0", "gulp-eslint": "^5.0.0",
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
"clang-tools-prebuilt": "^0.1.4" "clang-tools-prebuilt": "^0.1.4"
}, },
"scripts": { "scripts": {
"lint": "gulp lint",
"test": "gulp test", "test": "gulp test",
"postinstall": "make Release" "postinstall": "make Release"
} }
......
...@@ -21,51 +21,61 @@ namespace RTC ...@@ -21,51 +21,61 @@ namespace RTC
uint8_t nal = *data & 0x1F; uint8_t nal = *data & 0x1F;
/** Single NAL unit packet **/ switch (nal)
// IDR (instantaneous decoding picture).
if (nal == 7)
{ {
payloadDescriptor->isKeyFrame = true; // Single NAL unit packet.
} // IDR (instantaneous decoding picture).
case 7:
/** Aggreation packet **/ {
payloadDescriptor->isKeyFrame = true;
// STAP-A. break;
else if (nal == 24) }
{
size_t offset = 1;
len -= 1;
// Iterate NAL units. // Aggreation packet.
while (len >= 3) // STAP-A.
case 24:
{ {
auto naluSize = Utils::Byte::Get2Bytes(data, offset); size_t offset = 1;
nal = *(data + offset + sizeof(naluSize)) & 0x1F; len -= 1;
if (nal == 7) // Iterate NAL units.
while (len >= 3)
{ {
payloadDescriptor->isKeyFrame = true; auto naluSize = Utils::Byte::Get2Bytes(data, offset);
nal = *(data + offset + sizeof(naluSize)) & 0x1F;
break; if (nal == 7)
} {
payloadDescriptor->isKeyFrame = true;
break;
}
// Check if there is room for the indicated NAL unit size. // Check if there is room for the indicated NAL unit size.
if (len < (naluSize + sizeof(naluSize))) if (len < (naluSize + sizeof(naluSize)))
break; break;
offset += naluSize + sizeof(naluSize); offset += naluSize + sizeof(naluSize);
len -= naluSize + sizeof(naluSize); len -= naluSize + sizeof(naluSize);
}
break;
} }
}
// FU-A, FU-B.
else if (nal == 28 || nal == 29)
{
nal = *(data + 1) & 0x1F;
uint8_t startBit = *(data + 1) & 0x80;
if (nal == 7 && startBit == 128) // Aggreation packet.
payloadDescriptor->isKeyFrame = true; // FU-A, FU-B.
case 28:
case 29:
{
nal = *(data + 1) & 0x1F;
uint8_t startBit = *(data + 1) & 0x80;
if (nal == 7 && startBit == 128)
payloadDescriptor->isKeyFrame = true;
break;
}
} }
return payloadDescriptor.release(); return payloadDescriptor.release();
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论