mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 19:00:01 +08:00
避免跳过一个正常的ts包
This commit is contained in:
parent
a64383a26b
commit
c8fedccd78
@ -35,13 +35,15 @@ const char *TSSegment::onSearchPacketTail(const char *data, size_t len) {
|
|||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
//下一个包头
|
//精确匹配下一个包头
|
||||||
if (((uint8_t *) data)[_size] == TS_SYNC_BYTE) {
|
if (((uint8_t *) data)[_size] == TS_SYNC_BYTE) {
|
||||||
return data + _size;
|
return data + _size;
|
||||||
}
|
}
|
||||||
auto pos = memchr(data + _size, TS_SYNC_BYTE, len - _size);
|
//搜索下一个包头
|
||||||
if (pos) {
|
for (int i = 1; i < len - _size; ++i) {
|
||||||
return (char *) pos;
|
if (((uint8_t *) data)[i] == TS_SYNC_BYTE && ((uint8_t *) data)[i + _size] == TS_SYNC_BYTE) {
|
||||||
|
return data + i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (remainDataSize() > 4 * _size) {
|
if (remainDataSize() > 4 * _size) {
|
||||||
//数据这么多都没ts包,全部清空
|
//数据这么多都没ts包,全部清空
|
||||||
|
Loading…
Reference in New Issue
Block a user