mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-07-01 23:57:37 +08:00
修复h264/h265 prefixSize计算错误的bug
This commit is contained in:
@@ -74,6 +74,21 @@ void splitH264(const char *ptr, int len, int prefix, const std::function<void(co
|
||||
}
|
||||
}
|
||||
|
||||
int prefixSize(const char *ptr, int len){
|
||||
if (len < 4) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (memcmp("\x00\x00\x01", ptr, 3) == 0) {
|
||||
return 3;
|
||||
}
|
||||
|
||||
if (memcmp("\x00\x00\x00\x01", ptr, 4) == 0) {
|
||||
return 4;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
//splitH264函数测试程序
|
||||
static onceToken s_token([](){
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace mediakit{
|
||||
|
||||
bool getAVCInfo(const string &strSps,int &iVideoWidth, int &iVideoHeight, float &iVideoFps);
|
||||
void splitH264(const char *ptr, int len, int prefix, const std::function<void(const char *, int, int)> &cb);
|
||||
|
||||
int prefixSize(const char *ptr, int len);
|
||||
/**
|
||||
* 264帧类
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user