mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-25 20:27:34 +08:00
兼容不规范的flv流,比如livegbs产生的flv流metadata flv tag解析异常
This commit is contained in:
parent
a31108cc51
commit
19d6f1a003
@ -91,21 +91,26 @@ void FlvSplitter::onRecvContent(const char *data, size_t len) {
|
|||||||
case MSG_DATA3: {
|
case MSG_DATA3: {
|
||||||
BufferLikeString buffer(string(data, len));
|
BufferLikeString buffer(string(data, len));
|
||||||
AMFDecoder dec(buffer, _type == MSG_DATA3 ? 3 : 0);
|
AMFDecoder dec(buffer, _type == MSG_DATA3 ? 3 : 0);
|
||||||
std::string type = dec.load<std::string>();
|
auto first = dec.load<AMFValue>();
|
||||||
bool flag = true;
|
bool flag = true;
|
||||||
if (type == "@setDataFrame") {
|
if (first.type() == AMFType::AMF_STRING) {
|
||||||
std::string type = dec.load<std::string>();
|
auto type = first.as_string();
|
||||||
if (type == "onMetaData") {
|
if (type == "@setDataFrame") {
|
||||||
|
type = dec.load<std::string>();
|
||||||
|
if (type == "onMetaData") {
|
||||||
|
flag = onRecvMetadata(dec.load<AMFValue>());
|
||||||
|
} else {
|
||||||
|
WarnL << "unknown type:" << type;
|
||||||
|
}
|
||||||
|
} else if (type == "onMetaData") {
|
||||||
flag = onRecvMetadata(dec.load<AMFValue>());
|
flag = onRecvMetadata(dec.load<AMFValue>());
|
||||||
} else {
|
} else {
|
||||||
WarnL << "unknown type:" << type;
|
WarnL << "unknown notify:" << type;
|
||||||
}
|
}
|
||||||
} else if (type == "onMetaData") {
|
|
||||||
flag = onRecvMetadata(dec.load<AMFValue>());
|
|
||||||
} else {
|
} else {
|
||||||
WarnL << "unknown notify:" << type;
|
WarnL << "Parse flv script data failed, invalid amf value: " << first.to_string();
|
||||||
}
|
}
|
||||||
if(!flag){
|
if (!flag) {
|
||||||
throw std::invalid_argument("check rtmp metadata failed");
|
throw std::invalid_argument("check rtmp metadata failed");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user